1. 程式人生 > >mysql linux 填坑筆記

mysql linux 填坑筆記

數據庫 href sql 配置文件 use local .html flush select var

開放navicat登錄mysql數據庫權限

1)

GRANT ALL PRIVILEGES ON *.* TO ‘root‘ @‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION;

GRANT ALL PRIVILEGES ON *.* TO ‘mchz‘ @‘%‘ IDENTIFIED BY ‘mchz‘ WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO ‘admin‘ @‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION;

FLUSH PRIVILEGES;

或2)

UPDATE mysql.user SET Password=PASSWORD(‘123456‘) where USER=‘root‘;

update user set host = ‘localhost‘ where user = ‘mchz‘ and host=‘%2‘ ;
update user set host = ‘%‘ where user = ‘root‘ ;

------------------------------------------------------------------------------------------------------------------------------

忘記root密碼

關鍵語句 skip-grant-tables

參見https://www.jb51.net/article/100925.htm

這招很強??

--------------------------------------------------------------------------------------------------------------------------------

mysql啟動失敗, 報錯,

重啟mysql, 建立軟連接文件

解決Can ‘t connect to local MySQL server through socket ‘/tmp/mysql.sock ‘
ln /var/lib/mysql/mysql.sock /tmp/mysql.sock

---------------------------------------------------------------------------------------------------------------------------------

linux mysql 操作命令

登錄
mysql -u mchz -p
use mysql;

select host, user,password from user;

mysql status ,如報lock ,需要去log裏面刪除lock文件

mysql 配置文件路徑./etc/my.cnf

mysql linux 填坑筆記