MySQL 启动失败:Can‘t connect to local MySQL server through socket ‘/usr/local/mysql/data/mysql.sock‘

这篇具有很好参考价值的文章主要介绍了MySQL 启动失败:Can‘t connect to local MySQL server through socket ‘/usr/local/mysql/data/mysql.sock‘。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

CentOS7 使用源码安装完 MySQL8.0.31 后,出现启动失败问题!!!

 问题说明:

  mysql 安装完成后,一般可使用如下命令启动 mysql;

bin/mysqld_safe --user=mysql &

  正常情况下输入启动命令后,再输入如下命令及初始密码,即可进入mysql;

bin/mysql -uroot -p   #执行该命令后出入初始密码,进入mysql

  但是今天我在执行 mysql 启动命令后,出现如下提示:

2023-07-31T08:17:42.131276Z mysqld_safe mysqld from pid file /usr/local/mysql/data/mysqld.pid ended

说明:上述意思大概是说,mysql 服务已停止;所以后面即使再输入:bin/mysql -uroot -p初始密码也无法进入 mysql ,且会提示如下错误!

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/usr/local/mysql/data/mysql.sock'

 于是乎!!!

我查看了 MySQL 安装目录下的 mysqld.log (我的目录为:/usr/local/mysql/data/)日志,日志内容如下:

2023-07-31T08:06:55.802016Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2023-07-31T08:06:55.802126Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.31) initializing of serv in progress as process 20348
2023-07-31T08:06:55.810198Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-07-31T08:06:56.695475Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-07-31T08:06:58.639754Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: >alonj%-Z4j*
[root@vm10-0-0-236 data]# cat mysqld.log 
2023-07-31T08:06:55.802016Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2023-07-31T08:06:55.802126Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.31) initializing of serv in progress as process 20348
2023-07-31T08:06:55.810198Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-07-31T08:06:56.695475Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-07-31T08:06:58.639754Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: >alonj%-Z4j*
2023-07-31T08:07:23.268585Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2023-07-31T08:07:23.268698Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.31) starting as process 584
2023-07-31T08:07:23.276568Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-07-31T08:07:23.343831Z 1 [ERROR] [MY-012562] [InnoDB] We scanned the log up to 19325952. A checkpoint was at 19325996 a the maximum LSN on a database page was 0. It is possible that the database is now corrupt!
2023-07-31T08:07:23.343866Z 1 [Warning] [MY-013412] [InnoDB] The last block of redo had corrupted first_rec_group and becameixed (0 -> 44).
2023-07-31T08:07:23.536217Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-07-31T08:07:24.624559Z 0 [ERROR] [MY-011292] [Server] Plugin mysqlx reported: 'Preparation of I/O interfaces failed, X otocol won't be accessible'
2023-07-31T08:07:24.624590Z 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of bind-address: '*' port: 33060 fled, `bind()` failed with error: Address already in use (98). Do you already have another mysqld server running with Mysqlx 
2023-07-31T08:07:24.624597Z 0 [ERROR] [MY-013597] [Server] Plugin mysqlx reported: 'Value '*' set to `Mysqlx_bind_address`, Plugin can't bind to it. Skipping this value.'
2023-07-31T08:07:24.624606Z 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of socket: '/tmp/mysqlx.sock' fail, another process with PID 20155 is using UNIX socket file'
2023-07-31T08:07:24.771731Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-07-31T08:07:24.771770Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connectis are now supported for this channel.
2023-07-31T08:07:24.771954Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Address already in use
2023-07-31T08:07:24.771961Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3307 ?
2023-07-31T08:07:24.771972Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-07-31T08:07:25.802572Z 0 [System] [MY-010910] [Server] /usr/local/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.31)  urce distribution.
2023-07-31T08:07:47.681777Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2023-07-31T08:07:47.681887Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.31) starting as process 816
2023-07-31T08:07:47.688141Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-07-31T08:07:47.847692Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-07-31T08:07:48.938404Z 0 [ERROR] [MY-011292] [Server] Plugin mysqlx reported: 'Preparation of I/O interfaces failed, X otocol won't be accessible'
2023-07-31T08:07:48.938441Z 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of bind-address: '*' port: 33060 fled, `bind()` failed with error: Address already in use (98). Do you already have another mysqld server running with Mysqlx 
2023-07-31T08:07:48.938453Z 0 [ERROR] [MY-013597] [Server] Plugin mysqlx reported: 'Value '*' set to `Mysqlx_bind_address`, Plugin can't bind to it. Skipping this value.'
2023-07-31T08:07:48.938471Z 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of socket: '/tmp/mysqlx.sock' fail, another process with PID 20155 is using UNIX socket file'
2023-07-31T08:07:49.039721Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-07-31T08:07:49.039752Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connectis are now supported for this channel.
2023-07-31T08:07:49.039916Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Address already in use
2023-07-31T08:07:49.039923Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3307 ?
2023-07-31T08:07:49.039935Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-07-31T08:07:50.108334Z 0 [System] [MY-010910] [Server] /usr/local/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.31)  urce distribution.

 其中有一行内容如下:

2023-07-31T08:07:49.039923Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3307 ?

说明:该行大概意思是说,目前的端口已被占用(我在配置用指定端口号为:3307;不指定时,默认为:3306);

 解决方案:

 找到端口号对应的进程 id ,杀死该进程,释放端口号即可!

执行如下命令( 3307 为我的 mysql 端口号),查看端口号对应的进程 id;

lsof -i:3307

执行结果如下所示: 

can't connect to local mysql server through socket '/usr/local/mysql/data/my,MySQL,CentOS,mysql,数据库

执行如下命令杀死该进程: 

