登录 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();