I don’t remember my MySQL root password used in 'Bitnami WordPress Stack' (wordpress-5.4.2-0) in Linuy-Mint and tried the steps described here:
https://docs.bitnami.com/installer/apps/wordpress/administration/change-reset-password/
explicitly:
nano installdir/mysql/tmp/mysql-init
and saved it with:
ALTER USER 'root'#'127.0.0.1' IDENTIFIED BY 'NEW_PASSWORD';
then i restarted the MySQL server via Bitname App installdir/manager-linux-x64.run
i expected to be able in:
http://127.0.0.1:8080/phpmyadmin/index.php
with user root and NEW_PASSWORD but get then this error-message:
mysqli::real_connect(): (HY000/1045): Access denied for user 'root'#'localhost' (using password: YES)
This way is different to suggestions on: Bitnami. reset mysql root pwd
i tried also:
~/wordpress-5.4.2-0/mysql$ service mysql reset-password
mysql: unrecognized service
~/wordpress-5.4.2-0/mysql$ sudo dpkg-reconfigure mysql-server-x.x
and get the same errors in phpmyadmin.
if i use:
sudo /usr/bin/mysqld_safe --skip-grant-tables & mysql -h localhost
it got
Command 'mysql' not found, but can be installed
but of course its installed.
Related
I enter mysql -u root -p and put in my password and get this error, I have uninstalled and reinstalled mysql and changing the password for root but still get this message.
I have looked and looked for solutions but nothing seems to work.
I am trying to enter mysql through my terminal, instead I get get the error above and can't get into mysql even after uninstalling and reinstalling it.
Usually this means that you are using the wrong credentials to connect, try to consult consult the general log file /var/log/mysqld.log to copy the initialization password.
if that doesn't work you can try this approach:
check if MySQL is installed and running on your system sudo service mysql status
Reset the root password:
stop the server: sudo /etc/init.d/mysql stop
start the server in safe mode: sudo mysqld_safe --skip-grant-tables &
try to connect: mysql -u root
reset the root password: UPDATE mysql.user SET authentication_string=PASSWORD('newpassword'), password_expired='N' WHERE User='root';
flush privileges: FLUSH PRIVILEGES;
quit the server: quit
stop the safe mode server: sudo /etc/init.d/mysql stop
now you can start the MySQL server again: sudo /etc/init.d/mysql start
Use the correct credentials to connect (with the new password)
check out previous answers to this problem here and here.
I am trying to install mysql in my macbook pro (OS version: 10.15.2).
These are the steps I followed
Install mysql community server from this link
Install mysql workbench from this link
Open mysql from system preferences and click initialize database
set password for root user under initialize database
open .bash_profile through terminal and set path for mysql
export PATH=${PATH}:/usr/local/mysql/bin/
restart terminal to start mysql server with the following command
mysql -u root -p
enter the password set for root user from step 4
After all this I get the following error
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
Not sure what I am doing wrong.
This is the video I followed to install mysql in my system
[EDIT 1]
staring server with -skip-grant-tables
sudo mysqld_safe --skip-grant-tables
OUTPUT
2020-02-25T05:27:00.6NZ mysqld_safe Logging to '/usr/local/mysql/data/SASHAANKs-MacBook-Pro.local.err'.
2020-02-25T05:27:00.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
2020-02-25T05:27:02.6NZ mysqld_safe mysqld from pid file /usr/local/mysql/data/SASHAANKs-MacBook-Pro.local.pid ended
I believe the default authentication mechanism in MySQL 8 is auth socket. Try setting the root password like this:
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'my_password';
More on this here: https://www.percona.com/blog/2016/03/16/change-user-password-in-mysql-5-7-with-plugin-auth_socket/
If you can't access the CLI interface at all you should try manually resetting the root password as outlined here: https://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html
Restart the mysql server with the --skip-grant-tables option.
Connect to the CLI (no password should be necessary)
FLUSH PRIVILEGES;
Reset root password as described above: ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'my_password';
Restart mysql normally
How do I change the MySQL root password in ubuntu server via a file?
The file may be any shell script or normal text file.
My try:
Normally the below command, in the terminal, changes the password for newly installed mysql.
mysqladmin -u root password 'newpass'
But while doing it via file it's showing the bellow error.
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'#'localhost' (using password: NO)'
So can someone help me to do so.
Stop the MySQL Server: sudo /etc/init.d/mysql stop
Start the mysqld configuration: sudo mysqld --skip-grant-tables
Login to MySQL as root: mysql -u root mysql
Replace YOURNEWPASSWORD with your new password:
UPDATE
mysql.user
SET
Password = PASSWORD('YOURNEWPASSWORD')
WHERE
User = 'root';
FLUSH PRIVILEGES;
exit;
Note: This method is not regarded as the most secure way of resetting the password, however, it works.
If you have never assigned a root password for MySQL, the server does not require a password at all for connecting as root follow :
Resetting Permissions
I'm logged into a CentOS server and I want to view all mysql databases. So I switched to the Linux root user and I tried logging into mysql. Normally (on other servers) I do this with a simple mysql command, but here I get an access denied:
[root#our.server.com kramer65]# mysql
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
I suppose that if I'm root on Linux I can do anything I want. Is there a way that I can show all Mysql databases as Linux root user?
From this you can log into your DB as linux root: if restarting servvices is an option:
https://www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password
sudo systemctl stop mysql
sudo mysqld_safe --skip-grant-tables --skip-networking &
mysql -u root
Then the usual apply:
mysql>SHOW DATABASES;
The system root user is not the same as the root mysql user, and it's possible the system user has no access.
You can give the username to mysql with
mysql -u root -p
and enter the password for the mysql root user.
You can use the same command to connect with any mysql user account that is valid within mysql.
I installed MySQL using the following command:
sudo apt-get install mysql-server mysql-client mysql-common
It asks me for a root password (On package configuration), I enter one and confirm it.
sudo /etc/init.d/mysql start
However when I try logging in to mysql with user root and password which I supplied in the previous step, it denies me access:
root#mbilwebh02:/etc# > mysql --user root --password
Enter password:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES).
Another attempt that I made was to uninstall and reinstall mysql without supplying a password but that fails as well.
I then switched the user on the server to mysql
root#mbilwebh02:/etc# sudo -u mysql -s
root#mbilwebh02:/etc# sudo -u mysql -s
bash: /root/.bashrc: Permission denied
mysql#mbilwebh02:/etc$ mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
At this point I am able to only start and stop mysql. Any ideas where I might be going wrong?
[EDIT]
After searching a lot I found that one can log in to mysql using debian-sys-maint as user and password which is in the debian.cnf file. There was no 'root' user in the mysql database hence everything I tried denied me access.
I do not know if this is a safe way to do it though.
Taken from: http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
Stop mysqld and restart it with the --skip-grant-tables option. This enables anyone to connect without a password and with all privileges. Because this is insecure, you might want to use --skip-grant-tables in conjunction with --skip-networking to prevent remote clients from connecting.
Connect to the mysqld server with this command:
shell> mysql
Issue the following statements in the mysql client. Replace the password with the password that you want to use.
mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass')
-> WHERE User='root';
mysql> FLUSH PRIVILEGES;
The FLUSH statement tells the server to reload the grant tables into memory so that it notices the password change.
You should now be able to connect to the MySQL server as root using the new password. Stop the server, then restart it normally (without the --skip-grant-tables and --skip-networking options).