1.基本信息
show databases;
(information_schema
mysql
performance_schema
sys)
2.临时密码
去文件查看
/var/log/mysqld.log
也可以
grep 'temporary password' /var/log/mysqld.log
3.密码
mysql 5.7.9以后废弃了password字段和password()函数;authentication_string:字段表示用户密码。
use mysql;
select host,user,authentication_string from user;
(select host,user,authentication_string from mysql.user;)
update user set authentication_string='123456789' where user='root'(不行MySQL会对密码进行加密,直接修改密码没有加密)
ALTER user 'root'@'localhost' IDENTIFIED BY '123456789'(客户端登陆正常,navicat无法登陆)
alter user 'root'@'localhost' identified with mysql_native_password by '123456789'; (ok)
4.密码策略问题
查看强度策略
SHOW VARIABLES LIKE 'validate_password%';
改变密码前度策略
set global validate_password_policy=LOW;
改变密码验证长度
set global validate_password_length=6;
5.用户
use mysql
添加
create user "username"@"%" identified by "12345678"
查看权限
show grants for "username"@"%" ;
授权
GRANT all privileges ON *.* to "username"@"%";给用户分配所有数据库中所有表的 所有权限
flush privileges
网友评论