刚刚装好linux as 4.
现在面临的第一个问题就是怎么用上自带mysql>[root@server tmp] rmp -qa|grep mysql 察看当前mysql版本.
一:
当我在命令行输入mysql时出现了:Can"t connect to local MySQL server through socket "/var/lib/mysql/mysql.soc的错误的话.
解决的办法是:由于mysql 服务还没有启动。试试看:>>>service mysqld starty
二:
root@localhost www]# service mysqld start
Initializing MySQL database: Neither host "localhost" nor "localhost" could be looked up with
/usr/bin/resolveip
Please configure the "hostname" command to return a correct hostname.
If you want to solve this at a later stage, restart this script with
the --force option
[FAILED]
[root@localhost www]#
处 理:
1、$ ping localhost
ping: unknown host localhost
ping也不成功,确定可能为localhost解析原因。
2、查看/etc/hosts,内容如下:
# Do not remove the following line, or various programs
# that require network functionality will fail.
::1 localhost.localdomain localhost
3、将::1修改为127.0.0.1后,启动成功。
三:mysqladmin -u root -p password
想输入空密码,但居然说
mysqladmin:connect to server at"localhost" failed
erroe:"acces denied for user "root@127.0.0.1"
试试这个:>mysql -u root -p 123456
Enter password:123456
或者参考:
使用网上介绍的方法修改root用户的密码:
# mysqladmin -uroot -p password "newpassword"
Enter password:
mysqladmin: connect to server at "localhost" failed
error: "Access denied for user "root"@"localhost" (using password: YES)"
现在终于被我找到了解决方法,如下(请先测试方法三,谢谢!):
方法一:
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD("newpassword") where USER="root";
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysql restart
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>学习掌握Linux下MySQL+Webmin数据库创建法Linux下MySQL最大连接数的设置方法相关资讯 mysql - 数据库服务器 MySQL (08/15/2013 06:50:23)
- MySQL 5.6 GA 及逃亡潮 (02/08/2013 14:36:35)
- MySQL 5.5.22、5.1.62、5.0.96全线 (03/22/2012 19:03:49)
| - MySQL Administrator连接VMWare下 (05/24/2013 09:20:58)
- MySQL 5.1.68 发布 (02/05/2013 08:37:47)
- CentOS 5.2+MySQL+Heartbeat双机互 (01/29/2012 11:16:55)
|
本文评论 查看全部评论 (1) 评论声明- 尊重网上道德,遵守中华人民共和国的各项有关法律法规
- 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
- 本站管理人员有权保留或删除其管辖留言中的任意内容
- 本站有权在网站内转载或引用您的评论
- 参与本评论即表明您已经阅读并接受上述条款
|
|