程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> CentosMySQL5.6安裝方法

CentosMySQL5.6安裝方法

編輯:MySQL綜合教程

CentosMySQL5.6安裝方法


1. download rpm包
先確定系統版本
[root@xcldtc5m /]# 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. 安裝
[root@xcldtc5m mysql]# rpm -ivh MySQL-server-5.6.22-1.el6.x86_64.rpm
[root@xcldtc5m mysql]# rpm -ivh MySQL-devel-5.6.22-1.el6.x86_64.rpm
[root@xcldtc5m 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
解決方法
[root@xcldtc5m mysql]# yum install libaio
[root@xcldtc5m mysql]# yum install perl
若處理mysql版本沖突,先移除已經安裝的mysql
[root@xcldtc5m mysql]# yum -y remove mysql-libs-5.1.71*
3.修改配置文件位置
root@xcldtc5m mysql]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf
4,初使化MYSQL及配置密碼
[root@xcldtc5m mysql]# /usr/bin/mysql_install_db
[root@xcldtc5m mysql]# service mysql start
[root@xcldtc5m 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
[root@xcldtc5m mysql]# mysql -uroot -pVoKvw3vpo_3LiA3c
mysql> SET PASSWORD = PASSWORD('2345678');
mysql> exit
[root@xcldtc5m mysql]# mysql -uroot -p2345678
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,設置開機自啟動
[root@xcldtc5m mysql]# chkconfig mysql on
[root@xcldtc5m mysql]# chkconfig --list | grep mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
7,查看mysql配置文件位
[root@xcldtc5m mysql]# mysqld --verbose --help | grep -A 1 'Default options'
8,MYSQL默認安裝位置


/var/lib/mysql/ #數據庫目錄 /usr/share/mysql #配置文件目錄 /usr/bin #相關命令目錄 /etc/init.d/mysql #啟動腳本

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved