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

今天发现服务器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. (转)如何进行Monkey Test

    如何进行Monkey Test   目录 一 简介 二 测试准备 三 基本命令格式 四 测试Log获取 五 Monkey命令参数介绍 六 保存monkey log以及手机log到sdcard(新增) ...

  2. .gitignore的多级目录配置

    在子目录下仍然可以建立.gitignore文件以用于忽略子目录的文件

  3. 《HelloGitHub》之GitHub Bot

    起因 我在github上发起了一个开源项目:<HelloGitHub月刊>,内容是github上收集的好玩,容易上手的开源项目. 目的:因为兴趣是最好的老师,我希望月刊中的内容可以激发读者 ...

  4. tengine+tomcat配置

    # 根据你服务器的cpu核数来确定此值 worker_processes 4; error_log logs/error.log crit; #error_log logs/error.log not ...

  5. spring mvc 4识别浏览器(移动端) spring-mobile-device

    官方文档: http://projects.spring.io/spring-mobile/ 通过mvc.xml配置示例: http://blog.csdn.net/wuyt2008/article/ ...

  6. Mybatis原理分析之一:从JDBC到Mybatis

    1.引言 本文主要讲解JDBC怎么演变到Mybatis的渐变过程,重点讲解了为什么要将JDBC封装成Mybaits这样一个持久层框架.再而论述Mybatis作为一个数据持久层框架本身有待改进之处. 2 ...

  7. (AIDE)Android Eclipse JNI 调用 .so文件加载问题

    背景:对于Android工程 Eclipse里编译好的.so文件放到 libs\armeabi下以后, 这样.so文件就可以打包到apk文件里,在apk装到手机上以后 在libs\armeabi下的. ...

  8. 备份触发器:ADDC3

    CREATE OR REPLACE TRIGGER "XMV502"."ADDC3" before insert on bd_cubasdoc for each ...

  9. 可扩展Web架构与分布式系统(转)

    1.1. web分布式系统的设计原则 搭建和运营一个可伸缩的web站点或者应用程序意味着什么?在原始层面上这仅仅是用户通过互联网连接到远程资源-使系统变得可伸缩的部分是将资源.或者访问的资源,分布于多 ...

  10. Oracle补习班第三天

    In every triumph, there's a lot of try. 每个胜利背后都有许多尝试 Oracle管理实例组件 主要组件分为两部分例程,与数据库: 例程分为两部分SGA跟进程: S ...