1. 程式人生 > >2019-05-14 MySQL通過dos命令操作數據庫

2019-05-14 MySQL通過dos命令操作數據庫

reat update 字段名 schema con 用戶 ont 數據 配置

use mysql;

-- 查詢數據庫
show databases;
-- 顯示表
show TABLES;
-- 修改用戶密碼
alter user ‘test‘@‘%‘ identified with mysql_native_password by ‘[email protected]‘;
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;

2019-05-14 MySQL通過dos命令操作數據庫