kill -9 20155

 can't connect to local mysql server through socket '/usr/local/mysql/data/my,MySQL,CentOS,mysql,数据库

 释放被占用的端口号,前面所述问题也将随之解决!!!

问题解决后 MySQL 启动结果:

can't connect to local mysql server through socket '/usr/local/mysql/data/my,MySQL,CentOS,mysql,数据库

 文章来源地址https://www.toymoban.com/news/detail-764039.html

 

到了这里,关于MySQL 启动失败:Can‘t connect to local MySQL server through socket ‘/usr/local/mysql/data/mysql.sock‘的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 启动本地MySQL / Can‘t connect to MySQL server on ‘localhost‘ (0)的解决

    Can\\\'t connect to MySQL server on \\\'localhost\\\' (0) :无法连接到“localhost”(0)上的MySQL服务器 本地的MySQL服务没有启动,数据库管理端是无法连接的 1、此电脑 - 计算机 - 管理 2、计算机管理(本地)- 服务和应用程序 3、服务 4、找到MySQL - 右击 - 启动 5、正在启动 -启动成功

    2024年02月06日
    浏览(55)
  • MAC电脑Navicat连接MYSQL时,连接失败提示:“2002-Can‘t connect to server on ‘192.168.200.22‘(10060)”,解决方法。

    解决办法: 1.首先我们把MYSQL卸载了(系统偏好设置--点击底部MYSQL--点击unInstall)  2.然后需要通过命令彻底删除mysql相关文件 命令如下:  3.然后需要重启电脑 4.重新安装Mysql 5.然后打开Navicat就可以连接成功了

    2024年02月11日
    浏览(58)
  • 【MySQL】解决2003-Can‘t connect to MySQL server on ‘XXX‘(10038)

    在本地的Navicat连接服务器上的数据库时,可能会出现如下错误,表示没有连接成功 解决方法: 一般需要 改下服务器上mysql的权限 ,首先登录服务器上的mysql,%:表示可以任何主机都能连接到mysql服务器 或者也可以把 % 换成自己本地的IP地址,如: 最后刷新权限使其生效 此

    2024年02月05日
    浏览(49)
  • Can‘‘t connect to MySQL server on localhost (10061)解决方法

    首先检查MySQL 服务没有启动》如果没有启动,则要启动这个服务。 有时候安装mysql后使用mysql命令时报错 Can\\\'t connect to MySQL server on localhost (10061),或者用net start mysql 时报服务名无效,一般是因为mysql服务没有启动。   打开  powershell(管理员)  然后将mysql加入到Windows的服务

    2024年02月16日
    浏览(47)
  • MySQL错误:Can‘t connect to MySQL server on localhost(分多种情况)

    1 . 查看本机是否可以ping通MySQL服务IP地址 : 2 . 查看MySQL是否允许远程连接 : mysql 设置远程方法1: mysql 设置远程方法2: 开放MySQL 3306端口 : 打开MySQL配置文件: vim /etc/mysql/my.cnf 。 注释掉 bind-address = 127.0.0.1 ,以允许MySQL远程连接。 重启MySQL所在服务端系统: init 6 或 rebo

    2024年02月04日
    浏览(62)
  • MySQL远程连接 ERROR 2003 Can‘t connect to MySQL server (10060) 解决办法

    如果不进行任何配置我们是无法通过外网可视化工具访问到mysql数据库的。 1、首先确保服务器的安全组规则(防火墙)允许访问:3306端口  2、在Linux上确认开放3306端口   3、确保登录的用户已经给予了权限

    2024年02月15日
    浏览(52)
  • MySQL问题--Can‘t connect to MySQL server on localhost (10061)解决方法

    方法一: 在管理--》服务中启动 MySQL 服务 下面的方式没有试,也记录一下 问题描述:在命令行输入 mysql -u root -p 登录mysql,返回”Can\\\'t connect to MySQL server on localhost (10061)”错误 问题原因:查到问题原因是mysql没有启动。 解决方法:1、将mysql加入到Windows的服务中。切换到mys

    2024年02月13日
    浏览(42)
  • Mysql登录报错:Can‘t connect to MySQL server on ‘localhost:3306‘ (10061)

    可能每个人遇到问题的情况不一样,首先打开服务我的是当时登录mysql输完密码就会报错:Can\\\'t connect to MySQL server on \\\'localhost:3306\\\' (10061); 网上有的说可以先启动mysql在登陆,但我的输入\\\'net start mysql\\\'也没用,并且我打开服务,发现里面也没有MySql。于是我在想,是不是我的MyS

    2024年02月15日
    浏览(46)
  • 如何解决Can‘t connect to MySQL server on ‘127.0.0.1‘ (61 “Connection refused“)

    这个错误通常是由于MySQL服务器没有正常启动导致的。可以尝试以下解决方案: 检查MySQL服务器是否已经正常启动,如果没有,请启动它。 检查MySQL服务器配置文件中的“bind-address”是否设置为“127.0.0.1”。如果是,请修改为“0.0.0.0”,以便允许连接。 检查防火墙是否阻止了

    2024年02月11日
    浏览(79)
  • MySQL问题:2002 - Can‘t connect to server on ‘localhost‘(10061)【已解决】

    MySQL报错信息 \\\"2002 - Can\\\'t connect to server on \\\'localhost\\\' (10061)\\\" 通常表示MySQL客户端无法连接到MySQL服务器。这个问题通常有以下几个可能的原因和解决方法: MySQL服务器未启动 :首先确保MySQL服务器已经启动。你可以在命令行中输入以下命令来启动MySQL服务: 如果你使用的是Window

    2024年02月02日
    浏览(47)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包