1, download mode
1, access mysql link https://dev.mysql.com/downloads/mysql/
2, mysql download
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
tar -xvzf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.7.26-linux-glibc2.12-x86_64 mysql
3. Create mysql user
groupadd mysql
useradd -r -g mysql mysql
4, edit the configuration file
cp support-files/my-default.cnf /etc/my.cnf
vim /etc/my.cnf
[mysqld]
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 330
socket = /tmp/mysql.sock
character-set-server = utf8
skip-name-resolve
log-err = /usr/local/mysql/data/error.log
pid-file = /usr/local/mysql/data/mysql.pid
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
5, set permissions
chown -R root:root .
chown -R mysql:mysql data
6, initialization mysql
./scripts/mysql_install_db --user=mysql --defaults-file=/etc/my.cnf
7, install mysql
cp ./support-files/mysql.server /etc/init.d/mysqld
cp ./support-files/mysql.server /etc/rc.d/init.d/mysql
chmod 700 /etc/init.d/mysql
chkconfig --add mysqld
chkconfig --level 2345 mysqld on
8, modify the login authority
mysql -uroot -p
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' with grant option;
Flush privileges;