一、mysql二進制下載安裝html
下載地址 https://dev.mysql.com/downloads/mysql/5.7.html#downloads
下載地址 https://dev.mysql.com/downloads/mysql/5.7.html#downloadsmysql
二、上傳到/usr/local/srclinux
三、解壓sql
mkdir -p /usr/local/mysql
tar xf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.7.24-linux-glibc2.12-x86_64/* /usr/local/mysql
四、新增mysql用戶,受權用戶vim
useradd -s /sbin/nologin -M mysql
chown -R mysql.mysql /usr/local/mysql
五、安裝依賴包socket
yum install libaio -y
六、安裝msyqlspa
cd /usr/local/mysql
./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
提示:這裏會生成隨機密碼,記下來(好比:#BOV*H%Zn8o=)
七、配置my.cnf code
vim /etc/my.cnf
[mysqld] character-set-server=utf8 datadir=/usr/local/mysql/data basedir=/usr/local/mysql socket=/tmp/mysql.sock
八、設置開啓啓動server
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
九、設置環境變量htm
vim /etc/profile
MYSQL_HOME=/usr/local/mysql export PATH=$PATH:$MYSQL_HOME/bin
#生效
source /etc/profile
十、啓動修改密碼
/etc/init.d/mysqld start mysql> set password = password('mysql');