Go: Linux CentOS6.5 yum install MySQL 5.6

Source: Internet
Author: User
Tags iptables yum repolist

Press: The following article passed me all the way to test no problem, is a good article, in this thank the author do not step on my robe. I added my own content later.

Source: https://www.cnblogs.com/renjidong/p/7047396.html

1. Newly opened cloud server, need to detect whether the system comes with the installation of MySQL

# Yum List Installed | grep MySQL

2. If you find a system that comes with MySQL, do it decisively

# yum-y Remove mysql-libs.x86_64


3. Wherever you store files in the directory to execute, here to explain, because this MySQL source servers in the server abroad, so download speed will be relatively slow, fortunately mysql5.6 only 79M big, and mysql5.7 182M, so this is I do not want to install mysql5.7 reason

# wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm


4. Then execute this sentence and explain that this rpm is not a MySQL installation file, just two yum source files, executed after the/etc/yum.repos.d/ This directory has more Mysql-community-source.repo and Mysql-community.repo

# RPM-IVH mysql-community-release-el6-5.noarch.rpm


5. At this time, you can use the Yum repolist mysql command to see if you already have MySQL installable files

#yum Repolist All | grep MySQL


6. Install the MySQL server command (yes):

# yum Install Mysql-community-server


7. After successful installation

# service Mysqld Start


8. Since MySQL has just been installed, the root password of MySQL is empty by default, so we need to log in in time with the root user of MySQL (first enter, no password), and change the password

# mysql-u Root
# use MySQL;
# Update user set Password=password (' 123456 ') where user= ' root ';
# flush Privileges;


9. Check if MySQL is self-booting and set the self-start command

# chkconfig--list | grep mysqld
# Chkconfig Mysqld on
10.mysql security settings (the system will ask you a few questions, can not understand the translation after the copy, basically all the way Yes):

# mysql_secure_installation

Here's what I personally added:

Go to MySQL database management console
#./mysql-u root-p
Enter Password:
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 4
Server version:5.0.67 Source Distribution

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the buffer.

Mysql> Grant all privileges on * * to [e-mail protected] '% ' identified by ' root ';
Query OK, 0 rows Affected (0.00 sec)

Mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)

Mysql> Grant Select,update,insert,delete on * * to [e-mail protected] identified by "root";
Query OK, 0 rows Affected (0.00 sec)

Mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)

Mysql> quit
Bye

The above step is to authorize

Then restart the mysqld service
service mysqld restart
Stopping mysql:                                               [  ok ]
Starting mysql:                                              [  OK  ]

Enter the MySQL management console again (
mysql-u root-p
Enter Password:
Welcome to the MySQL monitor.  Commands end With ; or \g.
Your MySQL Connection ID is 2
Server version:5.0.67 Source distribution

Type ' help; ' or ' \h ' to help . Type ' \c ' to clear the buffer.

mysql>  use MySQL
Reading table information for completion of table and column names< Br>you can turn off this feature to get a quicker startup with-a

Database changed
mysql>  update User set Password=password (' 12345678 ') where user= ' root ';
Query OK, 5 rows Affected (0.00 sec)
Rows matched:5  changed:5  warnings:0

Mysql>  flush privileges;
Query OK, 0 rows Affected (0.00 sec)

mysql>  quit
Bye

The above steps are to modify the root user's password

Then turn on port 3306 on the firewall
# Vi/etc/sysconfig/iptables

The following is the content of/etc/sysconfig/iptables, where the blue line is new. This line can be copied from the previous line, by the way in 22 which row is pressed yy, then press P, then click the Insert key into the edit mode, modify 22 to 3306, then ESC, enter Wq save exit.
# Firewall configuration written by System-config-firewall
# Manual Customization of this file are not recommended.
*filter
: INPUT ACCEPT [0:0]
: FORWARD ACCEPT [0:0]
: OUTPUT ACCEPT [0:0]
-A input-m state--state established,related-j ACCEPT
-A input-p icmp-j ACCEPT
-A input-i lo-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 22-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT
-A input-j REJECT--reject-with icmp-host-prohibited
-A forward-j REJECT--reject-with icmp-host-prohibited
COMMIT

Firewall restart
# Service iptables Restart
iptables:flushing firewall rules: [OK]
Iptables:setting chains to Policy Accept:filter [OK]
iptables:unloading modules: [OK]
iptables:applying firewall rules: [OK]

After that you can knock #ifconfig on the terminal, find the corresponding IP address of the virtual machine, such as 192.168.0.100, then you can use Mysqlfront or program to connect to the database.

March 25, 2018 14:41

Go: Linux CentOS6.5 yum install MySQL 5.6

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.