Improve the security of MySQL database

Source: Internet
Author: User

1. Change the default port (default 3306)

The scanning of the port scan tool can be prevented to a certain extent

2. Delete the test database

Drop database test;

3. Password change is more complicated

# 1SetPassword forRoot@localhost=Password'Test'); # 2 UseMySQL;Update User SetPassword=Password'Test')where User='Root'; FlushPrivileges;


4. Delete the default User

Use deletefrom delete from user where  Not (host=anduser=Privileges


5. Change the name of the default MySQL administrator

 Use MySQL; Update User Set User = where User =  Privileges


6. Disable remote connection to MySQL
A. Setting the account is not allowed to log in remotely, only on localhost

use update user set = '% ' where  user='admin'; Select User  from User

B. Authorize a specific user to log on from the MySQL
(1) Set the task host, can be based on a user name | password, login to all MySQL services database

Grant  All Privileges  on *. *  to ' MyUser '@ '%' by'mypassword'  Withgrantoptionprivileges;

(2) Set a host for a specific IP, log in to all databases of the MySQL service according to a username | password

Grant  All Privileges  on *. *  to ' MyUser '@'192.168.1.3'by'mypassword'  withgrantoptionprivileges;

(3) Set the host of a specific IP, according to a user name | password, login to the specified database (dk--database name)

Grant  All Privileges  on DK.*to'myuser' @'192.168.1.3' by 'mypassword'withgrantoption   privileges;

Improve the security of your MySQL database

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.