在centos7上配置MySQL8.0

在centos7上配置MySQL8.0,mysql,centos7,Mysql,Centos7,首先,在执行命令时 mysql-u root-p 输入密码: 错误2002(HY000):无法通过套接字'/tmp/MySQL.sock'(2)连接到本地MySQL服务器,这将出错 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

首先,在执行命令时
mysql-u root-p
输入密码:
错误2002(HY000):无法通过套接字'/tmp/MySQL.sock'(2)
连接到本地MySQL服务器,这将出错

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
第二,执行命令时

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的默认_文件是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\u-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

我能做什么?

如果您尝试以root用户身份从shell中运行它,您会得到什么
/usr/bin/mysqld--defaults file=/etc/mysql/my.cnf--datadir=/var/lib/mysql/data--socket=/var/run/mysqld/mysqld.sock
?您是否也可以提供
systemctl的输出?启用mysqld
?将bind address=localhost放入my.cnf文件所有订单都以root身份运行,并且启用mysqld。此外,将bind address=localhost放入my.cnf文件不起作用。@将
/var/log/messages
/var/log/mysqld.log
中显示的内容归零,应该会提供更多详细信息。