mysql基础命令汇总

  1. 启动:mysql -u root -p
  2. 创建用户:create user test;
  3. 创建密码:update mysql.user set authentication_string=password('testcyTX') where user='test’;
  4. 授权(管理员权限):grant all privileges on *.* to 'test'@'localhost' identified by 'test' with grant option;
  5. 查看用户权限:show grants for ‘test’;
  6. 创建数据库:create database dbname;
  7. 修改数据库编码:alter database dbname character set utf8mb4 collate utf8mb4_general_ci;
  8. 显示编码:show variables where variable_name like 'character\_set\_%' or variable_name like 'collation%’;
  9. 修改表编码:alter table tablename convert to character set utf8mb4 collate utf8mb4_general_ci; 
  10. 显示表结构:describe tablename; 
  11. 显示数据库:show databases;
  12. 显示数据库中表:use dbname; show tables;

你可能感兴趣的:(Mysql)