tar -xvf mysql-5.7.26-linux-glibc2.12-x86_64.tar
// mv mysql-5.7.26-linux-glibc2.12-x86_64 /usr/local/mysql
groupadd mysql
useradd -r -g mysql mysql
mkdir -p /data/mysql #创建目录
chown mysql:mysql -R /data/mysql #赋予权限
vim /etc/my.cnf
[mysqld]
bind-address=0.0.0.0
port=3306
user=mysql
basedir=/usr/local/mysql
datadir=/data/mysql
socket=/tmp/mysql.sock
log-error=/data/mysql/mysql.err
pid-file=/data/mysql/mysql.pid
#character config
character_set_server=utf8mb4
symbolic-links=0
explicit_defaults_for_timestamp=true
cd /usr/local/mysql/bin/
./mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql/ --datadir=/data/mysql/ --user=mysql --initialize
cat /data/mysql/mysql.err
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
service mysql start
ps -ef|grep mysql
./mysql -u root -p #bin目录下
SET PASSWORD = PASSWORD('123456');
ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
FLUSH PRIVILEGES;
use mysql #访问mysql库
update user set host = '%' where user = 'root'; #使root能再任何host访问
FLUSH PRIVILEGES; #刷新
ln -s /usr/local/mysql/bin/mysql /usr/bin