【Problem】xampp in ubuntu下命令行启动mysql报错: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/lampp/var/mysql/mysql.sock' (2)

xampp in ubuntu下命令行启动mysql报错:

[email protected]:/opt/lampp$ ./bin/mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/opt/lampp/var/mysql/mysql.sock‘ (2)

启动mysql服务:

[email protected]:/opt/lampp$ /opt/lampp/lampp start
You need to start XAMPP as root!
[email protected]-Lenovo:/opt/lampp$ su root
Password:
[email protected]-Lenovo:/opt/lampp# /opt/lampp/lampp start
Starting XAMPP for Linux 1.7.7...
XAMPP: Starting Apache with SSL (and PHP5)...
XAMPP: Starting MySQL...
XAMPP: Starting ProFTPD...
XAMPP for Linux started.

运行mysqlStart.sh:

#!/bin/bash
sudo rm -rf /var/run/mysqld
sudo mkdir /var/run/mysqld
sudo ln -s /opt/lampp/var/mysql/mysql.sock /var/run/mysqld/mysql.sock

关于此这篇文章给出很好的分析:http://www.samundra.com.np/solved-error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-varrunmysqldmysqld-sock-2/563

命令行启动mysql

[email protected]:/opt/lampp$ ls
bin      error  htdocs  lampp  libexec   logs     phpmyadmin    sbin   tmp
cgi-bin  etc    icons   lib    licenses  modules  RELEASENOTES  share  var
[email protected]-Lenovo:/opt/lampp$ /bin/mysql -u root -p
bash: /bin/mysql: No such file or directory
[email protected]-Lenovo:/opt/lampp$ ./bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.16 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql> 

至此,问题解决

【Problem】xampp in ubuntu下命令行启动mysql报错: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/lampp/var/mysql/mysql.sock' (2)

原文地址:https://www.cnblogs.com/SofuBlue/p/11646019.html

时间: 2024-10-11 00:46:46

【Problem】xampp in ubuntu下命令行启动mysql报错: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/lampp/var/mysql/mysql.sock' (2)的相关文章

mysql启动不了:ERROR 2002 (HY000): Can’t connect to local MySQL server through socket

ps aux |grep mysql kill所有列出的进程,然后重启 service mysql start 原因有可能是mysqld没启动:service mysqld start. 持续出现此问题有可能是配置文件不对. 修改/usr/my.cnf   (一般是/etc/my.cnf) [mysqld] datadir=/usr/local/mysql/data socket=/var/lib/mysql/mysql.sock [mysql.server] user=mysql basedi

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var mysql 启动不了

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var mysql 启动不了 ps -A | grep -i mysql kill 列出来的进程 service mysql start 我的问题就解决了 ---------------------------------------------- Fedora8启动mysql 报错:ERROR 2002 (HY000): Can’t connect

安装mysql后ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var mysql 启动不了

ps -A | grep -i mysql kill 列出来的进程 service mysql start 我的问题就解决了 ---------------------------------------------- Fedora8启动mysql 报错:ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2) 1.先查看 /etc/rc.d/ini

启动mysql错误ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2) 1.先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.另外看看是不是权限问题. 2.确定你的mysql.sock是不是在那个位置,mysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock 3

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var mysql 启动不了(转载)

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var mysql 启动不了 ps -A | grep -i mysql kill 列出来的进程 service mysql start 我的问题就解决了 ---------------------------------------------- Fedora8启动mysql 报错:ERROR 2002 (HY000): Can't connect

Mac下Mysql启动异常["ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)"]

在mac下使用brew安装mysql,之前没有使用过,今天启动的时候发现启动不了 huijundeMacBook-Pro:bin huijunzhang$ mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 查看mysql的安装位置: huijundeMacBook-Pro:bin huijunzhang$ which mysql /usr/local

mysql登陆启动报错 ERROR 2002 (HY000) 解决方法

报错信息 登陆数据库报错:` ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")` 重启服务报错:Job for mariadb.service failed because the control process exited with error code. See &quo

CentOS6.5_x64安装MySQL-5.6.17,在已经启动MySQL服务的情况下,出现密码报错ERROR 2002 (HY000)

1.修改MySQL配置文件,使MySQL登陆时跳过密码验证 skip-grant-tables 2.重启MySQL服务 service mysql restart 3.进入MySQL,修改user表中的密码 [root]#mysql -u root mysql> show databases; mysql> use mysql; mysql> update user set Password=password('root') where user = 'root'; mysql>e

ubuntu 下命令行格式化 U盘 (转载)

ubuntu 下命令行格式化 U盘 命令行:原则是先卸载,后格式化. 假如u盘挂载在/media/disk上 卸载: sudo umount /media/disk 格式化: sudo mkfs.vfat /dev/sdb 可以用 sudo fdisk -l查看u盘是不是/dev/sdb. 不同的格式对应不同的格式化命令: mkfs mkfs.cramfs mkfs.ext3 mkfs.ext4dev mkfs.msdos mkfs.vfat mkfs.bfs mkfs.ext2 mkfs.ex