如何解决Mysql启动报ERROR:2002的分析


当前第2页 返回上一页

先停止mysql服务器


1

2

[root@localhost scripts]# systemvtl restart mysqld

Shutting down MySQL.[ OK ]

修改my.cnf,如下


1

2

3

4

[root@localhost scripts]# vi /etc/my.cnf

[mysql]

no-auto-rehash

socket = /tmp/mysqld.sock #添加该行

重启mysql服务器


1

2

[root@localhost scripts]# systemctl restart mysqld

Starting MySQL..[ OK ]

再次连接正常


1

2

3

4

5

6

7

8

[root@localhost scripts]# mysql -uroot -p

Enter password:

mysql> show variables like 'version';

+---------------+------------+

| Variable_name | Value |

+---------------+------------+

| version | 5.6.12-log |

+---------------+------------+

b、为socket文件建立链接方式


1

2

3

4

5

6

7

8

9

10

11

12

13

14

[root@SZDB mysqldata]# ln -s /tmp/mysql.sock /data/mysqldata/mysql.sock

ln: creating symbolic link `/data/mysqldata/mysql.sock' to `/tmp/mysql.sock': File exists

[root@SZDB mysqldata]# rm mysql.sock #上面提示文件存在,所以删除之前的mysql.sock文件

[root@SZDB mysqldata]# ln -s /tmp/mysql.sock /data/mysqldata/mysql.sock

[root@SZDB mysqldata]# ls -hltr mysql.sock

lrwxrwxrwx 1 root root 15 Oct 11 14:00 mysql.sock -> /tmp/mysql.sock

[root@SZDB mysqldata]# mysql -uroot -p

Enter password:

mysql> show variables like 'socket';

+---------------+-----------------+

| Variable_name | Value  |

+---------------+-----------------+

| socket | /tmp/mysql.sock |

+---------------+-----------------+

总结

以上就是如何解决Mysql启动报ERROR:2002的分析的详细内容,更多文章请关注木庄网络博客!!

返回前面的内容

相关阅读 >>

mysql怎么添加列的数据

mysql 客户端不输入用户名和密码直接连接数据库的2个方法

mysql能有几个数据库吗?

如何解决ip 连不上mysql

mysql数据库编码如何设置以及查看

mysql基础之连接mysql、修改密码、添加用户

如何利用mysql数据库在插入数据后触发触发器

mysql 教程之列类型中的字符串型

mysql批量sql插入性能优化详解

如何通过ssh连接mysql数据库?

更多相关阅读请进入《error》频道 >>


数据库系统概念 第6版
书籍

数据库系统概念 第6版

机械工业出版社

本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...