Mysql 常用命令

Mysql 修改编码

在/usr/my.cnf 中加上character_set_server=utf8

 

停止mysql

mysqld_safe --skip-grant-tables& 

mysql

 

 

添加用户

create user test;

添加数据库

create database test [编码];

修改mysql 用户 密码

 update  mysql.user set Password=PASSWORD("Aa031729") where User='root';

 

ERROR 1820 (HY000): You must SET PASSWORD before executing this statement

可使用SET PASSWORD命令修改root用户的密码,参考如下:

mysql> SET PASSWORD = PASSWORD('root123456');

 

 

分配权限

grant all privileges on hahaDB.* to haha@localhost identified by ‘hahapwd’;

flush privileges;

你可能感兴趣的:(mysql)