MySQL5.7命令

登录 mysql -u username -p

创建数据库:create database dbname;

查看所有的库:show databases;

使用某个库:use dbname;

查看库有哪些表:show tables;

查看表的列:describe tablename;

直接登录某个数据库:mysql -h host -u user -p dbname,如:

删库drop database dbname;

跑路

添加用户CREATE USER ‘username’@’host’ IDENTIFIED BY ‘password’;

删除用户DROP USER ‘username’@’host’;

授权grant select,update on dbname.* to ‘username’@’host’ identified by ‘password’;

grant all on dbname.* to ‘username’@’host’ identified by ‘password’;

显示用户信息select user();

显示版本select version();

发表评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注

Captcha Code