修改root密碼
SET PASSWORD FOR 'root'@'localhost' =PASSWORD('newpass');
建立資料庫:
create database cacti;
新增客戶并賦予權限
grant all on cacti.* to cacti@localhostidentified by “cacti”;
重新整理權限
flush privileges;
導入資料
mysql –uroot –p cacti <c:\apache\htdocs\cacti\cacti.sql
檢視MySQL下使用者
select * from mysql.user
更新的MYSQL.USER表的所有字段中為N的為Y就可以了。
>use mysql
>update user set Update_priv ='Y' whereuser = 'root';
檢視臨時表
show variables like "%tmp%";
設定全局臨時表大小
setglobal tmp_table_size=33554432;
修改MySQL遠端連接配接權限
grant all privileges on *.* to 'root'@'%'identified by "123" with grant option;
顯示目前使用者權限
show grants for root@'localhost';
備份資料庫
mysqldump -uroot -p --database
慢查詢日志分析
開啟慢查詢
1
<code><br></code>
log-slow-queries=/var/log/mysqld-slow.log
long_query_time=2
//dbquery-slow
query_time 查詢時間
lock_time 鎖表時間
rows_send 查詢傳回行數
rows_examind 所有查詢的行數
timestamp 時間戳
檢視目前資料庫的表空間管理類型
show variables like"innodb_file_per_table";
innodb_file_per_table=1 為使用獨占表空間
innodb_file_per_table=0 為使用共享表空間
ON代表獨立表空間管理,OFF代表共享表空間管理;
本文轉自 Barron1 51CTO部落格,原文連結:http://blog.51cto.com/13172370/1972362,如需轉載請自行聯系原作者