LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1462|回复: 10

更改mysql密码的时候,出现如下错误是什么意思?

[复制链接]
发表于 2003-11-13 09:46:34 | 显示全部楼层 |阅读模式
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!


还有,我编译mysql的时候,居然在/usr/local/mysql/目录下没var目录阿

什么原因?编译很正常啊
发表于 2003-11-13 09:50:44 | 显示全部楼层
告诉你MySQL没有运行或是sock文件不正确。
 楼主| 发表于 2003-11-13 09:52:12 | 显示全部楼层
还有,我编译mysql的时候,居然在/usr/local/mysql/目录下没var目录阿

什么原因?编译很正常啊
 楼主| 发表于 2003-11-13 09:56:07 | 显示全部楼层
[root@test]# /usr/local/mysql/bin/mysqld_safe &
[1] 2034
[root@test]# Starting mysqld daemon with databases from /var/lib/mysql
031113 09:50:06  mysqld ended

你看看,我连mysql都启动不了,怎么会事情?以前从没出现过这种情况阿
发表于 2003-11-13 10:01:58 | 显示全部楼层
你在编译时是否指定了var的目录?
在那个var目录下有*.err文件,要通过它找到出错原因。
 楼主| 发表于 2003-11-13 10:05:38 | 显示全部楼层
没有指定目录阿,我编译mysql的时候,执行的时如下命令

www#./configure --prefix=/usr/local/mysql
www#make
www#make install

以前用这个命令,每点问题啊
发表于 2003-11-13 10:15:41 | 显示全部楼层
PHP不能通过sock连接MySQL的解决办法
这个问题主要提示是,不能通过'/tmp/mysql.sock'连到服务器,而php标准配置正是用过'/tmp/mysql.sock',但是一些mysql安装方法将mysql.sock放在/var/lib/mysql.sock或者其他的什么地方,你可以通过修改/etc/my.conf文件来修正它,打开文件,可以看到如下的东东: [mysqld]
socket=/var/lib/mysql.sock 改一下就好了,但也会引起其他的问题,如mysql程序连不上了,再加一点:
[mysql]
socket=/tmp/mysql.sock

或者还可以通过修改php.ini中的配置来使php用其他的mysql.sock来连,这个大家自己去找找 或者用这样的方法:
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

还有: phpmyadmin的说明书有说 The error message "Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)..." is displayed. What can I do? For RedHat users, Harald Legner suggests this on the mailing list: On my RedHat-Box the socket of mysql is /var/lib/mysql/mysql.sock. In your php.ini you will find a line mysql.default_socket = /tmp/mysql.sock change it to mysql.default_socket = /var/lib/mysql/mysql.sock Then restart apache and it will work. Here is a fix suggested by Brad Ummer in the phpwizard forum: First, you need to determine what socket is being used by MySQL. To do this, telnet to your server and go to the MySQL bin directory. In this directory there should be a file named mysqladmin. Type ./mysqladmin variables, and this should give you a bunch of info about your MySQL server, including the socket (/tmp/mysql.sock, for example). Then, you need to tell PHP to use this socket. Assuming you are using PHP 3.0.10 or better, you can specify the socket to use when you open the connection. To do this in phpMyAdmin, you need to complete the socket information in the config.inc.php3. For example: $cfg['Servers'][$i]['socket'] = '/tmp/mysql.sock';
 楼主| 发表于 2003-11-13 10:34:45 | 显示全部楼层
谢谢。我按照你说的,将php.ini文件里的mysql.default_socket =
修改成了mysql.default_socket =/var/lib/mysql/mysql.sock

然后重新启动了apache服务器,我再执行
[root@center-5 sbin]# touch: 正在创建目录 ‘/usr/local/mysql/var/center-5.err’: 没有那个文件或目录
chown: 无法取得 ‘/usr/local/mysql/var/center-5.err’ 的属性: 没有那个文件或目录
Starting mysqld daemon with databases from /usr/local/mysql/var
/usr/local/mysql/bin/mysqld_safe: line 296: /usr/local/mysql/var/center-5.err: 没有那个文件或目录
/usr/local/mysql/bin/mysqld_safe: line 302: /usr/local/mysql/var/center-5.err: 没有那个文件或目录
tee: /usr/local/mysql/var/center-5.err: 没有那个文件或目录
031113 10:28:48  mysqld ended
tee: /usr/local/mysql/var/center-5.err: 没有那个文件或目录


出现如上错误提示,看提示是说没有var目录,是的,我编译mysql和安装后,就是没出来var目录阿,怎么会事情?〉??
发表于 2003-11-13 20:05:52 | 显示全部楼层
最初由 tahaomei 发表
[root@test]# /usr/local/mysql/bin/mysqld_safe &
[1] 2034
[root@test]# Starting mysqld daemon with databases from /var/lib/mysql
031113 09:50:06  mysqld ended

你看看,我连mysql都启动不了,怎么会事情?以前从没出现过这种情况阿

mysqld_safe --user=root &
发表于 2003-11-15 19:45:08 | 显示全部楼层
楼主初始化权限表了吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表