[root@mytestlnx02~]# service mysql restart [root@mytestlnx02~]# mysql -u root Type 'help;'or'\h'for help. Type '\c'to clear the current input statement. mysql>
修改密码
1 2 3 4 5 6 7 8 9 10 11 12 13
mysql> use mysql; Reading table information for completion oftableandcolumn names You can turn off this feature toget a quicker startup with-A Database changed mysql> update mysql.user set authentication_string=password('新密代放这里') whereuser='root'; Query OK, 1row affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 1 mysql> flush privileges; #刷新缓存 Query OK, 0rows affected (0.00 sec) mysql> exit
重启 mysql 服务
重启之前把 skip-grant-tables 删掉或注释掉
1
[root@mytestlnx02~]# service mysql restart
密码登录查看即可
查看数据库
查看所有数据库 show databases;
use 数据库名
show tables;
对表进行操作
项目服务报错-500
报错信息:java.sql.SQLException: null, message from server: “Host ‘XXX’ is not allowed to connect