CentOS mysql常用命令

使用root管理员登录MySQL:mysql -u root -p

保存数据修改:flush privileges;

启动MySQL:service mysqld start

停止MySQL:service mysqld stop

重启MySQL:service mysqld restart

开机自启MySQL:chkconfig mysqld on

关闭开机自启MySQL:chkconfig --level 345 mysqld off

创建abc数据库:create database abc;

显示所有数据库:show databases;

切换数据库:use root;      #切换到root数据库

删除数据库:drop database 数据库名     #默认数据库(test)

查看表:show tables;

查看表结构:describe user;

更改默认mysql管理员用户为admin

update mysql.user set user = "admin" where user = "root";

查看当前策略

SHOW VARIABLES LIKE 'validate_password%';

修改密码策略

set global validate_password_policy=0;

set global validate_password_mixed_case_count=0;

set global validate_password_special_char_count=0;

set global validate_password_length=6;

授权

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

FLUSH   PRIVILEGES;

你可能感兴趣的:(Linux,mysql,centos,数据库)