Mysql_secure_installation Secure installation (for production environment settings)

Source: Internet
Author: User

Compile and install mysql5.6, if used in the production environment, it is best to perform mysql_secure_installation to do some general security settings.

Need to add ~mysql/bin to environment variables in advance

/apps/mysql//bin/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):

Prompt for password, no password to enter directly

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]

Prompt to set root user password Y

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]

Production environment recommended to delete anonymous user created by system Y

... 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]

Disable root user telnet to Y

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]

Delete Test Database Y

-Dropping test database ...

... success!

-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]

Overloaded Permissions Table Y

... 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 ...

Complete ~ ~ ~

Empty password cannot be logged on after completion

# MySQL
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)

Mysql> select User,host from Mysql.user;
+-------+-----------+
| user | Host |
+-------+-----------+
| Root | 127.0.0.1 |
| Root | :: 1 |
| Root | localhost |
+-------+-----------+
4 rows in Set (0.01 sec)

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| Information_schema |
| MySQL |
| Performance_schema |
+--------------------+
3 Rows in Set (0.00 sec)

Mysql_secure_installation Secure installation (for production environment settings)

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.