mysql -H 主机IP -u 用户名 -p
-p表示要输密码,不要直接输了,要回车后在程序里输入
显示数据库列表:
show databases;
选择XX数据库:
use XX;
显示数据库里的表:
show tables;
查看数据库有几个用户:
SELECT User, Host, Password FROM mysql.user;
修改密码:
use mysql;
update user set password=PASSWORD("mynewpassword") where User='root';
flush privileges;
修改登录权限:
grant all privileges on *.* to root@'%' identified by "password";
flush privileges;