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:

  1. datadir=/var/lib/mysql
  2.  
    socket=/var/lib/mysql/mysql.sock
  3.  
    server_id = 1
  4.  
    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的主要内容,如果未能解决你的问题,请参考以下文章

MysqlCentos7.4下源码安装mysql-5.7.21

CentOS 6.5下安装Confluence 5.4

CentOS 7 yum安装MySQL

CentOS8 Yum安装MySQL

Centos7安装Mysql九条命令搞定

Centos7安装Mysql九条命令搞定