###########################################
一、安装yum源
下载地址:https://dev.mysql.com/downloads/repo/yum/
rpm -ivh mysql80-community-release-el7-7.noarch.rpm
二、安装mysql-server
yum -y install mysql-server
三、修改用户root@'localhost'的密码
在mysql的错误日志/var/log/mysqld.log中找到用户root@'localhost'的初始密码
[root@gip180 log]# pwd /var/log [root@gip180 log]# cat mysqld.log 2023-06-06T02:09:14.313010Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.33) initializing of server in progress as process 2646323 2023-06-06T02:09:14.350581Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2023-06-06T02:09:14.967406Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2023-06-06T02:09:16.923472Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: !s%9e<AysjX1 2023-06-06T02:09:22.106247Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.33) starting as process 2646387 2023-06-06T02:09:22.141313Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2023-06-06T02:09:22.734809Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2023-06-06T02:09:23.946163Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2023-06-06T02:09:23.946278Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2023-06-06T02:09:23.983057Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.33' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server - GPL. 2023-06-06T02:09:23.982983Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
即该处的用户root@'localhost'的初始密码为:
!s%9e<AysjX1
mysql -uroot -p
在输入密码即可登录
然后再更改密码:
alter user root@'localhost' identified by '123456a*A';
创建新用户:
create user root@'%' identified with mysql_native_password by '123456a*A'; grant all privileges on *.* to root@'%' with grant option;
默认目录规划:
datadir /var/lib/mysql/ log_error /var/log/mysqld.log slow_query_log_file: /var/lib/mysql/hostname-slow.log general_log_file /var/lib/mysql/gip180.log relay_log_basename /var/lib/mysql/hostname-relay-bin log_bin_basename /var/lib/mysql/binlog
###########################
标签:log,root,MySQL,yum,mysql,var,mysqld,安装,localhost From: https://www.cnblogs.com/igoodful/p/17459850.html