LAMP security reinforcement & #65279; mysql (1)

Source: Internet
Author: User

 

Figure-LAMP

When using LAMP,LAMP SecurityI am worried about the problem, but the problem has been introduced in the previous two articles. Now I will introduce the last one of LAMP security: mysql.

MysqlAspect:

1. Modify the root user password and delete the empty password.

By default, the root user of the installed MySQL instance has a blank password. For security reasons, it must be changed to a strong password. The so-called strong password should be at least 8 characters long, an irregular password consisting of letters, numbers, and symbols. Use the MySQL Command mysaladmin to change the root password. You can also log on to the database and modify the field content of the user table under mysql. The modification method is as follows:

#/Usr/local/mysql/bin/mysqladmin-u root password "upassword" // use mysqladmin

# Mysql> use mysql;

# Mysql> update user set password = password ('upassword') where user = 'root ';

# Mysql> flush privileges; // force refresh the memory authorization table. Otherwise, the password is still cached in the memory.

2. delete default databases and database users

Generally, the MySQL database is installed locally and only needs a local php script to read mysql. Therefore, many users do not need it, especially those installed by default. After MySQL initialization, empty users and test libraries are automatically generated for installation testing. This poses a threat to the security of the database. It is necessary to delete all of them. The final state is only one root, add users and databases as needed.

# Mysql> show databases;

# Mysql> drop database test; // Delete the database test

# Use mysql;

# Delete from db; // delete the table information that stores the database because there is no database information.

# Mysql> delete from user where not (user = 'root'); // delete an initial non-


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.