mysql基础命令(记录)

创建数据库

mysql> create database test DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

创建用户

CREATE USER zabbix@‘localhost’ IDENTIFIED BY ‘Thk~@#8695gHf’;

授权

GRANT SELECT, REPLICATION CLIENT ON . TO zabbix@‘localhost’;

用户查询

select user,host from mysql.user;

权限查询

show grants for ‘user’@‘192.168.1.%’;

slave连接主库

mysql> change master to master_host=‘192.168.4.35’,master_user=‘abo’,master_password=‘123456’,master_log_file=‘mysql-bin.000002’, master_log_pos=191;

导入数据库

mysql> source /root/test.sql

导出数据库

#mysqldump -u 用户名 -p 数据库名 > 导出的文件名

你可能感兴趣的:(mysql)