Reset MySQL Password - Mac - mysql

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..

Related

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

mysql setup issue on Mac system

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.

MY SQL help - ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)

I am trying to copy an SQL database from the folder using this command:
sudo mysql -u root globe_bank
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
sudo mysql -u root -p globe_bank
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
I rang apple support and we changed the password of the root directory, they confirmed it was successful still getting this message. I have tried a few of the suggestions on similar threads, and mostly I get command not found.
When I type in mysql my connection ID is 19.
Any ideas or help is appreciated
I have faced the same issue on mysql Ver 15.1 on Amazon Linux 2 and the following worked for me:
Try entering the password on the same line.
I.e. instead of $mysql -u root -p, pressing Enter and then entering password after the prompt, do this:
$mysql -u root -p\<password>
Remember there is no "space" between -p and \<password>, I think you have got a space there!

Reset mysql root pass

I've been trying to reset the password for MySQL but all of the solutions I've found, nothing seems to work. I'm using OSX Yosemite with MAMP and MySQL 5.6.20
I attempted to reset the password via MAMP to pass but it does not work
$mysql -u root -p
Enter password: pass
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
$
and none of this works
$mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
$mysql -u root
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
$mysql -u root#localhost
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 62
Server version: 5.6.20 Homebrew
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use magento
ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'magento'
mysql> SET PASSWORD FOR 'root' = PASSWORD('pass');
ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'mysql'
mysql> SET PASSWORD FOR 'root'#'localhost' = PASSWORD('pass');
ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'mysql'
mysql> SET PASSWORD FOR 'root'#'::1' = PASSWORD('pass');
ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'mysql'
You can stop mysql server and restart it with --skip-grant-tables option. That way it doesn't look at credentials when opening up a mysql shell
After that,
mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass')
-> WHERE User='root';
mysql> FLUSH PRIVILEGES;
Stop mysql server, and start it again
Just adding some details to Justin’s Kiang answer (which help me, thanks!).
On my OS X Machine:
sudo /usr/local/mysql/support-files/mysql.server stop
sudo /usr/local/mysql/support-files/mysql.server start --skip-grant-tables
mysql -u root
and then the SQL code as per Justin’s answer:
UPDATE mysql.user SET Password=PASSWORD('newpassword') WHERE User='root';
FLUSH PRIVILEGES;
bye
And restarting the MySQL server again:
sudo /usr/local/mysql/support-files/mysql.server stop
sudo /usr/local/mysql/support-files/mysql.server start
Adjust your path to mysql folder if needed.

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