1:下載mysql安裝包mysql-5.6.10.tar.gz
2:安裝必要的軟件包
yum -y install gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* make cmake
3:編譯安裝
[root@server ~]# groupadd mysql
[root@server ~]# useradd -r -g mysql mysql
[root@server ~]# tar -zxvf mysql-5.6.10.tar.gz
[root@server ~]# cd mysql-5.6.10
[root@server mysql-5.6.10]# cmake .
[root@server mysql-5.6.10]# make && make install
-------------默認安裝目錄爲/usr/local/mysql
[root@server100 ~]# chown -R mysql.mysql /usr/local/mysql
[root@server ~]# cd /usr/local/mysql/scripts
[root@server ~]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
[root@server ~]# cd /usr/local/mysql/support-files
[root@server support-files]# cp mysql.server /etc/rc.d/init.d/mysql
[root@server support-files]# cp my-default.cnf /etc/my.cnf
[root@server ~]# chkconfig --add mysql
[root@server ~]# chkconfig mysql on
[root@server ~]# service mysql start
Starting MySQL SUCCESS!
將mysql拷貝到bin/mysql目錄下:
ln -fs /usr/local/mysql/bin/mysql /bin/mysql
運行mysql
[root@server100 support-files]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.10 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
爲mysql添加root遠程登錄權限
對於需要遠程登錄的用戶執行如下命令:mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "yourpasswd";
mysql> flush privileges;