centos安装mysql
Posted fight139
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos安装mysql相关的知识,希望对你有一定的参考价值。
cd /usr/local/src/
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
yum -y install mysql-server
默认配置文件路径:
配置文件:/etc/my.cnf
日志文件:/var/log/var/log/mysqld.log
服务启动脚本:/usr/lib/systemd/system/mysqld.service
socket文件:/var/run/mysqld/mysqld.pid
my.cnf:
-
datadir=/var/lib/mysql
-
socket=/var/lib/mysql/mysql.sock
-
server_id = 1
-
expire_logs_days = 3
启动mysql服务
service mysqld restart
查看当前密码:
grep "password" /var/log/mysqld.log
重置密码:
<<mysql<< alter user ‘root‘@‘localhost‘ identified by ‘Root!!2018‘;
远程连接:
use mysql
grant all privileges on *.* to [email protected]‘%‘ identified by "password";
flush privileges;
以上是关于centos安装mysql的主要内容,如果未能解决你的问题,请参考以下文章