在mac osx10.6下安装mysql后,启动总是报错ERROR 2002 (HY000): Can't connect to local MySQL ser

问题描述

要在mac10.6下安装mysql以便rails开发,装了两天都没有成功。之前没用过mac或linux开发,一直用windows,所以希望高手们能指点一下。我在安装时参考了以下文章:http://beike.iteye.com/blog/617341http://hqman.iteye.com/blog/258979下面是我的安装过程及错误:安装和初始化mysqlport search mysqlsudo port install mysql5-server
解决方案二:

解决方案三:

解决方案四:

解决方案五:

解决方案六:

解决方案七:

解决方案八:

解决方案九:

解决方案十:

解决方案十一:

解决方案十二:

解决方案十三:

解决方案十四:

解决方案十五:

其他方案:

其他方案:

其他方案:

其他方案:

其他方案:

其他方案:
A startup item has been generated that will aid in# starting mysql5-server with launchd. It is disabled# by default. Execute the following command to start it,# and to cause it to launch at startup:## sudo port load mysql5-server
其他方案:

其他方案:

其他方案:

其他方案:

其他方案:

其他方案:

其他方案:

其他方案:

其他方案:

其他方案:

其他方案:

其他方案:

其他方案:

其他方案:

其他方案:

其他方案:

其他方案:

其他方案:

其他方案:
##---> Installing mysql5-server @5.1.50_0******************************************************* In order to setup the database, you might want to run* sudo -u _mysql mysql_install_db5* if this is a new install******************************************************---> Activating mysql5-server @5.1.50_0---> Cleaning mysql5-serversudo /opt/local/lib/mysql5/bin/mysql_install_db --user=mysqlInstalling MySQL system tables...OKFilling help tables...OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:/opt/local/lib/mysql5/bin/mysqladmin -u root password 'new-password'/opt/local/lib/mysql5/bin/mysqladmin -u root -h bogon password 'new-password'Alternatively you can run:/opt/local/lib/mysql5/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly recommended for production servers.See the manual for more instructions.You can start the MySQL daemon with:cd /opt/local ; /opt/local/lib/mysql5/bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.plcd /opt/local/mysql-test ; perl mysql-test-run.plPlease report any problems with the /opt/local/lib/mysql5/bin/mysqlbug script!配置mysql:开机自动启动mysqlsudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist 启动mysql如果要快捷启动,则要先设置aliases,再用aliases来启动:mate ~/.profile打开这个配置文件,输入以下内容:alias mysqlstart='sudo /opt/local/bin/mysqld_safe5 &' alias mysqlstop='/opt/local/bin/mysqladmin5 -u root -p shutdown'启动mysqlmysqlstart[1] 62478如果没有设置aliases,则用以下命令来启动/opt/local/share/mysql5/mysql/mysql.server start验证mysql安装成功:mysqladmin5 -u root -p pingerror: 'Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)'Check that mysqld is running and that the socket: '/opt/local/var/run/mysql5/mysqld.sock' exists!或mysql5 -u root –pERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)mate /opt/local/etc/mysql5/my.cnf并输入以下内容(参考http://beike.iteye.com/blog/617341):[mysqld_safe]socket = /tmp/mysql.sock再调用 mysql5 -u root –p还是报相同错误。 问题补充:引用

解决方案

试一下用这个命令能否连接:mysql5 -u root –p -h 127.0.0.1如果能连接,使用这个命令看看socket到底是什么?show variables like 'socket';我是直接装的这个:http://www.mysql.com/downloads/mirror.php?id=392754socket是:mysql> show variables like 'socket';+---------------+-----------------+| Variable_name | Value |+---------------+-----------------+| socket | /tmp/mysql.sock | +---------------+-----------------+1 row in set (0.03 sec)
其他方案:
客户端程序连接时使用的socket和服务器使用的不一致,所以,连接不上。不带任何参数运行mysqladmin时,输出里有如下文字:引用Default options are read from the following files in the given order:/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf 检查一下这些配置文件中,是否有任何地方使用了/opt/local/var/run/mysql5/mysqld.sock。
其他方案:
http://2015.iteye.com/blog/615152

时间: 2024-05-22 18:49:53

在mac osx10.6下安装mysql后,启动总是报错ERROR 2002 (HY000): Can't connect to local MySQL ser的相关文章

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) 据说这个问题的原因很多,当然,我自己这个问题我是清楚的,就是mysql.sock的位置所致,一个是PHP要求的,一个是MYSQLD定义的,一个是MY.CONF指定的...SO.... 暂时不能统一的话,用软链接LN -S命令解决吧..   方案5      摘要:解决不能通过mysql .so

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

mysql启动成功 service mysqld start  mysql is OK mysql登录错误 : [root@localhost ~]# mysql -uroot -p123456ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 解决: vim /etc/my.cnf 找到 socket路径 scoket=/tmp/mysql.

eclipse安装weblogic后部署项目报错,

问题描述 eclipse安装weblogic后部署项目报错, 直接点击base_domain下的start.cmd文件部署发布是伪问题的,求大神指教.... java.lang.Exception: Exception received from deployment driver. See Error Log view for more detail. at oracle.eclipse.tools.weblogic.server.internal.DeploymentProgressList

jdk安装好后,控制台报错如下。

问题描述 jdk安装好后,控制台报错如下. -->java -version -->Error:opening registry key'SofrwareJavaSoftJava Runtime Environment' -->Error:could not find java.dll -->Error:could not find Java SE Runtime Environment 解决方案 环境变量配置好了吗?要不就是你装的JDK有问题. 解决方案二: 是不是没有访问注册表

mysql起动报错The server quit without updating PID file /usr/local/mysql/data/

mysql起动报错The server quit without updating PID file (/usr/local/mysql/data/ 查看错误日志显示: mysqld_safe mysqld from pid file /usr/local/mysql/data/mysql.pid ended 肯定是配置文件问题: 新安装的测试机  hostname server01  centos 6.5 环境   mysql 5.6.12 单机 64位 二进制包安装 my.cnf 里面只有一

win x64下安装oracle 12c出现INS-30131报错的解决方法_oracle

本文为大家分享了安装oracle 12c出现[INS-30131]报错的解决方案,供大家参考,具体内容如下 解决方案: 第一步:控制面板>所有控制面板项>管理工具>服务>SERVER启动 第二步:控制面板>所有控制面板项>管理工具>计算机管理>系统工具>共享文件夹>共享右键单击"共享">新建共享> 点击"下一步">单击"浏览">选择"本地磁盘(C:)&q

“Can't connect to local MySQL”提示

今天连接mysql数据库的时候遇到一个问题:Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 方案1. 1.#ps -A|grep mysql 显示类似: 1829 ? 00:00:00 mysqld_safe 1876 ? 00:00:31 mysqld 2.#kill -9 1829 3.#kill -9 1876 4.#/etc/init.d/mysql restart 5.#mysql -u

mysql中导入报错-ERROR 2013 (HY000)的案例

[现象] 导入MySQL的mysqldump文件时报错,提示ERROR 2013 (HY000) at line xxoo: Lost connection to MySQL serverduring query,导入操作中断退出. [原因] 要导入的mysqldump文件中insert的values值太多,超过了MySQL参数max_allowed_packet的值,进而导致导入操作中断退出. [解决方法] 调高max_allowed_packet的值: SQL> set global max

mysql导入sql文件报错 ERROR 2013 2006 2002

  今天导入sql总是提示错误 代码如下: ERROR 2013 (HY000): Lost connection to MySQL server during query ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/l