1. 解壓安裝包,後改資料夾名為mysql
tar -xvzf mysql-5.6.38-linux-glibc2.12-i686.tar.gz
2.進入mysql目錄,新增系統mysql組和mysql使用者,修改目錄許可權
groupadd mysql useradd -r -g mysql mysql
chown -R mysql:mysql ./
3.建立配置檔案所配置的資料夾並修改許可權(資料夾即可)
datadir socket log-error(需要建立檔案) pid-file
4.安裝必要模組:
yum -y install numactl.x86_64 yum -y install autoconf yum install -y libaio
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
5.修改許可權
chown -R root:root .
chown -R mysql:mysql data
6.新增並啟動服務
cp support-files/mysql.server /etc/init.d/mysql
service mysql start
7.建立軟連線
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
ln -s /usr/local/mysql/bin/mysql /usr/bin
8.修改初始密碼
./bin/mysqladmin -u root password '123456'
9.開啟遠端連線許可權
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '123456' WITH GRANT OPTION;
FLUSH PRIVILEGES;