mysql admin 连接,mysqladmin:连接到“ localhost”服务器失败

Today (2015-05-02) I upgraded my Linux system via apt-get update and

apt-get upgrade whereas mysql, mysqladmin and a lot more packages

have been updated. The mysql-server-5.5 runs and I can login and do all

the typical database operations but when I type:

user@ubuntu:~# mysqladmin proc

I get the following error:

mysqladmin: connect to server at 'localhost' failed

error: 'Access denied for user 'root'@'localhost' (using password: NO)'

Formerly I could solve this issue by simple setting the mysql root password new.

This does not solve the issue anymore:

user@ubuntu:~# sudo dpkg-reconfigure mysql-server-5.5

How do I get the mysqladmin up again without reinstalling mysql?

解决方案

Short version: If your MySQL user root needs a password to connect, it might be a good idea to have mysqladmin provide that password ;)

Longer version: Your MySQL user root seems to need a password to connect

setting the mysql root password new

But mysqladmin tries to connect without a password

'Access denied for user 'root'@'localhost' (using password: NO)'

And mysqladmin does that because you're not telling it otherwise ;)

mysqladmin, like other MySQL-related command line tools (mysql, mysqldump, mysqlshow etc.), offers options to provide such access data.

h: Which host to connect to. If not provided, localhost is assumed

u: Which user to connect as. If not provided, root is assumed

p: Which password to use. If not provided, no password is used

You should be able to use something like

mysqladmin -uroot -pmysupersecretpassword proc

(be aware that there's no space between the options and their values). You can also have MySQL ask you for the password like

mysqladmin -uroot -p proc

With that, MySQL should give you a prompt where you can enter your password.

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值