linux环境
// 1.启动mysql服务
systemctl start mysqld.service
// 2.停止mysql服务
systemctl stop mysqld.service
// 3.重启mysql服务
systemctl restart mysqld.service
// 4.查看mysql服务当前状态
systemctl status mysqld.service
// 5.设置mysql服务开机自启动
systemctl enable mysqld.service
// 6.停止mysql服务开机自启动
systemctl disable mysqld.service
// 7.查看mysql用户-huiyi的操作权限
SELECT * FROM mysql.user WHERE user='huiyi'\G
// 8.增加用户操作权限
UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root';
FLUSH PRIVILEGES;
// 9.为用户添加操作权限
grant select,update,insert,delete,create,drop,grant option,references on *.* to "huiyi"@"%" with grant option;
FLUSH PRIVILEGES;
// 10.进入本地mysql
mysql -u root -p
mysql -h 127.0.0.1 -u root -p
mysql -h localhost -u root -p
// 11.进入指定iP mysql
mysql -h 10.31.4.10 -u root -p
// 12.退出mysql操作区域
exit
网友评论