Download the installation package on the website.
1. Check if the MySQL package is installed:
Rpm-qa | grep MySQL
Mysql-libs-5.1.73-8.el6_8.ns6.01.x86_64
Mysql-5.1.73-8.el6_8.ns6.01.x86_64
Mysql-devel-5.1.73-8.el6_8.ns6.01.x86_64
2. Uninstall:
RPM-E--nodeps mysql-libs-5.1.73-8.el6_8.ns6.01.x86_64
RPM-E--nodeps mysql-5.1.73-8.el6_8.ns6.01.x86_64
RPM-E--nodeps mysql-devel-5.1.73-8.el6_8.ns6.01.x86_64
3. Find MySQL installation path to delete each
Find/name MySQL
After that, the installation begins.
Mkdir/home/mysql
Mkdir/home/mysql/data
Groupadd MySQL
Useradd-g mysql-d/home/mysql MySQL
Unpacking the installation package
TAR-XZVF mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
CD mysql-5.7.21-linux-glibc2.12-x86_64
Move the directory to the Home/mysql directory and rename it
MV */home/mysql
Cd/home/mysql
Ls
Install, print the last behavior in the screen after the initial password is copied down for later use.
./bin/mysqld--user=mysql--basedir=/home/mysql--datadir=/home/mysql/data--initialize
Modify the Data directory permissions in the MySQL directory
Chown-r Mysql:mysql/home/mysql/data
Chmod-r 755/home/mysql/data
CD support-files/
Ls
Vim Mysql.server
Basedir=/home/mysql
Datadir=/home/mysql/data
: Wq
./support-files/mysql.server Start
If/etc/does not have my.cnf Xu Xian create a
Touch/etc/my.cnf
Vim/etc/my.cnf
[Client]
Port = 3306
#socket =/usr/local/mysql/data/mysql.sock
Default-character-set=utf8
Cd..
[Mysqld]
* * #sqlmode =noenginesubstitution,stricttranstables
General configuration options
**basedir =/home/mysql
DataDir =/home/mysql/data
Port = 3306
#socket =/usr/local/mysql/data/mysql.sock
Charactersetserver=utf8
initconnect= ' SET NAMES UTF8 ' * *
: Wq
(configuration files may be copied elsewhere) *
Put the startup script in the boot initialization directory
Cp/home/mysql/support-files/mysql.server/etc/init.d/mysqld
Creating a soft connection
Ln-s/home/mysql/bin/mysql/usr/bin/mysql
chmod 755/etc/init.d/mysql
chmod 755/etc/init.d/mysqld
Chkconfig--add mysqld to register MySQL as an open startup item
Chkconfig--list mysqld See if Add success
Chkconfig mysqld on
CD bin
./mysql-u Root-p
System-generated initial password
Set Password=password (' New password ');
Use MySQL;
Update user set host= '% ' where user= ' root ';
GRANT all privileges on . to [email protected] '% ' identified by ' Set password ' with GRANT OPTION;
FLUSH privileges;
Exit
Service mysqld Restart
Successful operation of Kylin operating system installation mysql5.7.21