20200819- MySQL installation and environment variable configuration under Linux environment

1. Upload the installation package to the /opt directory cd /opt
"/opt/MySQL-client-5.6.46-1.el7.x86_64.rpm"
"/opt/MySQL-server-5.6.46-1.el7.x86_64 .rpm"
2. Install dependent packages perl, new-tools, autoconf
yum install -y perl
3. Uninstall conflicting packages
Check conflicting packages:
rpm -qa | grep mariadb
Uninstall conflicting packages:
rpm -e mariadb-libs-5.5.60 -1.el7_5.x86_64 –nodeps
4. Install mysql
first install the client
[root@localhost opt]# rpm -ivh MySQL-client-5.6.46-1.el7.x86_64.rpm
and then install the server server: rpm -ivh MySQL-server-5.6.46-1.el7.x86_64.rpm
5. Modify the configuration file vi /usr/my.cnf, the
third line: 3gg+Enter a enter the insert state, the modification is complete, and Esc exit the insert state: wq save and exit
[client ]
default-character-set=utf8
[mysqld]
skip-grant-tables
character_set_server=utf8
collation_server=utf8_general_ci
6. Start mysql:
[root@localhost opt]# service mysql start
Starting MySQL. SUCCESS!
7. Enter mysql to enter the mysql command line
[root@localhost opt]# mysql
8.use mysql to enter the mysql library: use mysql
mysql > use mysql
9. Modify the root password
update user set password=password('ok');
quit Exit
10. Modify the configuration file again, add # in front of skip-grant-tables and save and exit
[root@localhost opt]# vi /usr/my.cnf
#skip-grant-tables
11. Restart the mysql service
[root@localhost opt]# service mysql restart
Shutting down MySQL... SUCCESS!
Starting MySQL. SUCCESS!

Guess you like

Origin blog.csdn.net/qq_42005540/article/details/108107396