CREATE USER 'username'@'host' IDENTIFIED BY 'password';mysql
好比sql
create user 'test_user'@'%' identified by 'test';ide
ps:若是隻容許本機登陸則host=localhost,若是容許從任意遠程主機登錄則host=%spa
修改密碼ssl
SET PASSWORD FOR 'username'@'host' = PASSWORD('newpassword');table
GRANT privileges ON dbname.tablename TO 'username'@'host'test
好比登錄
GRANT ALL ON test_db.* TO 'test_user'@'%';權限
撤銷權限密碼
REVOKE privilege ON dbname.tablename FROM 'username'@'host';
show grants for test_user;
$ mysqldump -u dbuser -p dbname [tablename1] [tablename2] > dump.sql
ps:tablename可選
若是想導出全部database,dataname處傳 --all-databases
mysql>source /path/dump.sql
或者
$ mysql -uusername -p dbname < dump.sql
mysql>show processlist;
mysql>show variables;
mysql> alter database $database_name character set utf8;mysql> alter table $table_name default character set utf8;mysql> alter table $table_name change $column_name $column_name varchar(50) character utf8;