centos 7.5 安装mysql 5.7.32 中自定义data的目录

Posted 健康平安的活着

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos 7.5 安装mysql 5.7.32 中自定义data的目录相关的知识,希望对你有一定的参考价值。

一  话补多少,上代码

这里存储mysql的数据目录设定为:/dky-mysql-data/data   确保这个全路径为mysql:mysql的用户和用户组。

1.执行完初始化后:没有信息输出

[root@localhost bin]# ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql-5.7.32 --datadir=/dky-mysql-data/data
[root@localhost bin]# 

2.这里需要进入配置的log日志中查看

[root@localhost bin]# cd ..
[root@localhost mysql-5.7.32]# ls
bin  docs  include  lib  LICENSE  logs  man  mysqlid.id  README  share  support-files
[root@localhost mysql-5.7.32]# cd logs
[root@localhost logs]# ls
mysql-log.err

[root@localhost logs]# more mysql-log.err 
2022-08-17T16:20:09.194488Z 0 [Warning] InnoDB: New log files created, LSN=45790
2022-08-17T16:20:09.321040Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2022-08-17T16:20:09.385549Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 768e167d-1e
48-11ed-8034-000c29e6d1f9.
2022-08-17T16:20:09.387375Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2022-08-17T16:20:10.276995Z 0 [Warning] CA certificate ca.pem is self signed.
2022-08-17T16:20:10.617879Z 1 [Note] A temporary password is generated for root@localhost: lJr?4lm!0;xs

标记为红色的部分,为系统设置的初始密码。

3.启动mysql服务,如下:
[root@localhost logs]# service mysql start
Starting MySQL. SUCCESS! 

[root@localhost logs]# ps -ef|grep mysql
root       3781      1  0 00:22 pts/0    00:00:00 /bin/sh /usr/local/mysql-5.7.32/bin/mysqld_safe --datadir=/dky-mysql-data/data --pid-file=/usr/local/mysql-5.7.32/mysqlpid.pid
mysql      3981   3781 10 00:22 pts/0    00:00:00 /usr/local/mysql-5.7.32/bin/mysqld --basedir=/usr/local/mysql-5.7.32 --datadir=/dky-mysql-data/data --plugin-dir=/usr/local/mysql-5.7.32/lib/plugin --user=mysql --log-error=/usr/local/mysql-5.7.32/logs/mysql-log.err --pid-file=/usr/local/mysql-5.7.32/mysqlpid.pid --port=3306
root       4017   2620  0 00:22 pts/0    00:00:00 grep --color=auto mysql
 

以上是关于centos 7.5 安装mysql 5.7.32 中自定义data的目录的主要内容,如果未能解决你的问题,请参考以下文章

CentOS-7.5 安装 社区版 MySQL-5.7

腾讯云CentOS 7.5安装MySQL

阿里云Centos 7.5 安装MySQL8

在CentOS Linux 7.5上安装MySQL

CentOS-7.5 搭建 MySQL 主从复制

centos 7.5 安装mysql