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