mysql/mariadb root user get ERROR 1045 (28000): Access denied without sudo
2015-08-07 23:28
579 查看
http://ubuntuforums.org/showthread.php?t=2275033
Thanks for
sergerod &
nerdtron
I had fixed my problem.
What I did is to combine their commands.
Do nerdron's answer first.
Here's what I did and saved my MariaDB.
Stop mysql:
1. /etc/init.d/mysql stop and killall -9 mysqld
Make sure no mysqld is exist.
Run mysql with skip grants to be able to login without any password
2. mysqld_safe --skip-grant-tables &
Login as root
3. mysql -u root
then is sergerod's.
[mysql] use mysql;
[mysql] update user set password=PASSWORD("NEW-ROOT-PASSWORD-HERE") where User='root'; # first reset root password, in case you set root password before
[mysql] update user set plugin='' where User='root'; # then set plugin as null
[mysql] flush privileges;
[mysql] \q or exit
and then:
/etc/init.d/mysql stop (or service mysql stop) andkillall -9 mysqld
and start the mysql thru
service mysql start or /etc/init.d/mysql restart
and all is done!
Also I made a script, please go to http://zhxq.io/?p=99
and I tested my script, it is functional.
It's hard to stop mysqld by the script...... so the script sometimes doesn't work (rarely).
All in all, thanks dude!
Thanks for
sergerod &
nerdtron
I had fixed my problem.
What I did is to combine their commands.
Do nerdron's answer first.
Here's what I did and saved my MariaDB.
Stop mysql:
1. /etc/init.d/mysql stop and killall -9 mysqld
Make sure no mysqld is exist.
Run mysql with skip grants to be able to login without any password
2. mysqld_safe --skip-grant-tables &
Login as root
3. mysql -u root
then is sergerod's.
[mysql] use mysql;
[mysql] update user set password=PASSWORD("NEW-ROOT-PASSWORD-HERE") where User='root'; # first reset root password, in case you set root password before
[mysql] update user set plugin='' where User='root'; # then set plugin as null
[mysql] flush privileges;
[mysql] \q or exit
and then:
/etc/init.d/mysql stop (or service mysql stop) andkillall -9 mysqld
and start the mysql thru
service mysql start or /etc/init.d/mysql restart
and all is done!
Also I made a script, please go to http://zhxq.io/?p=99
and I tested my script, it is functional.
It's hard to stop mysqld by the script...... so the script sometimes doesn't work (rarely).
All in all, thanks dude!
相关文章推荐
- Ubuntu安装MariaDB
- centOS 7.1.1503 搭建Apache+Mariadb+PHP环境
- MariaDB的GTID复制和多源复制
- MariaDB与MySQL的主从复制效率对比
- Install MariaDB Galera Cluster 10.0.20
- 在Ubuntu 14.04上安装MariaDB
- MariaDB之与MySQL的兼容性比较
- FTP使用MariaDB完成虚拟用户认证
- centos7 下安装Apache2+MariaDB+PHP5过程详解
- centos6.6下编译安装mariadb-10.0.20
- Centos6.5 安装 MariaDB-10.0.20-linux-x86_64.tar.gz
- MariaDB+keepalived
- MySQL/MariaDB的备份与恢复
- mariaDB存储过程与触发器
- centos7 mariadb ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)
- Mariadb开源数据库
- mariaDB 创建存储过程时报错
- Mysql/Mariadb备份
- MySQL/MariaDB的索引使用
- centos7 高速安装 mariadb(mysql)