mysql8.0创建用户
//查看用户
select * from user ;
//创建用户
create user 'test'@'%' identified by '123456';
//删除用户
drop user 'test'@'%';
//用户授权
//8.0版本不支持以下授权
grant select,insert on *.* to 'test'@'localhost' identified by 'test';
grant usage on *.* to 'discuz'@'localhost' identified by 'XXX';
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
//测试通过的创建方式(新版本不需要重新指定密码,这样更合理)
grant select on dbname.tablename to 'test'@'%';
grant all privileges on *.* to 'root'@'%';
//查看授权
show grants for 'test'@'%'
mysql5.7安装后初始密码:
sudo cat /etc/mysql/debian.cnf
update user set authentication_string=password('新密码') where user='root' and Host='localhost';
flush privileges;
//远程访问
vim /etc/mysql/mysql.conf.d/mysqld.cnf