Specific as follows:
1. Check the system's own MySQL and related RPM packages, whether installed
rpm -qa | grep -i mysql
Remove (rpm–e name) If there is an installation
yum -y remove mysql
2. Create users and groups (skip if they have already been created)
groupadd mysql
useradd -r -g mysql mysql
3. Unzip the tar file and install
Go to file directory to run: TAR-XF Mysql-5.7.16-1.el6.x86_64.rpm-bundle.tar decompression is complete, then execute it sequentially.
rpm -ivh mysql-community-common-5.7.16-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.16-1.el6.x86_64.rpm
rpm -ivh mysql-community-client-5.7.16-1.el6.x86_64.rpm
rpm -ivh mysql-community-server-5.7.16-1.el6.x86_64.rpm
To this, MySQL has been installed to complete.
4. Basic Configuration
Execution: service mysqld start
presence indicates successful installation
To turn off the MySQL service:service mysqld stop
Initialize (this is done as root):bin/mysqld --initialize --user=mysql
Note: Using –initialize will generate a random initial password for the root account, we can use the command: Mysql-u root-p, and then enter the password to log in to MySQL. Using –initialize-insecure will not generate a random initial password for the root account, we can use the command: mysql-u root–skip-password directly login to MySQL, here I was the first.
Let's take a look at the random initial password of the root account and execute the command:vi /var/log/mysqld.log
To start the MySQL service:service mysqld start
Login: mysql -u root -p
and enter your password
However, I just encountered a problem here, after entering the password prompt: Access denied for user ' root ' @ ' localhost ' (using Password:yes). Baidu, the answer has a lot, try a bit, the process is as follows:
First turn off the MySQL service:service mysqld stop
Restart the service with Mysqld_safe, execute: mysqld_safe --user=root --skip-grant-tables --skip-networking &
If prompted Mysqld_safe A mysqld process already exists. Execution ps -A|grep mysql
Displays the current process, and then executes
kill -9 xxxx
XXXX fill in the process number you have detected. Then it's okay to do it.
Performmysql -u root
Many of the online statements are executed update user set password=PASSWORD(‘12345‘) where user=‘root‘;
I tried but the hint did not password this field, Baidu had the original 5.7 version after the password field became authentication_string, the implementation is update user set authentication_string=PASSWORD(‘12345‘) where user=‘root‘;
sure to do.
Then execute: flush privileges;
Finally: quit
Log in again OK
Then I want root to be able to link to this database on other hosts as well.
Execution: GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘mypassword‘ WITH
GRANT OPTION;
prompt You must reset your password, meaning let me reset the password first (what the XXXX). All right, let's go.
Password reset, just shut down the MySQL service and execute it in turn:
mysqld_safe --user=root --skip-networking &
mysql -u root -p
SET PASSWORD = PASSWORD(‘your new password‘);
ALTER USER ‘root‘@‘localhost‘ PASSWORD EXPIRE NEVER;
flush privileges;
quit;
Note: The new password can not be too simple, otherwise it will prompt the password is too simple, preferably include uppercase and lowercase letters, numbers, special characters.
Everything OK
Execution: GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘mypassword‘ WITH
GRANT OPTION;
To restart the MySQL service: service mysqld restart
Test pass ...
Linux uses RPM to install the latest MySQL (5.7) Steps and frequently asked questions resolved