利用rpm安裝mysql 5.6版本詳解_Mysql

來源:互聯網
上載者:User

前言

其實之前使用yum安裝MySQL確實很方便,但是預設安裝的myql5.0版本的,不支援utf8mb4(utf8mb4擴充到一個字元最多能有4節,所以能支援更多的字元集,比如支援emoji表情)編碼格式,所以要升級資料庫,yum庫升級貌似有點費勁,果斷卸載了,使用rpm直接安裝

卸載的時候遇到一些問題,要卸載乾淨請參考之前寫的一篇文章:http://www.jb51.net/article/97516.htm

言歸正傳,如何安裝呢,其實很簡單:

安裝過程

一、先到官網地址下載兩個包。

下載地址:http://dev.mysql.com/downloads/mysql/5.6.html

進入下載頁面有,選擇如下:

選擇Linux-generic後,又有很多產品選擇,我們只下載以下2個就可以了,一個服務包,一個用戶端包
Linux - Generic (glibc 2.5) (x86, 64-bit), RPM Package

MySQL Server

(MySQL-server-5.6.32-1.linux_glibc2.5.i386.rpm)

下載地址

wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-server-5.6.32-1.linux_glibc2.5.x86_64.rpm 

Linux - Generic (glibc 2.5) (x86, 64-bit), RPM Package

Client Utilities

(MySQL-client-5.6.32-1.linux_glibc2.5.x86_64.rpm)

下載地址

wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-client-5.6.32-1.linux_glibc2.5.x86_64.rpm 

進入下載檔案所以目錄進行安裝

> rpm -ivh MySQL-server-5.6.32-1.linux_glibc2.5.i386.rpm > rpm -ivh MySQL-client-5.6.32-1.linux_glibc2.5.x86_64.rpm 

安裝完之後啟動mysql

> service mysql start 

登入mysql

mysql [-u username] [-h host] [-p[password]] [dbname] 

新裝mysql串連時會報錯:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

解決方案如下:

方法一:

# /etc/init.d/mysql stop  # mysqld_safe --user=mysql --skip-grant-tables --skip-networking &  # mysql -u root mysql  mysql> UPDATE user SET Password=PASSWORD('xxxxxx') where USER='root'; mysql> FLUSH PRIVILEGES;  mysql> quit  # /etc/init.d/mysql restart  # mysql -uroot -p  Enter password: <輸入新設的密碼newpassword> mysql>

方法二:

直接使用/etc/mysql/debian.cnf檔案中[client]節提供的使用者名稱和密碼:

# mysql -udebian-sys-maint -p Enter password: <輸入[client]節的密碼> mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root'; mysql> FLUSH PRIVILEGES; mysql> quit # mysql -uroot -p Enter password: <輸入新設的密碼newpassword> mysql>

方法三:

# mysql -uroot -p Enter password: <輸入/etc/mysql/debian.cnf檔案中[client]節提供的密碼> 

好了,到這問題就解決了。

精彩專題分享:mysql不同版本安裝教程 mysql5.7各版本安裝教程

總結

以上就是這篇文章的全部內容,希望本文的內容對大家的學習或者工作能帶來一定的協助,如果有疑問大家可以留言交流。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.