標籤:port 產生 退出 net exit 跳過 微軟 temporary erro
修改root本地登入密碼
修改root預設的密碼(方法一)
1.啟動mysql之後systemctl start mysqld.service
2.修改mysql的設定檔 vi /etc/my.cnf
找到[mysqld]
skip-grant-tables
skip-networking
3.重啟mysql systemctl restart mysqld.service
4.重新登陸mysql 就會跳過密碼
mysql -uroot -p
5.設定新的密碼
update mysql.user set authentication_string=password(‘123456‘) where user=‘root‘;
6.然後重新整理儲存
flush privileges;
7.退出mysql exit
再進入vi /etc/my.cnf skip-grant-tables skip-networking 刪除
8.重啟mysql伺服器 systemctl restart mysqld.service
9.再登陸就輸入新的密碼即可mysql -uroot -p
修改密碼
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY “”
[email protected]# 密碼需要有大寫字母 數字 和特殊字元
修改root預設的密碼(方法二)
mysql安裝完成之後,在/var/log/mysqld.log檔案中給root產生了一個預設密碼。通過下面的方式找到root預設密碼,然後登入mysql進行修改:
shell> grep ‘temporary password‘ /var/log/mysqld.log
shell> mysql -uroot -p
mysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘MyNewPass4!‘;
或者
mysql> set password for ‘root‘@‘localhost‘=password(‘MyNewPass4!‘);
記得加 grant all on *.* to ‘root‘@‘%‘ identified by ‘MyNewPass4!‘; 才可以mysqlFont遠端連線
3167錯誤
mysql> show variables like ‘%show_compatibility_56%‘;
mysql> set global show_compatibility_56=on;
1055錯誤
vim /etc/my.cnf 下面添加
sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
添加3306連接埠(已經添加請忽略)
firewall-cmd --zone=public --add-port=3306/tcp --permanent
重新啟動防火牆
systemctl restart firewalld.service
MySQL遠端連線:
GRANT ALL PRIVILEGES ON *.* TO ‘myuser‘@‘%‘ IDENTIFIED BY ‘mypassword‘ WITH GRANT OPTION;
Linux MySQL 修改密碼