我們要注意的Mysql基本安全設定

來源:互聯網
上載者:User

標籤:

1.設定或修改Mysql root密碼:
預設安裝後空密碼,以mysqladmin命令設定密碼:

mysqladmin -uroot password "password"

Mysql命令設定密碼:

mysql> set password for [email protected]=password(‘password);

更改密碼:

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

2.刪除預設的資料庫和使用者

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

3. 更改預設root帳號名稱:

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

4. 本地檔案安全:

set-variable=local-infile=0

5. 禁止遠端連線mysql,遠端管理可通過phpmyadmin,編輯my.cnf在[mysqld]添加:

skip-networking

6.最小許可權使用者:

create database db1;grant select,insert,update,delete,create,drop privileges on database.* to [email protected] identified by ‘passwd‘;

7. 限制普通使用者瀏覽其它資料庫,編輯my.cnf在[mysqld]添加:

--skip-show-database

8.快速修複MySQL資料庫
修複資料庫

mysqlcheck -A -o -r -p

修複指定的資料庫

mysqlcheck  -o -r database -p

9.跟據記憶體的大小選擇MySQL的設定檔:

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

我們要注意的Mysql基本安全設定

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.