MySQL Notes

来源:互联网 发布:小蜜蜂写作素材软件 编辑:程序博客网 时间:2024/05/21 09:44

给健忘的某懒人创建一个不常用命令的备忘:

1. 创建用户

create user 'username'@'localhost' identified by 'password';
grant all on dbname.* to 'username'@'localhost';
set password for 'root'@'localhost' = password('foobar');


2. 查看用户权限

select user, host, db, select_priv, insert_priv, grant_priv from mysql.db;


3. 更改auto_commit以改善性能

set autocommit = 0;


4. 查看更改后的全局变量

show variables like '%autocommit%';


5. 查看数据库所有表的记录数

use information_schema;

select table_name,table_rows from tables
where TABLE_SCHEMA = 'testdb'
order by table_rows desc;

0 0
原创粉丝点击