始创于2000年 股票代码:831685
咨询热线:0371-60135900 注册有礼 登录
  • 挂牌上市企业
  • 60秒人工响应
  • 99.99%连通率
  • 7*24h人工
  • 故障100倍补偿
您的位置: 网站首页 > 帮助中心>文章内容

Linux中mysqly一些问题的解决

发布时间:  2012/8/7 17:50:41

刚刚装好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>
 


本文出自:亿恩科技【www.enkj.com】

服务器租用/服务器托管中国五强!虚拟主机域名注册顶级提供商!15年品质保障!--亿恩科技[ENKJ.COM]

  • 您可能在找
  • 亿恩北京公司:
  • 经营性ICP/ISP证:京B2-20150015
  • 亿恩郑州公司:
  • 经营性ICP/ISP/IDC证:豫B1.B2-20060070
  • 亿恩南昌公司:
  • 经营性ICP/ISP证:赣B2-20080012
  • 服务器/云主机 24小时售后服务电话:0371-60135900
  • 虚拟主机/智能建站 24小时售后服务电话:0371-60135900
  • 专注服务器托管17年
    扫扫关注-微信公众号
    0371-60135900
    Copyright© 1999-2019 ENKJ All Rights Reserved 亿恩科技 版权所有  地址:郑州市高新区翠竹街1号总部企业基地亿恩大厦  法律顾问:河南亚太人律师事务所郝建锋、杜慧月律师   京公网安备41019702002023号
      0
     
     
     
     

    0371-60135900
    7*24小时客服服务热线