Ask Your Question
0

How change password mysql

asked 2016-04-25 15:29:48 -0500

Orest gravatar image

Hi i installed mariadb from guide http://docs.openstack.org/mitaka/install-guide-obs/environment-sql-database.html (http://docs.openstack.org/mitaka/inst...) but when i want pass to next step --> mysql_secure_installation i got error 10 45 (2800); Access denide for user 'root'@'localhost' (using password : No) this is fresh installed mariadb and i don't set up any password i try change it with this http://tecadmin.net/steps-to-reset-mariadb-root-password-in-linux/ (http://tecadmin.net/steps-to-reset-ma...) but still not working any idea what im doing wrong ?.

I work on opensuse Leap 42.1

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
0

answered 2016-04-25 17:48:27 -0500

Indradev gravatar image

First of all I am not sure which OS are on ON. But I assume you are on Ububtu as that is the major used OS for Open Stack.

We usually provide root password during the installation and configuration of MariaDB.

#apt-get install mariadb-server python-mysqldb

As you are at start of installation Pleae check if you have entered the correct passowrd or to simply resolve perform a clean install of MariaDB.

edit flag offensive delete link more
0

answered 2016-04-26 03:48:06 -0500

Hi, at normal situation during first running the mysql has a blank password and propose it to set.

# mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

If you still have no access the mysql password can reset quite easily:
Define mysql user:

ps aux | grep sql

create file like:

echo "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123qwe'); > /var/log/mysql.reset

set correct permissions:

chown mysql:mysql /var/log/mysql.reset

start mysql:

sudo -u mysql mysqld_safe --init-file=/var/log/mysql.reset &

login to mysq:

mysql -u root -p
Enter password: 123qwe
exit;

Stop all mysql processes and start server normally.
Full instruction you can find there: http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html (http://dev.mysql.com/doc/refman/5.7/e...)

Good luck.

edit flag offensive delete link more
0

answered 2016-04-25 23:25:16 -0500

updated 2016-04-25 23:26:42 -0500

I am not sure if this will work, but as the mariadb server gave error (using password: NO) you must first enter the root user and create a password for the same.

$ MySQL -u root

This shouldn't ask for password but if it does try leaving it blank. You should be into the root MySQL user

MYSQL>

Try the following commands to change password:

update user set password=PASSWORD("NEWPASSWORD") where User='root';

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');

Note: 'MyNewPass' should be your password in plain text.

edit flag offensive delete link more

Comments

No it not work for me when i type mysql -u root it demad password

Orest gravatar imageOrest ( 2016-04-26 01:14:52 -0500 )edit

Just hit enter leaving it blank

computeforce gravatar imagecomputeforce ( 2016-04-27 00:52:47 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2016-04-25 15:29:48 -0500

Seen: 1,491 times

Last updated: Apr 26 '16