通过mysql -u用户名 -p密码 的命令连接 Mysql数据库时

报错 "can't connect to local mysql serverthrough  socket'/var/run/mysqld/mysqld.sock'

 mysql -u root -p
Enter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

解决方法:

在不重新安装mysql的情况下,通过如下命令来解决,具体的就是先停止mysql服务,再重新开启mysql服务

cd /etc/init.d

sudo service mysql stop

sudo service mysql start 

执行后便可以启用mysql数据库

启动 mysql 时报错的更多相关文章

  1. 第一次启动MySQL时报错

    [root@localhost~]#/usr/local/webserver/mysql/bin/mysql_install_db --basedir=/usr/local/webserver/mys ...

  2. Linux系统下启动MySQL报错:Neither host 'localhost.localdomain' nor 'localhost' could be looked up with

    Linux系统下启动MySQL报错:Neither host 'localhost.localdomain' nor 'localhost' could be looked up with 摘要 Li ...

  3. MyEclipse 启动tomcat时报错:Cannot change deployment state from ERROR to REDEPLOYING.ds

    myeclipse 启动tomcat时报错:Cannot change deployment state from ERROR to REDEPLOYING.ds - 刘琦的专栏 - 博客频道 - C ...

  4. 启动Mysql报错:Another MySQL daemon already running with the same unix socket.

    启动Mysql报错: Another MySQL daemon already running with the same unix socket. 删除如下文件即可解决 /var/lib/mysql ...

  5. 启动MySQL报错

    安装完MySQL,启动MySQL报错,报错信息如下:Starting MySQL....The server quit without updating PID file (/data/mysqlda ...

  6. 用Eclipse的tomcat插件启动tomcat时报错:

    用Eclipse的tomcat插件启动tomcat时报错: FATAL ERROR in native method: JDWP No transports initialized, jvmtiErr ...

  7. Ubuntu 16.04.3启动MySQL报错

    今天安装mysql,连接MySQL时报错mysql: [Warning] Using a password on the command line interface can be insecure. ...

  8. 【转载】在使用JDBC连接MySql时报错:You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support

    在使用JDBC连接MySql时报错:You must configure either the server or JDBC driver (via the serverTimezone config ...

  9. 【原创】大叔经验分享(57)hue启动coordinator时报错

    hue启动coordinator时报错,页面返回undefinied错误框: 后台日志报错: runcpserver.log [13/May/2019 04:34:55 -0700] middlewa ...

随机推荐

  1. JVM内容梳理

  2. 26.python常用端口号

    MySQL默认端口 3306 Redis默认端口 6379 MongoDB默认端口 27017 django端口 8000 flask端口 5000 pyspider服务端口 5000(由flask开 ...

  3. Eclipse关于怎么调出web project

    myeclipse和eclipse两个软件不一样的点很多,当然玩的时候也会遇到找不到的选项 此片摘自: https://www.cnblogs.com/icebutterfly/p/7771936.h ...

  4. spring 之 注入之 by name or by type, or both ?

    @Autowired 和  @Qualifier 使用xml 注入的时候, 我们可以指定 autowire=“byType” 或“byName” . 但是使用 注解的时候, @Autowired  只 ...

  5. leetcode416

    class Solution { public boolean canPartition(int[] nums) { int sum=0; for (int num:nums) sum+= num; ...

  6. vue安装搭建

    title: vue安装搭建 date: 2018-04-21 14:00:03 tags: [vue] --- 安装 首先安装nodejs 直接官网下载最新版本http://nodejs.cn/do ...

  7. Python3 timeit的用法

    Python3中的timeit模块可以用来测试小段代码的运行时间 其中主要通过两个函数来实现:timeit和repeat,代码如下: def timeit(stmt="pass", ...

  8. BASIC GIT WORKFLOW

    BASIC GIT WORKFLOW Generalizations You have now been introduced to the fundamental Git workflow. You ...

  9. 离线部署 pm2 管理node程序

    在服务器不能联网的情况下: 在可以联网的机器上: npm install pm2 -g 全局安装pm2: 然后查看一下本地安装的默认路径: npm config get prefix, 在其  lib ...

  10. UNITY 打包时提示sdk tools 或 sdk build tools版本低时可以直接点update 按钮进行更新

    如题.如果不更新,而选择 : use newest version installed ,打包到结尾时可能会报错,莫名其妙的java错误 而且,SDK一旦被更新后,其所在目录的 SDK MANAGER ...