mysql setup issue on Mac system - mysql

I have install mysql using command brew install mysql. After that set password for root. still I am not able to login in mysql shell
brew install mysql
sheetal$ mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
sheetal$ mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
sheetal$ sudo mysql -uroot -p
Password:
Enter password:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
sheetal$ mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:
Error: Access denied for user 'root'#'localhost' (using password: YES)

Seems you forgot your password. To reset the root password, you need to start your mysql server with --skip-grant-tables option. This allows you to log in to your mysql console without any password.
$mysql.server start --skip-grant-tables
$mysql
mysql> FLUSH PRIVILEGES;
mysql> ALTER USER 'root'#'localhost' IDENTIFIED BY 'newpassword';
mysql> quit;
$mysql.server restart
Now you should be able to log in with your newpassword.
There're other ways to do this but I find this to be the easiest.

Related

Access denied after installing mysql on ubuntu

I've been try to install mysql on my Ubuntu 22, considering that i follow some code from my instructor like this o
sudo mysql
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
FLUSH PRIVILEGES;
quit
After that i try to re open mysql and showing error like this
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
what should i do?
Mysql -u - p
After that you please input your password

permission denied for root user in mysql

I have accidentally did some thing in MySQL database and broke MySQL.
:~# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
:~# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
tried all the possible solution but still couldn't able to login to MySQL.
I have tried reinstall the package still same error.
Seems like you haven't configured mysql completely, try:
mysql_secure_installation

Reset MySQL Password - Mac

I forgot my MySQL password.
I'm using MySQL 5.7 on a Mac.
When I use mysql -u root I get the following error:
ERROR 1045 (28000): Access denied for user 'jan'#'localhost' (using
password: NO)
Things I've tried without success:
Setting the password:
Option 1:
mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
Getting the following error after mysql -u root:
ERROR 1045 (28000): Access denied for user 'jan'#'localhost' (using
password: YES)
Option 2
/usr/local/mysql/bin/mysqladmin -u root password NEW_PASSWORD_HERE
Change root password
cd /usr/local/mysql/bin/
./mysql -u root -p
> Enter password: [type old password invisibly]
use mysql;
update user set password=PASSWORD("NEW_PASSWORD_HERE") where User='root';
flush privileges;
quit
Getting the following error after ./mysql -u root -p:
ERROR 1045 (28000): Access denied for user 'jan'#'localhost' (using
password: NO)
Resetting the password according to the MySQL manual
sudo mysqld_safe --skip-grant-tables
When I use mysql I'm getting the following error:
ERROR 1045 (28000): Access denied for user
'jan'#'localhost' (using password: NO)
I also tried uninstalling MySQL from my Mac and reinstall it.
It's impossible for me to come any further without a password..

MySQL Access Denied even for SuperUser - ERROR 1045 (28000)

I failed to run MySQL on my machine. I didn't set password for MySQL, if I am not wrong.
I have done the following series of actions, including 1) running as user, 2) running as SuperUser, 3) running without password, and 4) running with the user password.
As you can see, I failed all of them. Why is it so?
abc#ubuntu:~$ mysql
ERROR 1045 (28000): Access denied for user 'abc'#'localhost' (using password: NO)
abc#ubuntu:~$ sudo su
[sudo] password for abc:
root#ubuntu:/home/abc# mysql
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
root#ubuntu:/home/abc# mysql -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
root#ubuntu:/home/abc# mysql -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
root#ubuntu:/home/abc#
If you are not sure about your current password, set a new password:
# mysqladmin -u root password 'new-password'
then log in with your new password:
# mysql -u root –p

I can't access mysql ERROR: 1045(28000)

I had installed lamp server in my Ubuntu 12.04 box when I tried to access MySQL I got this bug
ERROR 1045(28000) I tried many solution available in the internet nothing works.
These are all my bash scripts I had tried to access it :
root#sampath-codyowl:~# mysql -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
root#sampath-codyowl:~# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
First try this
mysql -h 127.0.0.1 -u root -p
If that worked then add root#localhost
GRANT ALL PRIVILEGES ON *.* TO root#localhost IDENTIFIED BY 'root-password' WITH GRANT OPTION;
Other reasons:
Check if there is a firewall blocking your mysql port(mysql default is 3306)
Make sure that the server has not been configured to ignore network connections. look for --skip-networking, or --bind-address flags.
Check this article : http://dev.mysql.com/doc/refman/5.0/en/access-denied.html