Hi guys, I am very new to using a service like nguyenminhchau.com (opposed to a one click setup of mediatemple or godaddy) and I am trying to setup and configure a new DB using MySQL but I keep getting the error
ERROR 1045 (28000): Access denied for web1_user “root”
“localhost” (using password: YES)I have googled this, and searched the community for answers but cannot seem to solve this issue. Am I missing something? I have tried running it as root, and running it with sudo through another web1_user and cannot get around it. If I offer no password it gives the same error but instead of using password: YES, it’s NO.
Thanks.
Đang xem: Fixing Mysql 1045 Error: Access Denied
Join the nguyenminhchau.com Community
Join 1M+ other developers and:
Get help and share knowledge in Q&ASubscribe to topics of interestGet courses & tools that help you grow as a developer or small business owner Join Now
Install MySQL on New Droplet Question
How can I solve error “SQLSTATE
Am using Ubuntu-16.04 : installed mysql – 5.7. I Had the same issue.
Tried the below steps:
dpkg –get-selections | grep mysql (to get the version of mysql).
dpkg-reconfigure mysql-server-5.7
mysql -u root -p
Without -p that doesn’t prompt you to ask password. Once you are in, you can create a web1_user with a password by following steps :
CREATE USER ’-your_name-’
‘your-hostname’ IDENTIFIED BY “your-password’;
GRANT ALL PRIVILEGES ON . to ’-your_name-’
“your-hostname’ WITH GRANT OPTION;
Exit from the root and login from the you gave above.
mysql -u -p
For some reason still just typing mysql does not work. AT ALL. Please let me know if this works, else I have other steps.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Which one-click-setup did you use? You can check the configuration files probably and find the password. If you can’t find it, neither root without pass is working you can reset it:
Commands
sudo /etc/init.d/mysql stopNow start up MySQL in safe mode, so you’ll skip the privileges table:
sudo mysqld_safe –skip-grant-tables &Login with root:
mysql -urootAnd assign the DB that needs to be used:
use mysql;Now all you have to do is reset your root password of the MySQL web1_user and restart the MySQL service:
update web1_user set password=PASSWORD(“YOURPASSWORDHERE”) where User=”root”;flush privileges;quit and restart MySQL:
quitsudo /etc/init.d/mysql stopsudo /etc/init.d/mysql startNow your root password should be working with the one you just set, check it with:
mysql -u root -pHope this will help you figure it out.
Reply Report
0
Gopichand March 2, 2017
it’s working. But after logout my mysql again it will be showing same ERROR ? So plzzzz Help ME !!!!
Reply Report
4
gvionut November 29, 2016
On MySql 5.7 version you must replace query to:
update web1_user set authentication_string=PASSWORD(“YOURPASSWORDHERE”) where web1_user=”root”; everything else it’s like CrypticDesigns described..
Reply Report
0
Woet December 3, 2015
Use the right password.
Reply Report
0
paulchabot January 21, 2016
I was tripped up on a brand new installation of mysql. There will be a temporary root password created and logged in /var/log/mysqld.log check there and once mysql is started (as a service) you can then start mysqlsecureinstallation and use the password from the log file to setup mysql.
Reply Report
0
prakashluitel88 February 8, 2016
Thanks CrypticDesigns. It worked well for me.
Reply Report
0
rfloresvqz May 3, 2016
It worked for me. Thanks
Reply Report
0
Seavet June 4, 2017
I have the same problem as described above on my Ubuntu 16.04 LTS/MySQL 5.7.18/WordPress droplet, with 2 CPU, 40GB SSD and 16GB RAM. The droplet is only running one site and has hardly any traffic because it is still under development.
I cannot connect via ‘mysql -u root -p’.I cannot use the “sudo mysqlsecureinstallation’ script.Every time after entering the password I get the dreaded “Access denied for web1_user “root’
“localhost’ (using password: YES)” error message.
This seems to be a very common problem. I followed all the usual recommendation, such as reinstalling MySQL, with and without prior uninstall, crossgrading to MariaDB and back to MySQL, all to none avail. What am I doing wrong?
Btw, the WordPress site is working fine. The problem only became apparent when I added Moodle to the installation and got stuck at the point where you need to create the moodle tables. Since I cannot log into the MySQL server, I’m now stuck.
Reply Report
0
rushmith June 21, 2017
Installed mysql – 5.7. I Had the same issue.
Tried the below steps:
1. dpkg –get-selections | grep mysql (to get the version of mysql).
2. dpkg-reconfigure mysql-server-5.7
3. mysql -u root -p
Without -p that doesn’t prompt you to ask password. Once you are in, you can create a web1_user with a password by following steps :
CREATE USER ’-your_name-’
‘your-hostname’ IDENTIFIED BY “your-password’;
GRANT ALL PRIVILEGES ON . to ’-your_name-’
“your-hostname’ WITH GRANT OPTION;
Exit from the root and login from the you gave above.
mysql -u -p
For some reason still just typing mysql does not work. AT ALL. Please let me know if this works, else I have other steps.
Reply Report
0
anjali505 October 31, 2017
after step 3 it gives Can’t connect to local MySQL server through socket ’/var/run/mysqld/mysqld.sock’ (2)
what to do??
Reply Report
0
uncersh October 29, 2018
I used mysql -u root -p and enter password and got working.
Reply Report
0
rawhasanweb July 28, 2020
I am also new in nguyenminhchau.com and was following this article to setup a LEMP server: https://www.nguyenminhchau.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-20-04
I was having trouble on the last step. I was unable to connect to the database using the php script. It was showing the following error:
“Error!: SQLSTATE
I was able to log-in from the terminal using the same credential and was able to see the records on the table, but the php script was showing the connection error for the same credential, which was weird!
After searching all the posts on stackoverflow, found no solution for this. Finally don’t know why, I ran the php file from the terminal like this instead of the browser:
‘php /var/www/yourdomain/todolist.php’
which was showing me an error on line 3, which was the line with the password. It was telling me something like an empty value and indicating the last 2 characters of the password. I then noticed that in my password, before these last two characters, I have a “$” sign, which is the reserved symbol in php to indicate a variable!
Related posts
Hướng Dẫn Ghost Bằng Acronis True Image 2017, Cách Ghost Máy Tính Bằng File *
Đầu tiên mình cần nói trước với các bạn rằng đây là một bài viết bổ sung thôi, tức...
Các Hướng Dẫn Tạo Usb Boot Ghost Để Để Ghost Lại Máy Tính, Cách Tạo Usb Ghost Để Boot Ghost Máy Tính
Bạn đang xem bài viết Cách tạo USB Ghost để Boot Ghost máy tính của nguyenminhchau.com. Cùng Aloocw tham...
Tài Liệu Hướng Dẫn Ghost Win 7 Bằng Hình Ảnh, Tài Liệu Hướng Dẫn Bung Ghost Win 7 Bằng Hình Ảnh
ghost win 7 64bit là một trong những keyword được search nhiều nhất trên google về chủ đề ghost...
Hướng Dẫn Khi Đăng Ký Tên Miền Quốc Tế Là Gì? Vòng Đời Của Tên Miền Quốc Tế
Bao lâu nay chúng ta vẫn luôn đặt ra các câu hỏi như “Các đuôi tên miền phù hợp...
Khôi Phục Phân Vùng Ổ Cứng Do Ghost Nhầm ? Làm Gì Để Phục Hồi Dữ Liệu Bị Ghost Nhầm
Bạn thực hiện thao tác Ghost lại máy để hệ thống hoạt động ổn định và tăng tốc hơn....
Đăng Ký Đăng Nhập Trợ giúp Sơ đồ website Giới thiệu chung Ban quản trị Thương hiệu Chiến lược...