CentOS7 installing MySQL and turning on remote access

Source: Internet
Author: User

1. Install MySQL

The MySQL series database is installed by default in CentOS7 and needs to be uninstalled first.

To view the currently installed MARIADB package:

[Email protected] desktop]# Rpm-qa | grep mariadb

Remove them all forcibly:

[Email protected] Desktop]# rpm-e--nodeps mariadb-libs-5.5.35-3.el7.x86_64

Download RPM installation package on official website, http://dev.mysql.com/downloads/mysql/, unzip after download is complete.

Double-click Install Mysql-server,mysql-client and mysql-devel three installation packages.

2. Start MySQL

[[email protected] desktop] #service mysql start

Get error:error! The server quit without updating PID file

We are here mainly because:SELinux, if it is a CentOS system, the default is to turn on SELinux. The workaround is to close it, open the/etc/selinux/config, change the selinux=enforcing to selinux=disabled, and then save the restart machine.

And then start MySQL again, there's no problem:

[[email protected] desktop] #service mysql start

To view MySQL running status:

[[Email protected] desktop]# service MySQL status

success! MySQL Running (2377)

3. Set the password

After installation, the root user does not have a password by default and the password is set by command.

[Email protected] desktop]#/usr/bin/mysqladmin-u root password ' passok '

Then set the root user's remote access permissions

Executing in MySQL console

GRANT all privileges on * * to ' root ' @ '% ' identified by ' MyPassword ' with GRANT OPTION;

FLUSH privileges;

4. Turn on remote connections

Need to install iptables,

Yum install-y iptables

Then edit the system's open port list, add 3306 ports, and restart the firewall.

CentOS7 installing MySQL and turning on remote access

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.