Basic Mysql security settings in CentOS

Source: Internet
Author: User

Basic Mysql security settings in CentOS

1. Set or modify the Mysql root Password:
By default, the password is blank after installation. Use the mysqladmin command to set the password:

mysqladmin -uroot password "password"

Mysql command to set the password:

mysql> set password for root@localhost=password('password);

Change Password:

update mysql.user set password=password('password') where user='root';flush privileges;

2. delete default databases and users

drop database test;use mysql;delete from db;delete from user where not(host="localhost" and user="root");flush privileges;

3. Change the default root Account name:

update mysql.user set user="admin" where user="root";flush privileges;

4. Local file security:

set-variable=local-infile=0

5. remote connection to mysql is prohibited. For remote management, use phpmyadmin to edit my. cnf and add it in [mysqld:

skip-networking

6. Minimum permission User:

create database db1;grant select,insert,update,delete,create,drop privileges on database.* to user@localhost identified by 'passwd';

7. Restrict normal users to browse other databases. edit my. cnf and add it in [mysqld:

--skip-show-database

8. quickly fix MySQL Databases
Restore database

mysqlcheck -A -o -r -p

Fix a specified database

mysqlcheck  -o -r database -p

9. Select the MySQL configuration file based on the memory size:

my-small.cnf # > my-medium.cnf # 32M - 64Mmy-large.cnf # memory = 512Mmy-huge.cnf # 1G-2Gmy-innodb-heavy-4G.cnf # 4GB

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.