RHEL下
1. 安装mariadb
shell> sudo yum install mariadb* -y
2.rpm安装指定版本的mysql
shell> wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-server-8.0.11-1.el7.x86_64.rpm https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-client-8.0.11-1.el7.x86_64.rpm https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-devel-8.0.11-1.el7.x86_64.rpm https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-libs-8.0.11-1.el7.x86_64.rpm https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-common-8.0.11-1.el7.x86_64.rpm
shell> sudo yum install -y wget perl libaio net-tools openssl* numactl
shell> sudo rpm -ivh mysql-community-common-8.0.11-1.el7.x86_64.rpm mysql-community-libs-8.0.11-1.el7.x86_64.rpm mysql-community-client-8.0.11-1.el7.x86_64.rpm mysql-community-server-8.0.11-1.el7.x86_64.rpm
mysql8
shell> systemctl status mysqld
shell> mysqld --initialize --user=mysql
shell> systemctl start mysqld
shell> grep "A temporary password" /var/log/mysqld.log
shell> mysql -uroot -p
mysql> alter user user() identified with mysql_native_password by "123456";
mysql> create user 'messiah'@'%' identified with mysql_native_password by '123456';
mysql> alter user 'root'@'localhost' identified with mysql_native_password by '123456';
mysql> flush privileges;
mysql7-
shell> sudo rpm -ivh mysql-community-common-5.7.16-1.el7.x86_64.rpm mysql-community-libs-5.7.16-1.el7.x86_64.rpm mysql-community-client-5.7.16-1.el7.x86_64.rpm mysql-community-server-5.7.16-1.el7.x86_64.rpm mysql-community-devel-5.7.16-1.el7.x86_64.rpm
shell> cp /usr/share/mysql/my-default.cnf /etc/my.cnf
#shell> /usr/bin/mysql_install_db
# mysql_install_db is deprecated.
shell> mysqld --initialize --user=mysql
shell> systemctl status mysqld
shell> grep "A temporary password" /var/log/mysqld.log
shell> more /root/.mysql_secret
shell> mysql -uroot -p
mysql> set password = password('123456');
4.开启3306端口
shell> firewall-cmd --list-ports
shell> firewall-cmd --add-port=3306/tcp --permanent
shell> firewall-cmd --reload #加载新配置
5.启动/停止/重启/自启/关闭/状态 mysql 服务
shell> systemctl start/restart/stop/enable/disable/status mariadb.service/mysqld
REHL6
shell> service mariadb.service status/start/restart/stop
6.配置mysql
/etc/my.cnf
event_scheduler=ON
7.进入mysql服务器
shell> mysql -uroot
1.创建用户
mysql> create user 'messiah'@'%' identified by '123456';
mysql> grant all on *.* to 'messiah'@'%';
授grant option权限
mysql> grant grant option on *.* to 'messiah'@'%';
mysql> grant all on *.* to 'messiah'@'%' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'messiah'@'%' IDENTIFIED BY PASSWORD '*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9' WITH GRANT OPTION
mysql> update mysql.user set user='anonymous' where user = '';
mysql> flush privileges;
Mysql 竖列显示结果
select * from mysql.user \G
mysql报错which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
SQL_mode设置
mysql> SELECT @@GLOBAL.sql_mode;
mysql> SELECT @@sql_mode;
mysql> SET sql_mode = '';
mysql> SET GLOBAL sql_mode = '';
Mysql 事件计划配置
mysql> SHOW VARIABLES LIKE 'event_scheduler';
mysql> SELECT @@event_scheduler;
mysql> SET GLOBAL event_scheduler = 1;
mysql> SET GLOBAL event_scheduler = ON;
mysql用户权限表
权限 | 说明 |
---|---|
all | |
alter | |
alter routine | 使用alter procedure 和drop procedure |
create | |
create routine | 使用create procedure |
create temporary tables | 使用create temporary table |
create user | |
create view | |
delete | |
drop | |
execute | 使用call和存储过程 |
file | 使用select into outfile 和load data infile |
grant option | 可以使用grant和revoke |
index | 可以使用create index 和drop index |
insert | |
lock tables | 锁表 |
process | 使用show full processlist |
reload | 使用flush |
replication client | 服务器位置访问 |
replocation slave | 由复制从属使用 |
select | |
show databases | |
show view | |
shutdown | 使用mysqladmin shutdown 来关闭mysql |
super | |
update | |
usage | 无访问权限 |
网友评论