- 我下载并解压了 MySQL 通用二进制最低版本在/usr/本地/mysql。
- 我创建mysql我的系统中的组
- 我将当前用户添加到mysql团体。
我执行了:
sudo chown -R user:mysql /usr/local/mysql sudo chmod -R 750 /usr/local/mysql
我补充道在/usr/本地/mysql/bin中文件夹/etc/配置文件
- 重啟系統。
- 我用 初始化数据库
mysqld --defaults-file=/usr/local/mysql/my.cnf --initialize
。初始化成功。 - 为了安装 mysql 服务,我复制了mysql.服务器服务文件/etc/init.d“文件夹为mysql并执行
update-rc.d mysql defaults
。
但当我重新启动系统时,mysql服务中断了。所以我尝试运行mysql.服务器使用命令从基础目录复制服务文件mysql.server start
并成功执行。
问题是什么?我在这里遗漏了什么?
my.cnf 配置文件:
[mysql]
port = 3306
[mysqld]
port = 3306
bind-address = 127.0.0.1
basedir = /usr/local/mysql
datadir = /usr/local/mysql/mysqld/data
plugin-dir = /usr/local/mysql/lib/plugin
pid-file = /usr/local/mysql/mysqld/mysqld.pid
log-error = /usr/local/mysql/mysqld/mysqld.err
Systemd 日志:
Aug 31 12:08:12 inspiron systemd[1]: Starting LSB: start and stop MySQL...
Aug 31 20:58:34 inspiron mysql[6941]: Starting MySQL
Aug 31 20:58:34 inspiron mysql[6941]: /usr/local/mysql/mysqld/mysqld.pid
Aug 31 20:58:34 inspiron mysql[6941]: .2019-08-31T16:28:34.274179Z mysqld_safe error: log-error set to '/usr/local/mysql/mysqld/mysqld.err', however file don't exists. Create writable for user 'mysql'.
Aug 31 20:58:35 inspiron mysql[6941]: * The server quit without updating PID file (/usr/local/mysql/mysqld/mysqld.pid).
Aug 31 20:58:35 inspiron systemd[1]: mysql.service: Control process exited, code=exited status=1
Aug 31 20:58:35 inspiron systemd[1]: mysql.service: Failed with result 'exit-code'.
Aug 31 20:58:35 inspiron systemd[1]: Failed to start LSB: start and stop MySQL.
操作系统:Elementary OS(基于 Ubuntu)
内核:4.15.0-58-generic
Init 系统:systemd
MySQL:8.0.17