2019-05-14 MySQL通过dos命令操作数据库

use mysql;

-- 查询数据库
show databases;
-- 显示表
show TABLES;
-- 修改用户密码
alter user 'test'@'%' identified with mysql_native_password by 'Test12345678@';
update user set password=password("123") where user="test";
update mysql.user set password='123' where user='test';

-- 查询主机 用户名 密码 命名方式
select host,user,password,authentication_string from user;
-- 查询 数据库下的表
select table_name from information_schema.tables where table_schema='taotao';
-- 查询指定数据库中指定表的所有字段名column_name
select column_name from information_schema.columns where table_schema='taotao' and table_name='tb_content';
-- 查询表内容
select * from taotao.tb_content

CREATE USER 'username'@'%' IDENTIFIED BY 'password';
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
update user set host='%' where user = 'username';
update user set host='%' where user = 'username';
-- 给用户授权限
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;
-- 刷新配置
flush privileges;

猜你喜欢

转载自www.cnblogs.com/wbly2019/p/10863636.html
今日推荐