Linux uses RPM to install the latest MySQL (5.7) Steps and frequently asked questions resolved

Source: Internet
Author: User

First step: Download RPM Package

MySQL official website download: http://dev.mysql.com/downloads/mysql/
But if your download speed is not good, you can click the link below to download the version you want
http://mirrors.sohu.com/mysql/MySQL-5.7/
What I'm using is (CentOs6.5) to download:
mysql-5.7.16-1.el6.x86_64.rpm-bundle.tar文件

Step Two: Install

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 xxxxXXXX 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.