linux下fedora 15 16安装mysql出错以及解决方法

本文为本人到原创,如需转载请尊重下作者的辛苦,转载时留下本人博客地址,谢谢合作!


因为最近涉及到数据库到应用,就在我的fedora 16上安装mysql,但是问题也就出在了这里。我就从最开始到步骤说起

进入特权模式(之前我已经安装过mysql了),我就直接进入主题

$su

密码:

#cd /etc/init.d/

# ./mysqld start
MySQL Daemon failed to start.
正在启动 mysqld:                                          [失败]

一连进行了好几次,但都是这样的,但不死心,又开始了下面到命令

# mysql -uroot -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

尝试使用修改密码到命令看看能不能有好转

#mysqladmin -uroot -p password '自己设定的新密码'

mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'

还有一种错误显示:

# mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
# mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)


还是错误,彻底有点火了,因为之前像什么

#chkconfig mysql on或者#config --level 35 mysql on等等能在网上找到的方法都尝试了,但效果还是这样,不能链接,不能启用

因为弄的有点恼火了,所以就干出一些不镇定的事,准备把mysql再重新装一边

# yum reinstall mysql mysql-server mysql-libs

.........

.........

完毕!

#cd /usr/bin

#./mysql_install_db         //对数据库进行初始化,这是安装完以后所必须的

出现以下的提示符,注意观看,这也是解决这个问题到关键所在了

WARNING: The host 'PingD' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
OK
Filling help tables...
OK



To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system


PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:


/usr/bin/mysqladmin -u root password 'new-password'                 //这是提示用户如何更改mysql的方法
/usr/bin/mysqladmin -u root -h PingD password 'new-password'


Alternatively you can run:
/usr/bin/mysql_secure_installation

(最重要的,我用蹩脚的英语简单的翻译一下:当然,你也可以运行以下的命令:/usr/bin/mysql_secure_installation


which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.


See the manual for more instructions.


You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &


You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl


Please report any problems with the /usr/bin/mysqlbug script!


因为之前一直不想看英文的文档,因为看起来感觉很痛苦,但这次实在找不到解决办法了,还是硬着头皮去看看,也正是这样让我发现了解决办法

马上又新开了一个控制窗口运行上面的命令,就出现了以下的信息

# /usr/bin/mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!




In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.                                              (原来可以直接在这里用脚本的方式更改密码

Enter current password for root (enter for none):   (输入你设置的新密码

还没有完,设置完这个新密码以后还有以下的设置,这些都是很重要的

Change the root password?

Remove anonymous users?

…………都是一些设置,根据你的需要进行选择,这里就不在一一罗列了

进入下一个步骤:

#/etc/init.d/mysqld start
Starting mysqld (via systemctl):                           [确定]   (^_^,竟然发现成功启动了,有点激动)

# mysql -uroot -p
Enter password: 

mysql>

mysql>                                                   这已经表明成功了


最后总结:遇到问题不要放弃,从多角度去看看说不定就解决了,还有就是多多注意英文文档,里面说不定有你想要的

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值