CentOS7 offline installation Mysql (details of the installation process)

Mysql installation

Download the installation package mysql offline

https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar

After extracting the installation:

cd /root/mysql-5.7.27-1.el7.x86_64.rpm-bundle

rpm -Uvh *.rpm --nodeps --force

Mysql configuration

1. First, shut down mysql service:

service mysqld stop

2. Then modify the configuration file:

vi /etc/my.cnf

3. Next, the code can be added to a blank password mysql:

# Disabling symbolic-links is recommended to prevent assorted security risks
skip-grant-tables     #添加这句话,这时候登入mysql就不需要密码 symbolic-links=0

4. Turn mysql service:

service mysqld start

5. an empty password mysql:

mysql -u root -p    #输入命令回车进入,出现输入密码提示直接回车

6. Set mysql password:

mysql> set password for root@localhost = password('123456'); ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement mysql> flush privileges; #更新权限 Query OK, 0 rows affected (0.00 sec) mysql> set password for root@localhost = password('123456');  Query OK, 0 rows affected, 1 warning (0.00 sec) mysql>flush privileges; #更新权限 mysql>quit; #退出 service mysqld stop # 停止mysql服务, 恢复mysql配置 vim /etc/my.cnf #修改配置文件 # Disabling symbolic-links is recommended to prevent assorted security risks # skip-grant-tables # 注释掉这句话 symbolic-links=0 service mysqld start # 启动mysql服务 mysql -uroot -p # 输入新密码登录

7. Set the boot from Kai mysql:

systemctl enable mysqld

Guess you like

Origin www.cnblogs.com/JustinLau/p/11345089.html