1. 程式人生 > >Linux學習筆記:SQLyog連結linux虛擬機器上的mysql資料庫

Linux學習筆記:SQLyog連結linux虛擬機器上的mysql資料庫

可能出現的問題:

can't connect to MYSQL server on "localhost" (10060)

原因1:

Linux 主機上安裝的防火牆沒有開啟 3306 

解決:

編輯檔案 /etc/sysconfig/iptables

vi /etc/sysconfig/iptables

加上這一行

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

最後重啟防火牆

/etc/rc.d/init.d/iptables restart

原因2:

埠號不對,檢視linux上mysql的埠號

命令:mysql> show variables ;

問題2:

Access denied for user 'root'@'localhost' (using password: YES)

原因:使用者密碼錯誤,可能是沒有設定mysql密碼,

解決:修改初始使用者密碼

mysql -uroot -p
Enter password: 【輸入原來的密碼】
mysql>use mysql;
mysql> update user set password=passworD("test") where user='root';
mysql> flush privileges;


mysql> exit;

提示:檢視linuxIP地址輸入命令:ifconfig

提示:java,Linux技術交流QQ群:499950895