版权所有,未经博主允许不得转载。

今天发现服务器mysql连接不上,报

can't connect to mysql server on 'root'@'ip' (61)

照例ssh到服务器,发现mysql也进入不了,报错Access denied for user 'root'@'localhost' (using password:YES), 以前都是可以的(好几次出现这种情况)。今天整理下--系统linux. mysql 5.5

谷歌了下,发现解决方法:

1、首先查看mysql 3306端口是否打开。。命令

netstat -an | grep 3306

这个时候发现3306监听的确没有开启。so这个时候停掉mysql服务。命令

/etc/init.d/mysql stop

查看mysql是否停掉,命令

ps -ax |grep mysql

若停掉,则不会看到mysql进程

若未停掉,多试几次

2、then启动mysql,mysqld_safe方式进入mysql  命令

mysqld_safe --user=mysql &

#mysql -u root

mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql>FLUSH PRIVILEGES;

重启mysql

#/etc/init.d/mysql restart

#mysql -u root -p

Enter password:

mysql远程登录授权grant命令

命令:

grant all privileges on *.* to 'USER'@'IP' identified by 'PASS' 

USER:登录用户名

PASS:密码

IP:ip地址或主机号

*.*:数据库.数据表名

all privileges:所有权限 也可为select,insert ,update,delete

整理下,以被以后遇到又浪费太多时间。

Access denied for user 'root'@'localhost' (using password:YES)的更多相关文章

  1. MySql Access denied for user 'root'@'localhost' (using password:YES) 解决方案

    关于昨天下午说的MySQL服务无法启动的问题,解决之后没有进入数据库,就直接关闭了电脑. 今早打开电脑,开始-运行 输入"mysql -uroot -pmyadmin"后出现以下错 ...

  2. phpmyadmin #1045 - Access denied for user 'root'@'localhost' (using password: NO)

    phpmyadmin访问遇到1045问题 #1045 - Access denied for user 'root'@'localhost' (using password: NO) 解决办法 找到p ...

  3. Windows mysql提示:1045 access denied for user 'root'@'localhost' using password yes

    Windows mysql提示:1045 access denied for user 'root'@'localhost' using password yes http://blog.csdn.n ...

  4. Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    案例环境: 操作系统 :Red Hat Enterprise Linux Server release 5.7 (Tikanga) 64 bit 数据库版本 : Mysql 5.6.19 64 bit ...

  5. MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)的真正原因

    在博客Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N ...

  6. mac 安装mysql + 修改root用户密码 + 及报Access denied for user 'root'@'localhost' (using password:YES)解决办法

    1.下载MySQL 到mysql的官网http://dev.mysql.com/downloads/mysql/然后在页面中会看到“MySQL Community Server”下方有一个“downl ...

  7. 升级到macOS 10.12 mysqlb报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    系统升级到macOS 10.12后启动mysql后,在终端输入mysql 报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' ...

  8. mysql 链接失败(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES))

    mysql链接失败(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)) 修改: # ...

  9. 安装mysql因为/tmp权限不足而导致ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)的解决方案

    本机是centos 6.5  安装的mysql是5.1的版本. 在安装mysql之后,第一次启动mysql服务的时候,需要/tmp有777(rwxrwxrwx)的权限,然而楼主的/tmp是755(rw ...

随机推荐

  1. python ABC

    因为项目需要,总是会有各种各样要重命名文件的场合,manual的方法当然不可取,bat的方法又感觉不够强大,所以就从零开始学python,就为了能够自动批量修改文件名,倒腾了一个周六,总算可以了 :) ...

  2. eclipse不能新建server

    将server删除了之后,再新建server选择tomcat的时候servername栏空着而且不能写东西,就添加不成功了,怎么办呢,问过度娘之后,问题迎刃而解,步骤如下 1.到[工程目录下 work ...

  3. js取整函数

    1.丢弃小数部分,保留整数部分parseInt(5/2) 2.向上取整,有小数就整数部分加1 Math.ceil(5/2) 3,四舍五入. Math.round(5/2) 4,向下取整 Math.fl ...

  4. NPOI读取Excel

    项目环境:Webform framework4.0 dll版本:NPOI2.0  dotnet2.0版本 这两天要做个excel导入的功能,想到以前用过NPOI,感觉很给力,今天写了个DEMO,写的时 ...

  5. Oracle学习笔记(二)

    2.Oracle用户管理 (1)创建用户:create user 用户名 identified by 密码(需要dba权限); sql>create user yzw identified by ...

  6. grid安装

    在cs6.5,cs7.2上安装grid11.2.0.1 和database11.2.0.1还是有问题 1.i386与i686的问题 2.cs7.2中的semmni内核参数问题 已经设置了kernel. ...

  7. ng-if ng-show ng-hide 的区别

    angularjs ng-if ng-show ng-hide区别 在使用anularjs开发前端页面时,常常使用ng-show.ng-hide.ng-if功能来控制页面元素的显示或隐藏,那他们之间有 ...

  8. ubuntu安装php5.3

    sudo -i wget http://in1.php.net/distributions/php-5.3.29.tar.bz2 .tar.bz2 cd php- apt-get install li ...

  9. 【转】nginx中的ngx_cdecl

    http://blog.csdn.net/midion9/article/details/50605337 看nginx的代码时,发现有些函数返回值之后,还有一个ngx_cdecl关键字,如:   1 ...

  10. git如何设置账号密码

    查看已设配置 git config --list 修改GIT全局用户名 git config --global user.name [username] 修改GIT全局邮箱 git config -- ...