CentOS 6.5 Install and configure MySQL

Source: Internet
Author: User
Tags iptables

Toss a half a day finally to install and configure MySQL, the following are the installation steps and problems encountered the solution

1. Check if MySQL or its related items are installed on the machine

# Yum List Installed | grep MySQL
If installed, the command finishes displaying a result similar to the following:
Mysql-community-common.x86_64
5.7.21-1.el6 @mysql57-COMMUNITY-DMR

You need to delete the existing MySQL and its related items, execute the following command
# yum-y Remove mysql-community-common.x86_64

2. Get MySQL
wget http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

If the command is executed, add "--no-check-certificate" to the end of the above command.

3. Download the MySQL installation file via rpm

Yum Install mysql-community-release-el6-5.noarch.rpm

Execute the following command when finished

Ls/etc/yum.repos.d

Two more files at this time

Mysql-community-source.repo
Mysql-community.repo

If the installation fails, manually modify the/etc/yum.repos.d/mysql-community.repo

Make the enable=1 under the mysql57

4. Installing the MySQL Service

Yum Install Mysql-community-server

5. Start the MySQL service

Service mysqld Start

6. View the root password to execute the following command

grep "Password"/var/log/mysqld.log

The command finishes displaying the following

2018-04-05t11:03:02.200577z 1 [Note] A temporary password is generated for [email protected]: iv~n79*.

iv~n79*. is the initial password

7. Reset the MySQL password, if you cannot access MySQL, you can use the following command to force access

Killall-term mysqld

Mysqld_safe--skip-grant-tables&

Then CTRL + C after Geixing

Mysql-u Root-p then enter the initial password

Then switch to MySQL database "use MySQL;" Note the last semicolon

Then hot line Update user set Authentication_string=password (' New password ') where user= ' root '; Note The final semicolon of the command

Execute the above statement, need to execute flush privileges; Then the hot line of quit; Then use the Make service mysqld restart; Restart the MySQL service, when local access is done

But in the usage scenario we're going to use remote access, keep looking down

8. Set MySQL to allow remote access

Set allow remote access use the following command

Grant all privileges on * * to ' root ' @ '% ' identified by ' new password ' with GRANT option;

The command hot line, all the tables of the database can be remote access, because the use of "* *", to do this is not enough, because the CentOS default is not open 3306 port, need to manually open

Take a look at the following command

Iptables-i input-p tcp-m State--state new-m tcp--dport 3306-j ACCEPT hot line after successful execution iptables-l-n if 3306 port development is successful, you will see the following words

State NEW TCP dpt:3306

Reference:

Https://www.cnblogs.com/lzj0218/p/5724446.html

Https://www.cnblogs.com/xiangxi/p/6267378.html

Please leave a message or contact the author via email [email protected].

CentOS 6.5 Install and configure MySQL

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.