解決mysql連線不成功問題
阿新 • • 發佈:2018-12-26
service mysqld stop
/usr/bin/mysqld_safe --skip-grant-tables
再開一個終端
mysql -u root
use mysql;
select * from user;
desc user;
插入自己想的使用者名稱和密碼:insert into user(host,user,password) values('%', 'root', password('123456'));
flush privileges;
// 授權可以建立資料庫
set global read_only=0;
flush privileges;
grant all privileges on *.* to 'root'@'localhost' identified by '123456' with grant option;
service mysqld restart;
// 遠端可以訪問
grant all privileges on pan.* to 'root'@'%' identified by '123456' with grant option;
// 可以儲存過程
show grants for root;
grant execute on configdb.* to 'user_test1'@'%' IDENTIFIED BY PASSWORD '*00A51F3F48415C7D4E8908980D443C29C69B60C9';
flush privileges;
service mysqld restart;
// 檢視許可權
show grants for [email protected]'%';