CENTOS7 Environment MySQL Installation simple method

Source: Internet
Author: User

CENTOS7 environment MySQL5.6 on-line installation method
Note: First make sure that CentOS is networked, then log in to CentOS using the root account, and install it in five steps below.

The first step is to download the MySQL corresponding project package online using the RPM tool
# RPM-UVH http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Get http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
In preparation ... ################################# [100%]
Upgrading/installing ...
1:mysql-community-release-el7-5 ################################# [100%]

The second step is to install the MySQL client and server
Generally, just install Mysql-server and mysql-client
**# yum-y Install Mysql-community-server
This time according to the speed of personal network, will download the corresponding project packages for automatic installation, need a period of time, installation ends the following information:

* As dependencies are installed:
mysql-community-client.x8664 0:5.6.28-2.el7 mysql-community-common.x8664 0:5.6.28-2.el7
perl-compress-raw-bzip2.x8664 0:2.061-3.el7 perl-compress-raw-zlib.x8664 1:2.061-4.el7
perl-dbi.x8664 0:1.627-4.el7 Perl-io-compress.noarch 0:2.061-2.el7
Perl-net-daemon.noarch 0:0.48-5.el7 Perl-plrpc.noarch 0:0.2020-14.el7

Alternative:
mariadb-libs.x8664 1:5.5.40-1.el70 *

Complete!
* * Step three, set boot start

Systemctl Enable Mysqld

Start the MySQL service process

Systemctl Start mysqld

Fourth, set the password
Reset Password

Mysql_secure_installation

Note:running all PARTS of this SCRIPT are RECOMMENDED for all MySQL
SERVERS in PRODUCTION use! Please READ each STEP carefully!

In order to log into MySQL to secure it, we'll need the current
Password for the root user. If you ' ve just installed MySQL, and
You haven ' t set the root password yet, the password would be blank,
So, should just press ENTER here.

Enter current password to root (enter for none):
OK, successfully used password, moving on ...

Setting The root password ensures that nobody can log into the MySQL
Root user without the proper authorisation.

Set root Password? [y/n] Y [set root user password]
New Password:
Re-enter new password:
Password Updated successfully!
Reloading privilege tables.
... success!

By default, a MySQL installation have an anonymous user, allowing anyone
To log into MySQL without has to has a user account created for
them. This was intended only for testing, and the installation
Go a bit smoother. You should remove them before moving into a
Production environment.

Remove anonymous users? [y/n] Y [delete anonymous user]
... success!

Normally, Root should only is allowed to connect from ' localhost '. This
Ensures that someone cannot guess at the root of password from the network.

Disallow Root login remotely? [y/n] n [Disable root login]
... skipping.

By default, MySQL comes with a database named ' test ' that anyone can
Access. This was also intended only for testing, and should be removed
Before moving into a production environment.

Remove test database and access to it? [y/n] Y [delete test database]

    • Dropping test database ...
      ERROR 1008 (HY000) at line 1:can ' t drop database ' test '; Database doesn ' t exist
      ... failed! Not critical, keep moving ...
    • Removing privileges on test database ...
      ... success!

Reloading the privilege tables would ensure that all changes made so far
would take effect immediately.

Reload privilege tables now? [y/n] Y [UPDATE permissions]
... success!

All done! If you've completed all of the above steps, your MySQL
Installation should now is secure.

Thanks for using mysql!

Cleaning up ...

Fifth, verify login with new password settings
Log in with the new password and modify the MySQL table to support non-native connections:
[Email protected] ~]# mysql-u root–p123456
mysql> use MySQL
Reading table information for completion of table and column names
Can turn off this feature to get a quicker startup with-a
Database changed
Mysql> Select Host, user from user;
+-----------+-----------+
| Host | user |
+-----------+-----------+
| localhost | Mysql.sys |
| localhost | Root |
+-----------+-----------+
2 rows in Set (0.00 sec)

mysql> Update user Set host = '% ' where user = ' root ';
Query OK, 1 row Affected (0.00 sec)
Rows matched:1 changed:1 warnings:0

Mysql> Select Host, user from user;
+-----------+-----------+
| Host | user |
+-----------+-----------+
| % | Root |
| localhost | Mysql.sys |
+-----------+-----------+
2 rows in Set (0.00 sec)

mysql> flush Privileges; ------Refresh takes effect
Query OK, 0 rows Affected (0.00 sec)
Mysql>

CENTOS7 Environment MySQL Installation simple method

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.