wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
RPM–IVH mysql57-community-release-el7-8.noarch.rpm
Yum Install Mysql-server
Enter/etc Edit my.cnf on the last line plus skip-grant-tables skip MySQL password verification
Service mysqld Restart Restart database
Mysql-u root directly into the database without a password
Use MySQL to enter the MySQL database
Execute SQL command: Update mysql.user set Authentication_string=password (' Password ') where user= ' root ' and Host = ' localhost '; To change the root password
Flush Privileges Submit Command
Exit MySQL
/ETC/MY.CNF Edit Profile Comment last line
Service mysqld Restart Restart database
MYSQL-UROOT-P Login
Turn on remote connections
Alter user ' root ' @ ' localhost ' identified by ' Fuzapassword ' Reset password
GRANT all privileges on * * to ' root ' @ '% ' identified by ' Fuzapassword ' with GRANT OPTION
Flush privileges Submit Execution Results
MySQL Database storage Directory Migration
1. Stop the MySQL service
Service Mysqld Stop
2. Create a destination folder under the target folder you want to move
mkdir Mysqldata
3. Change user group/user to Mysql:mysql
CHOWN-VR Mysql:mysql mysqldata/
4. Change access rights to 700
CHMOD-VR mysqldata/
5. Copy the database files to the destination folder
cp-av/var/lib/mysql/*/mysqldata
6. Modify the data storage directory in the database configuration file
Vi/etc/my.conf
Datadir=/var/lib/mysql change to Datadir=/mysqldata.
7.service mysqld Start
MySQL installation and database storage directory migration under CentOS