centos7配置mysql8

linux系统服务命令:

systemctl start mysqld
systemctl stop mysqld
systemctl stop firewalld.service
systemctl status firewalld.service

修改mysql8安装时设置的一个非常长的密码:

mysql -u root -p
use mysql;
SHOW VARIABLES LIKE 'validate_password.%';
set global validate_password.policy=0;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; 

添加用户,分配权限:

CREATE DATABASE dbtest;
CREATE DATABASE dbtest CHARACTER SET utf8 COLLATE utf8_general_ci;

CREATE USER 'user'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON dbtest.* TO 'user'@'%' WITH GRANT OPTION;
grant all privileges on dbtest.* to 'user'@'localhost' identified by 'password'   with grant option;
grant all privileges on dbtest.* to 'user'@'1' identified by 'password'   with grant option;

set password for 'user'@'%' password('password'); 
update user set password=password('password') where user='user' and host='%';

show grants;
show grants for 'user'@'%';
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user;
revoke delete on *.* from  'user'@'%';
flush privileges;

更改mysql默认数据目录:

select @@datadir;
rsync -av /var/lib/mysql /mnt/volume-nyc1-01
mv /var/lib/mysql /var/lib/mysql.bak

/etc/my.cnf
datadir=/mnt/volume-nyc1-01/mysql
socket=/mnt/volume-nyc1-01/mysql/mysql.sock
[client]
port=3306
socket=/mnt/volume-nyc1-01/mysql/mysql.sock

关闭selinux:

getenforce
setenforce 0

centos7开机自启动

systemctl enable mysqld
systemctl list-unit-files | grep mysql

centos7以前开机自启动

chkconfig --list httpd
chkconfig --level 2345 httpd on
chkconfig httpd off
service httpd status

centos回滚升级(centos Downgrade or Rollback Updates)

sudo yum history
sudo yum history list
sudo yum history info
sudo yum history undo 11

相关链接:
https://dev.mysql.com/doc/refman/8.0/en/validate-password-options-variables.html
https://www.itzgeek.com/how-tos/linux/centos-how-tos/how-to-install-mysql-5-78-0-on-centos-76-rhel-76-fedora-272625.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值