mysql基础命令汇总
- 启动:mysql -u root -p
- 创建用户:create user test;
- 创建密码:update mysql.user set authentication_string=password(‘testcyTX’) where user=’test’;
- 授权(管理员权限):grant all privileges on *.* to ‘test’@’localhost’ identified by ‘test’ with grant option;
- 查看用户权限:show grants for ‘test’;
- 创建数据库:create database dbname;
- 修改数据库编码:alter database dbname character set utf8mb4 collate utf8mb4_general_ci;
- 显示编码:show variables where variable_name like ‘character\_set\_%’ or variable_name like ‘collation%’;
- 修改表编码:alter table tablename convert to character set utf8mb4 collate utf8mb4_general_ci;
- 显示表结构:describe tablename;
- 显示数据库:show databases;
- 显示数据库中表:use dbname; show tables;
还没有评论,来说两句吧...