首页 > 解决方案 > centos7上配置MySQL8.0

问题描述

首先,在执行订单时 mysql -u root -p Enter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2),它会出错。

二、执行订单时

systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/etc/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since 三 2019-10-30 01:29:29 CST; 20min ago
  Process: 30824 ExecStart=/usr/bin/mysqld --defaults-file=/etc/mysql/my.cnf --datadir=/var/lib/mysql/data --socket=/var/run/mysqld/mysqld.sock User=mysql (code=exited, status=203/EXEC)
 Main PID: 30824 (code=exited, status=203/EXEC)

10月 30 01:29:29 VM_0_6_centos systemd[1]: Started MySQL Server.
10月 30 01:29:29 VM_0_6_centos systemd[1]: Starting MySQL Server...
10月 30 01:29:29 VM_0_6_centos systemd[1]: mysqld.service: main process exited, code=exited, status=203/EXEC
10月 30 01:29:29 VM_0_6_centos systemd[1]: Unit mysqld.service entered failed state.
10月 30 01:29:29 VM_0_6_centos systemd[1]: mysqld.service failed.

三、mysql的default_file是my.cnf:

  1 # For advice on how to change settings please see
  2 # http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html
  3
  4 [mysqld]
  5 #
  6 # Remove leading # and set to the amount of RAM for the most important data
  7 # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
  8 # innodb_buffer_pool_size = 128M
  9 #
 10 # Remove the leading "# " to disable binary logging
 11 # Binary logging captures changes between backups and is enabled by
 12 # default. It's default setting is log_bin=binlog
 13 # disable_log_bin
 14 #
 15 # Remove leading # to set options mainly useful for reporting servers.
 16 # The server defaults are faster for transactions and fast SELECTs.
 17 # Adjust sizes as needed, experiment to find the optimal values.
 18 # join_buffer_size = 128M
 19 # sort_buffer_size = 2M
 20 # read_rnd_buffer_size = 2M
 21 #
 22 # Remove leading # to revert to previous value for default_authentication_plugin,
 23 # this will increase compatibility with older clients. For background, see:
 24 # https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentic    ation_plugin
 25 # default-authentication-plugin=mysql_native_password
 26
 27 datadir=/var/lib/mysql
 28 socket=/var/lib/mysql/mysql.sock
 29
 30 log-error=/var/log/mysqld.log
 31 pid-file=/var/run/mysqld/mysqld.pid
 32
 33 [mysql]
 34
 35 socket=/var/lib/mysql/mysql.sock
 36 [client]
 37 socket=/tmp/mysql.sock

四、我的机器里找不到mysql.sock、mysql.server和mysql_safe。安装mysql-server后还是出错。

yum install mysql-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Package mysql-community-server-8.0.18-1.el7.x86_64 already installed and latest version
Nothing to do
[root@VM_0_6_centos /root]# find ./* -name mysql.server

我能做些什么?

标签: mysqlcentos7

解决方案


推荐阅读