mysql的增删改查及复制与修改密码

mysql的增删改查及复制与修改密码

创建数据库

create database name;

删除数据库

drop database name:

使用数据库
use wg(数据库名)

创建数据库中的表
create table stu (xingming char(10));

查看表结构
desc  stu;

查看表内容
select* from stu
 

数据库的复制

数据库密码的修改

create user 'jack'@'localhost' identified by '123';

更改密码

set password for 'tom'@'localhost' = password( '123' );

update mysql.user set password=password( '123' ) where user='tom' and host='localhost';

更改mysql的root用户密码

vim /etc/my.cnf

skip-grant-tables (跳过权限表)

systemctl restart mysql 

使用root用户,空密码登录mysql

update mysql.user set password=password( '123' ) where user='tom' and host='localhost';

mysql -uroot-p123

增加用户权限

grant insert,select on *.* to 'tom'@'localhost';

grant insert,select on bw.wg to 'tom'@'localhost';

删除用户权限

revoke all on *.* from 'tom'@'localhost';

猜你喜欢

转载自blog.csdn.net/youchaoXu/article/details/111825329