Linux下mysql数据库root无法登录的情况
今天安装lnmp环境后用mysql -u root -p连接密码后出现错误
Access denied for user 'root'@'localhost' (using password: YES)
然后我就用 /etc/init.d/mysql stop 先去停止数据库
然后用安全模式 mysqld_safe --user=mysql --skip-grant-tables --skip-networking & 进入数据库
然后用SQL语句修改root权限 UPDATE user SET Password=PASSWORD('我的密码') where USER='root';
改完了后 重新刷新权限 FLUSH PRIVILEGES; 然后quit退出
然后重启数据库就行了 /etc/init.d/mysql restart
[root@967b0e11e627 default]# mysql -u root -p
Enter password:
ERROR (): Access denied for user 'root'@'localhost' (using password: YES)
[root@967b0e11e627 default]# /etc/init.d/mysql stop
Shutting down MySQL. SUCCESS!
[root@967b0e11e627 default]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[]
[root@967b0e11e627 default]# :: mysqld_safe Logging to '/usr/local/mysql/var/967b0e11e627.err'.
:: mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var [root@967b0e11e627 default]# mysql -u root mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.5.-log Source distribution Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
rows in set (0.02 sec) mysql> UPDATE user SET Password=PASSWORD('Weiwend&20150125') where USER='root';
Query OK, rows affected (0.00 sec)
Rows matched: Changed: Warnings: mysql> FLUSH PRIVILEGES;
Query OK, rows affected (0.00 sec) mysql> quit
Bye
[root@967b0e11e627 default]# /etc/init.d/mysql restart
Shutting down MySQL. :: mysqld_safe mysqld from pid file /usr/local/mysql/var/967b0e11e627.pid ended
SUCCESS!
Starting MySQL.. SUCCESS!
[]+ Done mysqld_safe --user=mysql --skip-grant-tables --skip-networking
[root@967b0e11e627 default]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.5.-log Source distribution Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
rows in set (0.00 sec) mysql> exit
Bye
Linux下mysql数据库root无法登录的情况的更多相关文章
- linux下mysql数据库的操作
本文主要针对linux下mysql数据库的安装,以及数据库的创建和简单的数据库操作进行说明. ①.Mysql数据库的安装: 数据库的安装分为源码安装和rpm安装. 当然对于老手来说需要进行一些自定义的 ...
- linux下mysql忘记root密码怎么办
Linux下MySQL忘记root密码怎么办? Linux下MySQL忘记root密码怎么办? 1. 修改MySQL配置文件 默认MySQL的配置文件为/etc/my.cnf,在[mysqld]下面添 ...
- linux安装mysql后root无法登录 sql 无法登录
linux安装mysql后root无法登录 问题:[root@localhost mysql]# mysql -u root -pEnter password: ERROR 1045 (28000): ...
- Linux下MySQL数据库主从同步配置
说明: 操作系统:CentOS 5.x 64位 MySQL数据库版本:mysql-5.5.35 MySQL主服务器:192.168.21.128 MySQL从服务器:192.168.21.129 准备 ...
- 记录--linux下mysql数据库问题
本次主要记录一下linux下mysql数据库的一些问题,也是之前经常用到的知识,这里简单总结一些问题,方便自己以后的回顾.原来一直使用的是阿里云的RDS数据库mysql版,主要是因为上次阿里云做活动可 ...
- Linux下MySQL数据库的备份与恢复
Linux下MySQL数据库的备份与恢复 作者:Grey 原文地址: Github 语雀 博客园 基于版本 MySQL5.7 Deepin Linux 15.11 xtrabackup-2.4.18 ...
- Linux下Mysql数据库忘记root
系统环境:Red Hat Enterprise Linux Server 6 1.停止mysqld服务 [root@Server huage]# service mysqld stop 2.以跳过授权 ...
- Linux 下,mysql数据库报无法登陆错误:ERROR 1045 (28000): Access denied for use
今天在别人的服务器上登录mysql发现无法登陆(Mysql别人实现安装好的) 密码和用户名都是正确的,但登录后报如下错误: ERROR 1045 (28000): Access denied for ...
- Linux下MySQL 数据库的基本操作
1. 创建数据库相关命令: 首先,下载MySQL相关软件包:aptitude install mysql-server/mysql-client MySQL中的root用户类似于Linux下的root ...
随机推荐
- sae后台管理端的js,daterangepicker使用
原本只为了日期范围选择器看下sae的前端怎么实现 然后... 公共函数两个文件,第一个是各种插件: typeahead.js 自动完成 //关键词自动完成 $('#page-auto-complete ...
- PHP优化小结
1.echo 比 print 快,并且使用echo的多重参数(指用逗号而不是句点)代替字符串连接,比如echo $str1,$str2.如果使用echo $str1.$str2 就会需要 PHP 引擎 ...
- hdu-A+B问题,大数加法
格式问题很头疼啊 Input The first line of the input contains an integer T(1<=T<=20) which means the num ...
- xe6+firedac连接sybase
一.Win7 X64系统安装sybase odbc: 1. 下载对应包至c:\system_odbc(文件夹名自己取,在后面注册表内容需要用到): 2. 将值信息写入到注册表内: Windows ...
- bzoj 1815: [Shoi2006]color 有色图 置换群
1815: [Shoi2006]color 有色图 Time Limit: 4 Sec Memory Limit: 64 MBSubmit: 136 Solved: 50[Submit][Stat ...
- [原博客] POI系列(5)
正规.严谨.精妙. -POI BZOJ 2213 : [Poi2011]Difference 如果我们每次枚举两个字母最大最小情况时,很容易想到写出代码里注释的样子.这样是26*26*n的,我们发现枚 ...
- 四校训练 warm up 14
A:Pythagoras's Revenge 代码: #include<cstdio> #define ll long long using namespace std; int main ...
- uva 12526 - Cellphone Typing
字典树,可惜比赛的时候有两句话写倒了: 害得我调了一个小时: 今天不宜做题 = = 代码: #include<cstdio> #include<cstring> #define ...
- 靓号正则表达式(前后向查找等) 和 apache正则包使用
一般公司在开发一类对的号码时,会预留一些号码给以后升级的会员使用,比如旺旺靓号,QQ号等,采用正则表达式实现较好,通过规则引擎的后台页面做成实时可配置的也是不错的选择. 一. 一般会有如下的正则需求 ...
- QLGame 2D Engine编写环境搭建
QLGame 2D Engine编写 (win7环境搭建) 广州麒麟网络工作室,计划制作一款2d game engine,基于opengl(es)平台,暂时支持android,以后考虑支持linux, ...