1.解壓縮mysql-5.6.4-m7-tar.zipmysql
2.下載壓縮包cmake-xxx.tar.gz sql
3.安裝cmake數據庫
./configure --prefix=/usr/cmake_exe.net
makeserver
yum install bisonhtm
4.建立mysql用戶及用戶組blog
groupadd mysqlip
useradd -g mysql mysql(建立用戶到用戶組)get
5.安裝mysql it
5.1 安裝
yum install bison (解決cmake失敗的問題)
cd mysql-5.6.20
5.2編譯安裝
cmake .
make && make install
5.3 cd /usr/local/mysql/到該目錄下
chown -R mysql.mysql /usr/local/mysql
5.4 cd /usr/local/mysql/scripts 到該目錄下
5.5初始化數據庫
./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
6.註冊爲服務
cd /usr/local/mysql/support-files
#註冊服務
cp mysql.server /etc/rc.d/init.d/mysql
#使用默認配置文件
cp my-medium.cnf /etc/my.cnf
#讓chkconfig管理mysql服務
chkconfig --add mysql
#開機啓動
chkconfig mysql on
7.啓動mysql
service mysql start
8.將mysql的bin加入到path中
vi /etc/profile 加入如下內容 保存退出後從新登陸
PATH=/usr/local/mysql/bin:$PATH
export PATH
九、配置用戶密碼和遠程訪問權限
mysql -uroot
SET PASSWORD = PASSWORD('123456'); GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;