Detailed tutorials for installing the Mysql database using Yum under CENTOS7 (Enhanced edition) _mysql

Source: Internet
Author: User

In the previous share of this article: CentOS 7.0 under the use of Yum installation of MySQL method, small set feel not detailed, today to everyone through this article to make a supplement, interested friends can refer to.

1. Download the MySQL repo source

$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

2. Install MYSQL-COMMUNITY-RELEASE-EL7-5.NOARCH.RPM Package

$ sudo rpm-ivh mysql-community-release-el7-5.noarch.rpm

After installing this package, you will get two MySQL yum repo Source:/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo.

3. Install MySQL

$ sudo yum install Mysql-server

Follow the steps to install it, but after the installation is complete, no password, you need to reset the password.

4. Reset Password

To first log in before resetting your password

$ mysql-u Root

It is possible to report this error when logging in: Error 2002 (HY000): Can ' t connect to the local MySQL server through socket '/var/lib/mysql/mysql.sock ' (2), because/var /lib/mysql access rights issue. The following command changes the owner of the/var/lib/mysql to the current user:

$ sudo chown-r openscanner:openscanner/var/lib/mysql

Then, restart the service:

$ Service Mysqld Restart

5. Firewall settings, open 3306 ports

Firewall-cmd--permanent--zone=public--add-port=3306/tcp firewall-cmd--permanent--zone=public--add-port=
3306/UDP
Firewall-cmd--reload

6. mysql Security settings

Mysql_secure_installation;

MySQL prompts you to reset the root password, remove other user accounts, disable root telnet, remove test database, Reload privilege form, and so on.

7. Create a remote access user

--implementation of the Environment users
CREATE user ' dbuser ' @ '% ' identified by ' 123456 ';
GRANT select,insert,update,delete on *.* to ' dbuser ' @ '% ';
--Admin users
CREATE user ' admin ' @ '% ' identified by ' 123456 ';
CREATE USER ' admin ' @ '% ' identified by ' 123456 ';
GRANT all on *.* to ' admin ' @ '% ';
Flush privileges;

8. Change data storage Directory

Mkdir/home/data
--Close the MySQL service process
systemctl status mysqld
mv/var/lib/mysql/home/data

modifying/etc/my.cnf files

Datadir=/home/data/mysql
socket=/home/data/mysql/mysql.sock
socket=/home/data/mysql/mysql.sock

The above is a small set to introduce the CENTOS7 under the use of Yum installation MySQL database detailed tutorials, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.