Linux系統下安裝Mysql

來源:互聯網
上載者:User

標籤:from   esc   nec   start   var   啟動服務   成功   退出   href   

原文檔地址:http://www.itpub.net/thread-1766546-1-1.html

 

 

1、在Linux伺服器上通過wget命令取得rpm包:

wget –c http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-server-5.6.10-1.rhel5.x86_64.rpm/from/http://cdn.mysql.com
wget –c http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-client-5.6.10-1.rhel5.x86_64.rpm/from/http://cdn.mysql.com
wget –c http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-devel-5.6.10-1.rhel5.x86_64.rpm/from/http://cdn.mysql.co

2、進入下載目錄,安裝Mysql伺服器:

rpm -ivh MySQL-server-5.6.10-1.rhel5.x86_64.rpm

3、安裝MySql用戶端:

rpm -ivh MySQL-client-5.5.28-1.rhel5.x86_64.rpm

4、安裝MySql開發依賴包:

rpm -ivh MySQL-devel-5.5.28-1.rhel5.x86_64.rpm

5、安裝完成後看是否安裝成功:

mysql

會出現錯誤提示:Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ (2)

可用如下命令啟動服務:

service mysql start

6、登入MySql,如果忘記密碼,則修改密碼;修改MySql設定檔:

vi /etc/my.cnf

輸入i,編輯設定檔;在Mysqld添加一行:

skip-grant-tables

按ESC,輸入:wq退出檔案編輯。

7、重度Mysql服務:

service mysqld restart

8、進入MySql,輸入:

mysql -uroot -p

輸入密碼時直接斷行符號進入MySql;輸入:

use mysql

更改密碼:

UPDATE user SET password=password("test123") WHERE user=‘root‘;

 

輸入:

flush privileges;

exit;

重新登入即可。

9、設定服務開機啟動:

chkconfig mysql on

或者進入/etc/rc.local檔案,添加如下內容:

/etc/init.d/mysql start

10、設定完成後重啟系統,並查看MySql連接埠資訊:

netstat -nat

 

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.