解决MYSQL ERROR 1045 (28000)问题
原因1-启动命令错误:
我开始的时候直接输入命令:mysql start
正确的启动命令是:
原因2-配置文件错误:
检查etc下面的my.cnf如下内容:
#password = your_password
port = 3306
socket = /usr/mysql-data/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /usr/mysql-data/mysql.sock
原因3-启动文件错误:
需要修改MySQL启动脚本/etc/rc.d/init.d/mysql,
其中datadir= ? 一行检查下!
原因4-前提是你在使用php连接时候报错!
在/etc/php.ini修改mysql.default_socket的值设置为:
mysql.default_socket=/var/lib/mysql/mysql.sock
回到终点设置个连接:ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
(在/etc/php.ini中mysql.default_socket这个文件中,关于mysql.default_socket的值的说明是这样的,
;Default socket name for local MySQL connects. If empty, uses the built-in MySQL defaults.
这个值一开始是空的,也就是说,如果我们不主动去修改的话,php将会使用内建在mysql中的默认值)
这种问题需要强行重新修改密码,方法如下:
/etc/init.d/mysql stop (service mysqld stop )
/usr/bin/mysqld_safe --skip-grant-tables
另外开个SSH连接
[root@localhost ~]# mysql
mysql>use mysql
mysql>update user set password=password("123456") where user="root";
mysql>flush privileges;
mysql>exit
pkill -KILL -t pts/0 可将pts为0的**用户(之前运行mysqld_safe的用户窗口)强制踢出
正常启动 MySQL:/etc/init.d/mysql start (service mysqld start)
注意:另外还遇到需要service mysql star才能启动service mysql stop才能停止。
还有直接使用mysql不能找到命令,错误为“bash: mysql: command not found”可以直接**mysql的安装目录中的bin文件夹跟绝对路径运行命令,还有的需要加./mysql 才能执行。
| First things first. Log in as root and stop the mysql daemon. sudo /etc/init.d/mysql stop Now lets start up the mysql daemon and skip the grant tables which store the passwords. sudo mysqld_safe --skip-grant-tables& (press Ctrl+C now to disown the process and start typing commands again) You should see mysqld start up successfully. If not, well you have bigger issues. Now you should be able to connect to mysql without a password. sudo mysql --user=root mysql update user set Password=PASSWORD('new-password'); Now kill your running mysqld then restart it normally. sudo killall mysqld_safe& You should be good to go. Try not to forget your password again. |
MySQL Authentication Denial
It seems to me that a lot of people have auth denial when trying to make connections to MySQL. They seem to ignore the text of the error message. ‘Access Denied’ means access denied, nothing else.
Remember three things have to match. The host as MySQL sees it, the username, and the password. When MySQL returns access denied it’s not broken. One or more of those three things does not match. I don’t really need to reiterate what’s in the manual. Chang the lock or change the key to make it fit.
解决MYSQL ERROR 1045 (28000)问题的更多相关文章
- 解决Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'问题
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) Red Hat Enterpris ...
- 转-解决Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'问题
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) Red Hat Enterpr ...
- 【技术贴】解决Mysql ERROR 1045 (28000): Access denied for
今天Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' 肯定是密码不对了.那么重置一下密码吧. 打开 cmd 输入以 ...
- ubuntu系统安装mysql登陆提示 解决Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'问题
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAqoAAABtCAIAAADmldQYAAAe/0lEQVR4nO1dveslR3btzJGFk02GmU
- MYSQL ERROR 1045 (28000) Access denied for user (using password YES)问题的解决
我的Linux是Centos6.7的版本,本机上Mysql突然怎么连接都进不去 报错:MYSQL ERROR 1045 (28000) Access denied for user (using pa ...
- MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost'解决
MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost'解决: # /etc/init.d/mysql stop # my ...
- 关于mysql登录异常处理方法 - mysql ERROR 1045 (28000)
今天在开发过程中遇到了一个很令人头痛的问题?? 使用 百度经验的步骤 [http://jingyan.baidu.com/article/495ba841ef412d38b30edeb2.html]修 ...
- Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using password: YSE)
安装mysql后,使用命令登录mysql居然报错了,Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using ...
- MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO
MySQL安装完server端和客户端后,登录Mysql时报错:[root@rhel204 MySQL 5.6.23-RMP]# mysqlERROR 2002 (HY000): Can't conn ...
随机推荐
- 10分钟轻松设置出 A+ 评分的 HTTP/2 网站
前言 其实 HTTP/2 应该是 2015 年的老话题了(2015 年 5 月 14 日 HTTP/2 协议正式版的发布),但是 2018 年都到了很多网站依旧没有使用,作为新一代互联网协议,HTTP ...
- JPA学习笔记(8)——映射一对多关联关系
一对多关联关系 本文有很多和多对一是一样的,因此不会写得非常具体. 有看不懂的.能够參考JPA学习笔记(7)--映射多对一关联关系 Order实体类 package com.jpa.helloworl ...
- java 泛型中class<T> 和T的区别是什么?
public <T> boolean edit(T entity) 和public <T> T get(Class<T> c, Serializable id)中这 ...
- 使用maven生成可执行的jar包
从pom的xsi中可以打开描述pom的schema: 可以看到pom中,project的结构: 默认的mvn install生成的jar是不带主类入口的,需要在maven-compile-plugin ...
- 修改 Semantic UI 中对 Google 字体的引用
在第一次尝试 Semantic UI 后,发现其 css 中第一行,就引用了 fonts.googleapis.com 中的字体. 不知道为什么要这么做,也许在国外,google 的服务已经是一种互联 ...
- 使用gradle多渠道打包
以友盟的多渠道打包为例,如果我们须要打包出例如以下渠道:UMENG, WANDOUJIA, YINGYONGBAO. 第一种方法.是须要创建文件的. 我们在写完我们的代码之后,在app/src以下.分 ...
- android AlertDialog设置点击button不退出(转)
转载于http://blog.csdn.net/csh159/article/details/8127280 使用的是java里面的反射机制: dialog = new AlertDialog.Bui ...
- Atitit 大龄软件工程师的出路attilax总结
Atitit 大龄软件工程师的出路attilax总结 1.1. 创业vs打工 联合创始人 合伙人1 1.2. 项目管理 架构师1 1.3. 软件培训 讲师2 1.4. 研究院研究员2 1.5. 继续博 ...
- Java Web(六) EL表达式
这也是属于JSP范围内的知识,使用EL表达式,能更好的使用JSP中的各种内置对象和作用域,说点闲话,马上要出去实习了,有点恐慌,可能这是马上要出去工作的学生的通病,继续努力把,兵来将挡水来土掩, -- ...
- Vivado中debug用法
Vivado和ISE相比ChipScope已经大幅改变,很多人都不习惯.在ISE中称为ChipScope而Vivado中就称为in system debug.下面就介绍Vivado中如何使用debug ...