Centos MySQL5.6安裝方法

來源:互聯網
上載者:User

標籤:linux   centos   資料庫   mysql   rpm   

1. download rpm包

先確定系統版本

[[email protected] /]# cat /proc/version
Linux version 2.6.32-431.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) ) #1 SMP Fri Nov 22 03:15:09 UTC 2013

下載mysql rpm包

  wget http://mysql.mirrors.pair.com/Downloads/MySQL-5.6/MySQL-server-5.6.22-1.el6.x86_64.rpm

  wget http://mysql.mirrors.pair.com/Downloads/MySQL-5.6/MySQL-devel-5.6.22-1.el6.x86_64.rpm 
  wget http://mysql.mirrors.pair.com/Downloads/MySQL-5.6/MySQL-client-5.6.22-1.el6.x86_64.rpm 


2. 安裝

[[email protected] mysql]# rpm -ivh MySQL-server-5.6.22-1.el6.x86_64.rpm

[[email protected] mysql]# rpm -ivh MySQL-devel-5.6.22-1.el6.x86_64.rpm

[[email protected] mysql]# rpm -ivh MySQL-client-5.6.22-1.el6.x86_64.rpm

發現缺libaio.so包
error: Failed dependencies:
        /usr/bin/perl is needed by MySQL-server-5.6.22-1.el6.x86_64
        libaio.so.1()(64bit) is needed by MySQL-server-5.6.22-1.el6.x86_64
        libaio.so.1(LIBAIO_0.1)(64bit) is needed by MySQL-server-5.6.22-1.el6.x86_64
        libaio.so.1(LIBAIO_0.4)(64bit) is needed by MySQL-server-5.6.22-1.el6.x86_64
error: Failed dependencies:
        /usr/bin/perl is needed by MySQL-server-5.6.22-1.el6.x86_64

解決方案

[[email protected] mysql]# yum install libaio

[[email protected] mysql]# yum install perl

若處理mysql版本衝突,先移除已經安裝的mysql

[[email protected] mysql]# yum -y remove mysql-libs-5.1.71*


3.修改設定檔位置

[email protected] mysql]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf 


4,初使化MYSQL及配置密碼

[[email protected] mysql]#  /usr/bin/mysql_install_db

[[email protected] mysql]# service mysql start

[[email protected] mysql]# cat /root/.mysql_secret
# The random password set for the root user at Sat Feb  7 10:54:24 2015 (local time): VoKvw3vpo_3LiA3c

[[email protected] mysql]# mysql -uroot -pVoKvw3vpo_3LiA3c

mysql>  SET PASSWORD = PASSWORD(‘2345678‘);

mysql> exit
[[email protected] mysql]# mysql -uroot -pP#ssw0rd


5.遠程登入配置

mysql> use mysql

mysql> select host ,user ,password from user;
+-----------+------+-------------------------------------------+
| host      | user | password                                  |
+-----------+------+-------------------------------------------+
| localhost | root | *BC1C4715C23459AB982AD2D6617B4F8790161763 |
| xcldtc5m  | root | *44CF61DA6CDeeee2085F4598F728CF221DA8F167 |
| 127.0.0.1 | root | *44CF61DA6CD83e32085F4598F728CF221DA8F167 |
| ::1       | root | *44CF61DA6CD86832345F4598F728CF221DA8F167 |
+-----------+------+-------------------------------------------+

mysql> update user set password=password(‘234567‘) where user=‘root‘;

mysql> update user set host=‘%‘ where host=‘localhost‘;



6,設定開機自啟動

[[email protected] mysql]#  chkconfig mysql on
[[email protected] mysql]#  chkconfig --list | grep mysql
mysql           0:off   1:off   2:on    3:on    4:on    5:on    6:off


7,查看mysql設定檔位

[[email protected] mysql]# mysqld --verbose --help | grep -A 1 ‘Default options‘


8,MYSQL預設安裝位置

  1. /var/lib/mysql/               #資料庫目錄  
  2. /usr/share/mysql              #設定檔目錄  
  3. /usr/bin                     #相關命令目錄  
  4. /etc/init.d/mysql              #啟動指令碼 

9,配置字元集

修改字元集和資料存放區路徑

配置/etc/my.cnf檔案,修改資料存放路徑、mysql.sock路徑以及預設編碼utf-8.



Centos MySQL5.6安裝方法

相關文章

聯繫我們

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