MYSQL-CENTOS7 Installation Tutorials

Source: Internet
Author: User

MYSQL-CENTOS7 installation 1. Download the MySQL repo source
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
2. Install the MYSQL-COMMUNITY-RELEASE-EL7-5.NOARCH.RPM package
rpm -ivh mysql-community-release-el7-5.noarch.rpm

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

3. Install MySQL
yum install mysql-server

Follow the steps to install it, but after the installation is complete, the password is a random password and requires a password reset.

4. Start MySQL
systemctl start mysqld

Extension: Stop MySQL Service

systemctl stop mysqld
5. Connect to MySQL

No password in the initial state, can be entered directly

mysql -u root -p

Exit

quit
6. Reset Password

After exiting MySQL, the following command can reset the password, the first time you do not need to enter the password (because no password), the second time to enter a new password, confirm again, reset the password successfully.

mysqladmin -u root -p password<old password><new password><confirm new passowrd>

After resetting the password, you can log in with the new password connection.

7. Allow Remote connections

Tip: Configure the firewall to open 3306 ports

8. Modify the MySQL default port

(1) Log in to MySQL

mysql -u root -p<Enter Password>

(2) View port number

mysql>'port';+---------------+-------+|Variable_name|Value|+---------------+-------+|port          |3306  |+---------------+-------+1 row in set (0.05 sec)

(3) Edit the /etc/my.cnf file, add port parameters, and set the port, note that the port is not used, save to exit.

[email protected] /> vim /etc/my.cnf [mysqld]port=3506datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockuser=mysql# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0[mysqld_safe]log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid

(4) Restart MySQL

systemctl restart mysqld

(5) Firewall open 9936 port for outside access

vim /etc/sysconfig/iptables# 添加下面这行代码-A INPUT -m state --state NEW -m tcp -p tcp --dport 9936 -j ACCEPT

MYSQL-CENTOS7 Installation Tutorials

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.