使用windows-SQLyog串連linux-mysql

來源:互聯網
上載者:User

標籤:

      嘿嘿,最近又清閑了一點,重新安裝了mysql去學習。  

-----部落格園-邦邦醬好

 

系統內容:

1. 主機為windows系統,安裝了SQLyog。

2. 主機上還安裝了虛擬機器,系統為centos6.4,裡面安裝了mysql5.0.95。

 

串連步驟:

1. 開啟虛擬機器的centos系統,登陸mysql,以啟動mysql服務。

登陸方法大概如下:

[[email protected] ~]# mysql -uroot -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 9Server version: 5.0.95-log Source distributionCopyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.mysql> 

印象中可以設定某些檔案,讓它每天定時自啟動的,沒仔細瞭解,就不細說了。

 

2. 檢查資料庫“mysql”的“user”表,看看root對應的host是否設定正確。

mysql> use mysqlDatabase changedmysql> select user,password,host from user;+---------+-------------------------------------------+------+| user    | password                                  | host |+---------+-------------------------------------------+------+| root    | *23AE809DDACAF96AF0FD78ED04B6A265E05AA257 | %    | | tester1 | 123                                       | %    | +---------+-------------------------------------------+------+2 rows in set (0.00 sec)mysql> 

注意:

(1)上文中root的host已經是%,意思是所有不同主機都可以串連到此處的mysql來,記得設定過表內容後,再接著在update語句下輸入:mysql> FLUSH PRIVILEGES命令來更新表內容,否則SQLyog是感受不到資料庫的改變的。

(2)其實%是不大安全的,理論上可以把host設定為主機win7系統的IP地址,這樣就只有本機可以串連它了,但是我試了,發現不能連上,提示如下,我也搞不懂了。

                         

(3)host在這裡不能被設為localhost,因為主機的IP地址和虛擬機器中系統的IP地址是不一樣的。可以使用ifconfig命令查看centos系統的IP地址,這裡的我centos系統IP地址為:192.168.254.129。

[[email protected] ~]# ifconfigeth0      Link encap:Ethernet  HWaddr 00:0C:29:FE:DE:02            inet addr:192.168.254.129  Bcast:192.168.254.255  Mask:255.255.255.0          inet6 addr: fe80::20c:29ff:fefe:de02/64 Scope:Link          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1          RX packets:21330 errors:0 dropped:0 overruns:0 frame:0          TX packets:12326 errors:0 dropped:0 overruns:0 carrier:0          collisions:0 txqueuelen:1000           RX bytes:28364229 (27.0 MiB)  TX bytes:757142 (739.3 KiB)          Interrupt:19 Base address:0x2024 lo        Link encap:Local Loopback            inet addr:127.0.0.1  Mask:255.0.0.0          inet6 addr: ::1/128 Scope:Host          UP LOOPBACK RUNNING  MTU:16436  Metric:1          RX packets:12 errors:0 dropped:0 overruns:0 frame:0          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0          collisions:0 txqueuelen:0           RX bytes:720 (720.0 b)  TX bytes:720 (720.0 b)

(4)如果把host設為localhost,那是因為mysql跟SQLyog是在同一個系統上安裝的,所以才行。

 

3. 在SQLyog裡建立一個串連

注意:

(1)Saved Connects是你設定的串連名稱,可以隨意設定。

(2)MySQL Host Address是要串連的mysql所在的IP地址,如果mysql跟SQLyog安裝在同一個系統上,那就可以寫為:localhost。

(3)輸入登入mysql所用的使用者名稱,密碼。

(4)其他資訊預設即可。

 

4. 點擊串連connect,如果成功,即可看到如下資料庫結構:

左右對比可見串連後看到的資料庫名稱,跟伺服器上的資料庫名稱是一樣的~~~

 

使用windows-SQLyog串連linux-mysql

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.