安裝環境:系統是 centos6.5
一、下載
下載地址:http://dev.mysql.com/downloads/mysql/5.6.html#downloads
下載版本:我這裏選擇的5.6.33,通用版,linux下64位
也能夠直接複製64位的下載地址,經過命令下載:wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz
二、解壓
1 #解壓
2 tar -zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz
3 #複製解壓後的mysql目錄
4 cp -r mysql-5.6.33-linux-glibc2.5-x86_64 /usr/local/mysql
三、添加用戶組和用戶
1 #添加用戶組
2 groupadd mysql
3 #添加用戶mysql 到用戶組mysql
4 useradd -g mysql mysql
四、安裝
1 cd /usr/local/mysql/<br>mkdir ./data/mysql
2 chown -R mysql:mysql ./
3 ./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/mysql
4 cp support-files/mysql.server /etc/init.d/mysqld
5 chmod 755 /etc/init.d/mysqld
6 cp support-files/my-default.cnf /etc/my.cnf
7
8 #修改啓動腳本
9 vi /etc/init.d/mysqld
10
11 #修改項:
12 basedir=/usr/local/mysql/
13 datadir=/usr/local/mysql/data/mysql
14
15 #啓動服務
16 service mysqld start
17
18 #測試鏈接
19 ./mysql/bin/mysql -uroot
20
21 #加入環境變量,編輯 /etc/profile,這樣能夠在任何地方用mysql命令了
22 export PATH=$PATH:/usr/local/mysql//bin<br>source /etc/profile
23
24
25 #啓動mysql
26 service mysqld start
27 #關閉mysql
28 service mysqld stop
29 #查看運行狀態
30 service mysqld status
五、錯誤
5.1 sqlyog鏈接時,報1130錯誤,是因爲沒有給遠程鏈接的用戶權限問題
解決1:更改 ‘mysql’數據庫‘user’表‘host’項,從‘localhost’改爲‘%’。html
use mysql;
select 'host' from user where user='root';
update user set host = '%' where user ='root';
flush privileges;
解決2:直接受權mysql
GRANT ALL PRIVILEGES ON *.* TO ‘root’@'%’ IDENTIFIED BY ‘youpassword’ WITH GRANT OPTION;
5.2 安裝時的一些錯誤
-bash: ./scripts/mysql_install_db: /usr/bin/perl: bad interpreter:
沒有那個文件或目錄 解決:
yum -y install perl perl-devel
Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
解決:
yum -y install libaio-devel
六、其餘
6.1 配置環境變量
vi + /etc/profile
export PATH=....:/usr/local/mysql/binlinux