MySql resets user password after restarting mysql server - mysql

Well, actually it is mariadb, but to start its client, I need to enter "mysql" in command line.
Anyway, after entering
mysql --user=root
Note, that at this time "root" doesn't have a password, so I successfully login and then:
SET PASSWORD FOR 'root'#'localhost' = PASSWORD('my_pass');
And it works, from now on I have to use "my_pass" to login.
But then I do:
sudo service mysql restart
And from now on, root's password is again reseted to "no password at all".
And again, to login I can't give any password.
Googling this doesn't help, because most articles are about "how to reset user password" :)

Well, I managed to solve my problem - if anybody's interested you have to do:
flush privileges
After changing passwords.

Related

Just installed MySQL. Unable to use any commands. Unknown root password

I tried following this post:
How can I rework my MySQL password so that I can rake db: create on rails?
As it most closely addresses my problem except the answers aren't specific/detailed enough i.e. I am a huge newbie and don't know what commands to run.
This is my problem:
:~/myapp$ rake db:create
Access denied for user 'todallyrad'#'localhost' (using password: YES)Please provide the root password for your mysql installation.
I don't know the root password or how to change it. I got started trying to follow this:
https://gorails.com/setup/ubuntu/14.04
But got stuck at the very end. I tried doing the suggested change of the database.yml file using VIM but that didn't work either.
The default root password for MySQL is no password. Either edit your database.yml file, enter root as user, leave password blank. Or use mysql command line console to create a user with password. And add a root password.
You may change your root password as per below:
STOP mysql service
sudo /etc/init.d/mysql stop
sudo mysqld --skip-grant-tables &
Login into mysql DB using root user
mysql -u root mysql
Set password for your root user
UPDATE user SET Password=PASSWORD('YOURPASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit;
use root as username and leave password blank for the first time and then when you are log in, you can add account for database connection.

I don't know my server's mysql admin password

Hi I will repair my tables in ssh but it want mysql admin password.
Admin password different then my plesk admin or root password.
I did't change admin mysql password.
/usr/local/psa/bin/admin --show-password this password isn't work
I want to get password or change but I don't know it.
I'm using plesk if I change password direct at mysql.users probably I cant login plesk.Is it wrong?
Please help me how can get or change this password?
http://i.stack.imgur.com/xz6Mr.png
You can use string stored in /etc/psa/.psa.shadow as mysql user admin password.
For example, to upgrade mysql tables try this command:
# mysql_upgrade -uadmin -p`cat /etc/psa/.psa.shadow`
I'm using plesk if I change password direct at mysql.users probably I cant login plesk.
It's true.

Reset MySQL root password to "default" - MAMP

I changed my root level password on phpMyAdmin. I was unsure where to enter the password itself, as it did not give me the option (login form). I wondered if it was the php.ini file but users with read privileges could read it if I placed the password in there.
Now, the mysql doesn't run as I tried various online resources to fix the problem. If needs be I would delete mamp and re-install but I do not want to lose my database files. Ideally I would revert the password to default, which I believe was nothing, except now I cannot connect to phpmyadmin, or the mamp start page:
Error: Could not connect to MySQL server!
Any help would be great.
UPDATE -
Error message from mamp:
/Applications/MAMP/Library/bin/mysqlcheck: Got error: 1045: Access denied for user 'root'#'localhost' (using password: YES) when trying to connect
This seemed to have fixed it when using terminal to reset the password:
/Applications/MAMP/Library/bin/mysqladmin -u root -p password newpassword
Found on mamp faq.
Look in the files:
checkMysql.sh
quickCheckMysqlUpgrade.sh
repairMysql.sh
stopMysql.sh
The important one in this case is "quickCheckMysqlUpgrade.sh".
All the files are located in the /Applications/MAMP/bin/ directory.
In these files you'll find something like
# /bin/sh
/Applications/MAMP/Library/bin/mysqlcheck --quick --check-upgrade -u root -proot --socket=/Applications/MAMP/tmp/mysql/mysql.sock mysql
When you see -proot that is the password MAMP will try to use,
-p{password}.
-p means "password" and whatever comes after is the password.
So change "-proot" to eg. "-pmysecret" or whatever your password is.
I was being annoyed by the startup "access denied" error MAMP would show, even though I was able to access my site using phpMyAdmin or other SQL tools. I even found/updated the password in checkMysql.sh, repairMysql.sh, and upgradeMysql.sh. I did not notice the script called quickCheckMysqlUpgrade.sh and correcting the password in that fixed the startup error for me.
I just solved this issue on my MBP!
In MAMP Pro (v352), go to the MySQL tab and press "Change Password".

Phpmyadmin - Mysql no privileges

I installed wamp 2.1 on windows 7. However when i open phpMyAdmin, I get the error, Mysql 'No Provileges'. I uninstalled wamp and reinstalled it a few times, but it doesn't help. Does anyone know how to solve this issue?
Also, when i tried creating a database from mysql console, i am getting the following error:
ERROR 1044 <42000>: Access denied for user ''#'localhost' to database 'a_db_name'
Thank God and to all helped.
Its simple.
Must! click logout icon in phpadmin page
In login page, type:
username:root password: (blank)
surprise. now you can happily create your database.
Are you logging into MySQL as root? You have to explicitly grant privileges to your "regular" MySQL user account while logged in as MySQL root.
First set up a root account for your MySQL database.
In the terminal type:
mysqladmin -u root password 'password'
To log into MySQL, use this:
mysql -u root -p
Edit:
To set the privileges manually start the server with the skip-grant-tables option, open mysql client and manually update the mysql.user table and/or the mysql.db tables. This can be a tedious task though so if what you need is an account with all privs I would do the following.
Start the server with the skip-grant-tables option
Start mysql client (without a username/password)
Issue the command
flush privileges;
which forces the grant tables to be loaded.
Create a new account with the GRANT command something like this (but replacing username and password with whatever you want to use.
GRANT ALL on *.* to 'username'#'localhost' identified by 'password';
Restart the server in normal mode (without skip-grant-tables) and log in with your newly created account.
Refer this MySQL docs.
Take a look at my topic regarding this issue, which takes some of the above.
MAMP mysql broken root user
You need to shutdown your mysql install and restart it from the command line properly like is indicated above. In my topic I have full clear instructions on how to do so. My instructions are for MAMP but you should be able to adapt it for your install.
Simple solution. Just find the icon right to "home" in PhpMyAdmin and click to logout. Then login using username "root" and password ""(blank). This will work accordingly.
username ought to be root and keep the password null(keep the password field blank)
right click on the wamp icon and goto mysql console.
Login with password if you have set any.By default the password is blank and username is 'root'
Once you are in mysql prompt execute
FLUSH PRIVILEGES;
now quit the command prompt and you are good to go.
in step 1 .inter your databasevery important.
in step 2 .select your database via all tables .
in step 3. backup type=replace & export.
in step 4 import database in my sql.
attention please:in import your database...
all table must view & selected in step 4.

How to reset MySQL root user password and privileges

I assigned a password to the root MySQL user in XAMPP some times ago. I recently tried to undo that and give it no password but it's not working.
I tried setting the password to an empty string using mysqld --skip-grant-tables and then using the mysql command line directly. It looks like it works, the root user no longer has a password, however if I login in PhpMyAdmin I cannot see any of my databases, only an "information_schema" and a "test" database. If I look at the User tab, it seems to have all the privileges though:
Any suggestion on how to fix this issue?
Note: I checked with the command line, all my databases and tables are still there, I just cannot see them in PHPMyAdmin.
Try removing the anonymous user who is allowed to connect from any host. My feeling is that that row is taking precidence over the row for root when MySQL validates the login.
If you have removed that Anonymous user and the issue still occurs, try setting a password to root and the host to localhost then connect again.