启动和关闭
service mysql start
service mysql stop
service mysql status
远程登录
mysql -h 192.168.199.109 -P 3306 -u root -p123456
mysql -h 192.168.199.166 -P 3306 -u root -p123456
查看当前登录用户
select user();
创建用户
create user zhangsan identified by 'zhangsan';
create user 'lisi'@'%' identified by 'lisi';
授权
grant all privileges on *.* to 'zhangsan'@'%' with grant option;
删除用户
drop user 'zhangsan'@'%'
查看mysql版本
select version();
错误
ERROR 2059 (HY000): Authentication plugin ‘caching_sha2_password’ cannot be loaded:
1.在mysql配置文件中加入default_authentication_plugin=mysql_native_password
2.创建用户
create user wangwu identified by ‘wangsu’;