yum安装
1.下载
// rpm地址https://dev.mysql.com/downloads/file/?id=484922
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum update
yum install mysql-server
权限设置:
chown mysql:mysql -R /var/lib/mysql
chown -R mysql:mysql /var/lib/mysql/ 如果1失败使用这个修改权限
初始化 MySQL:
mysqld --initialize
启动 MySQL:
systemctl start mysqld.
查看 MySQL 运行状态:
systemctl status mysqld
systemctl start mariadb #启动MariaDB
systemctl stop mariadb #停止MariaDB
systemctl restart mariadb #重启MariaDB
systemctl enable mariadb #设置开机启动
查看mysql默认密码
tail /var/log/mysqld.log
重置当前登陆用户的密码
ALTER USER USER()IDENTIFIED BY 'LLLl123.';
允许root用户从任意地址登陆
update user set host = '%' where user = 'root';
给用户aaa授权,让aaa能给所有库所有表实行所有的权力
RANT ALL ON . TO 'aaa'@'%';
使配置生效
FLUSH PRIVILEGES;