I’ve set up mysql and phpmyadmin and chose not to set a password when installing hoping that once set up i could login with root and no password but i get the following error from phpmyadmin:
Login without a password is forbidden by configuration (see AllowNoPassword)
I have previously moved the phpmyadmin folder to /var/www/
I have tried changing the following line
$cfg['Servers'][$i]['AllowNoPassword'] = false;
to
$cfg['Servers'][$i]['AllowNoPassword'] = true;
but still had no success, so i am wondering is there a way i can change the root passwords for both so i can access phpmyadmin and create databases.
Rinzwind
288k39 gold badges561 silver badges701 bronze badges
asked Apr 4, 2012 at 5:15
1
You can change the mysql root password by logging in to the database directly (mysql -h your_host -u root) then run
SET PASSWORD FOR root@localhost = PASSWORD('yourpassword');
phpmyadmin should use that password so not quite sure what you mean by «for both».
Make sure to set the new password into phpmyadmin’s config.inc.php too, at line
$cfg['Servers'][$i]['password'] = 'yourpassword';
Otherwise, phpmyadmin may not work, echoing
Access denied for user 'user'@'localhost' (using password: YES)
answered Apr 4, 2012 at 6:00
geermc4geermc4
1,4931 gold badge13 silver badges20 bronze badges
4
It depends on your configuration.
Follow the instruction below to reconfigure phpmyadmin, and reset MySQL password.
- Ctrl + Alt + T to launch terminal
sudo dpkg-reconfigure phpmyadmin- Connection method for MySQL database for phpmyadmin: unix socket
- Name of the database’s administrative user:
root - Password of the database’s administrative user: mysqlsamplepassword
- MySQL username for phpmyadmin: root
- MySQL database name for phpmyadmin: phpmyadmin
- Web server to reconfigure automatically: apache2
- ERROR 1045
- ignore
sudo dpkg-reconfigure mysql-server-5.5- New password for the MySQL «root» user: mysqlsamplepassword
- Repeat password for the MySQL «root» user: mysqlsamplepassword
-
After all this run following command on terminal to secure your mysql server.
sudo mysql_secure_installation -
Enter current password for root (enter for none): mysqlsamplepassword
- Change the root password? [Y/n] n
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y
Wish it helps!
Have a nice day!
Anwar
74.8k31 gold badges189 silver badges306 bronze badges
answered Aug 13, 2012 at 7:30
Amigo ChanAmigo Chan
6977 silver badges6 bronze badges
2
I recently came across this very same issue Ubuntu 12.04. I just couldn’t seem to login with root & no password. I set the AllowNoPassword setting to TRUE in the config. Later I found out that I was editing the wrong config.inc.php file to add the AllowNoPassword setting.
Edit:
/etc/phpmyadmin/config.inc.php
Not:
/usr/share/phpmyadmin/config.inc.php
I believe the first is the debian local config file, which will override the usr version.
answered May 31, 2012 at 1:20
jjwdesignjjwdesign
3101 silver badge12 bronze badges
1
At first run this command:
sudo mysql
and then you should check which authentication method of your MySQL user accounts use.So run this command
SELECT user,authentication_string,plugin,host FROM mysql.user;
now you can see something like this already :
+------------------+-------------------------------------------+-----------------------+-----------+
| user | authentication_string | plugin | host |
+------------------+-------------------------------------------+-----------------------+-----------+
| root | | auth_socket | localhost |
| mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |
| mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |
| debian-sys-maint | *CC744277A401A7D25BE1CA89AFF17BF607F876FF | mysql_native_password | localhost |
+------------------+-------------------------------------------+-----------------------+-----------+
in the table that is in the above , you can see that all of your mysql users accounts status & if you have set a password for root account before you see mysql_native_password in plugin column instead auth_socket.
All in all for change your root password you should run :
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Be sure to change password to a strong password of your choosing.
Then for reload your server to put your new changes into effect run this;
FLUSH PRIVILEGES;
So again check the authentication methods which has employed by your mysql , by this command:
SELECT user,authentication_string,plugin,host FROM mysql.user;
and now the output is :
+------------------+-------------------------------------------+-----------------------+-----------+
| user | authentication_string | plugin | host |
+------------------+-------------------------------------------+-----------------------+-----------+
| root | *3636DACC8616D997782ADD0839F92C1571D6D78F | mysql_native_password | localhost |
| mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |
| mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |
| debian-sys-maint | *CC744277A401A7D25BE1CA89AFF17BF607F876FF | mysql_native_password | localhost |
+------------------+-------------------------------------------+-----------------------+-----------+
as you can see in the grant table your root account has mysql_native_password
.
now you can exit MYSQL shell
exit;
That’s it.just you should restart mysql by sudo service mysql restart.
Now you can login to mysql as a root account with your password easily.
Изменить или сбросить пароль от пользователя phpMyAdmin можно:
- по SSH. Этот способ подойдёт, если вы забыли пароль пользователя, под которым подключаетесь к phpMyAdmin.
- через интерфейс phpMyAdmin. Подойдёт, если вы знаете пароль и вам нужно его сменить.
В статье мы расскажем про оба способа.
Для сброса пароля по SSH вам понадобится доступ к root-пользователю MySQL. Если вы потеряли root-доступ к серверу баз данных, воспользуйтесь инструкцией.
Учётная запись, под которой вы подключаетесь к phpMyAdmin, — это обычный пользователь mySQL. Ниже мы расскажем, как сменить забытый пароль от такой учётной записи.
Как поменять пароль phpMyAdmin по SSH
-
1.
Подключитесь к серверу по SSH.
-
2.
Подключитесь к серверу баз данных командой:
Mysql -uroot -p’password’Вместо password напишите пароль от root-пользователя MySQL.
-
3.
Узнайте версию MySQL при помощи команды:
-
4.
Используйте одну из команд в зависимости от версии MySQL:
5.7.6 и выше:
ALTER USER 'username' IDENTIFIED BY 'password';5.7.5 и ниже:
SET PASSWORD FOR 'username'@'localhost' = PASSWORD('password');Вместо username введите имя пользователя, вместо password введите ваш новый пароль.
-
5.
Перезагрузите таблицы привилегий командой:
Готово, вы сменили пароль от пользователя phpMyAdmin.
Как поменять пароль в phpMyAdmin
При помощи приложения можно поменять пароль как от учётной записи, под которой вы авторизованы, так и для других учётных записей MySQL.
-
1.
Войдите в веб-интерфейс.
-
2.
Нажмите Учетные записи пользователей:
-
3.
Напротив нужного имени нажмите Редактировать привилегии:
-
4.
Вверху страницы нажмите Изменить пароль:
-
5.
Введите пароль и подтвердите его, затем нажмите Вперёд:
Готово, пароль от учётной записи изменён.
Стандартные доступы phpMyAdmin
На облачных серверах REG.RU с шаблонами LEMP и LAMP phpMyAdmin устанавливается автоматически. При подключении к такому серверу по SSH вы увидите приветственное окно с доступами:
phpMyAdmin default password
PHPMyAdmin is giving me a message saying that the user (root) does not have a password.
So, how can I create one?
asked Sep 1, 2012 at 2:29
1
Open phpMyAdmin and select the SQL tab. Then type this command:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('your_root_password');
Also change to this line in config.inc.php:
$cfg['Servers'][$i]['auth_type'] = 'cookie';
To make phpMyAdmin prompts for your MySQL username and password.
answered Sep 1, 2012 at 2:40
5
To create root password in PHPMyAdmin in UI easy way, you can follow simple steps below:
- Access phpMyAdmin with root account (no password) -> User accounts.
Click on root > Edit privileges
Then click on Change password
Enter your desired password -> Go
Logout and log-in again with new password
answered Feb 7, 2017 at 14:45
SonDangSonDang
1,4581 gold badge15 silver badges21 bronze badges
3
Well, I believe that I’ve solved the password configuration ‘issue’ — WampServer 2.2 — Windows 7.
The three steps that I did:
-
In the MySQL console set a new password. To make that:
mysqladmin -u root password 'your_password' -
In
phpMyAdminclick in users and set the same password to the userroot. -
Finally, set your new password in the
config.inc.php. Don’t change anything else in this file.
This worked for me. Good luck!
Daniel
answered Sep 3, 2012 at 22:48
1
-
Go to phpmyadmin
-
Open user account section:
-
Use EDIT Privileges
-
Change password and username
-
Add privileges for database
answered Sep 8, 2017 at 4:11
On linux (debian 9) after resetting the mysql(Maria DB) root password, you just have to edit the phpmyadmin db config file located at /etc/phpmyadmin/config-db.php
gedit /etc/phpmyadmin/config-db.php (as root)
answered Jul 16, 2018 at 17:34
ramesuramesu
691 silver badge3 bronze badges
Here the simple step that you can easily set phpMyAdmin Password.
- Goto
C:xamppphpMyAdminand findconfig.inc.phpfile - Open
config.inc.phpfile in Text editor like Notepad++. - Find the line
$cfg['Servers'][$a]['auth_type'] = 'config';inconfig.inc.phpfile. - Change the word
$cfg['Servers'][$a]['auth_type'] = 'config';to$cfg['Servers'][$a]['auth_type'] = 'cookie';inconfig.inc.phpfile and Save the changes. - Now open browser and type
localhost/phpmyadmin. Enter username is root. password is null means empty. you don’t type anything leave blank and press GO button. - Now you can see change password link. please click that link.
- Set your phpMyAdmin password and retype again and press GO button.
Eje
3544 silver badges8 bronze badges
answered Jan 4, 2017 at 12:18
AVSAVS
711 silver badge3 bronze badges
- Go to
http://localhost/security/index.php - Select language, it redirects to
http://localhost/security/xamppsecurity.php - You will find an option to change the password here
answered May 19, 2014 at 9:51
rinuthomazrinuthomaz
1,3932 gold badges22 silver badges38 bronze badges
I only had to change one line of the file config.inc.php located in C:wampappsphpmyadmin4.1.14.
Put the right password here …
$cfg['Servers'][$i]['password'] = 'Put_Password_Here';
answered Jul 19, 2014 at 14:31
hoggarhoggar
3,6195 gold badges29 silver badges39 bronze badges
I just faced the mysql user password problem — ERROR 1045: Access denied for user: ‘root@localhost’ (Using password: NO) — when I tried to do a do-release-upgrade on my operational system. So I corrected it in 2 steps.
Firstly, as I did not had access on phpmyadmin, so I followed the «Recover MySQL root password» step on the tutorial mensioned by ThoKra:
https://www.howtoforge.com/setting-changing-resetting-mysql-root-passwords
Secondly, with one of the users that I know the password, I made some password changes to the others users through phpmyadmin itself according to SonDang’s information.
answered Apr 11, 2017 at 12:18
If you tried mysqladmin -u root password 'your_password' and MySQL says denied access, you need to change the my.ini so that the value password is blank. then try mysqladmin -u root password 'your_password' again. It should change your password and open my.ini again and change the value password to the previous one.
answered Jul 19, 2020 at 9:16
I believe the command you are looking for is passwd
answered Sep 1, 2012 at 2:31
DoboyDoboy
10.1k11 gold badges39 silver badges48 bronze badges
PHPMyAdmin is giving me a message saying that the user (root) does not have a password.
So, how can I create one?
asked Sep 1, 2012 at 2:29
1
Open phpMyAdmin and select the SQL tab. Then type this command:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('your_root_password');
Also change to this line in config.inc.php:
$cfg['Servers'][$i]['auth_type'] = 'cookie';
To make phpMyAdmin prompts for your MySQL username and password.
answered Sep 1, 2012 at 2:40
5
To create root password in PHPMyAdmin in UI easy way, you can follow simple steps below:
- Access phpMyAdmin with root account (no password) -> User accounts.
Click on root > Edit privileges
Then click on Change password
Enter your desired password -> Go
Logout and log-in again with new password
answered Feb 7, 2017 at 14:45
SonDangSonDang
1,4581 gold badge15 silver badges21 bronze badges
3
Well, I believe that I’ve solved the password configuration ‘issue’ — WampServer 2.2 — Windows 7.
The three steps that I did:
-
In the MySQL console set a new password. To make that:
mysqladmin -u root password 'your_password' -
In
phpMyAdminclick in users and set the same password to the userroot. -
Finally, set your new password in the
config.inc.php. Don’t change anything else in this file.
This worked for me. Good luck!
Daniel
answered Sep 3, 2012 at 22:48
1
-
Go to phpmyadmin
-
Open user account section:
-
Use EDIT Privileges
-
Change password and username
-
Add privileges for database
answered Sep 8, 2017 at 4:11
On linux (debian 9) after resetting the mysql(Maria DB) root password, you just have to edit the phpmyadmin db config file located at /etc/phpmyadmin/config-db.php
gedit /etc/phpmyadmin/config-db.php (as root)
answered Jul 16, 2018 at 17:34
ramesuramesu
691 silver badge3 bronze badges
Here the simple step that you can easily set phpMyAdmin Password.
- Goto
C:xamppphpMyAdminand findconfig.inc.phpfile - Open
config.inc.phpfile in Text editor like Notepad++. - Find the line
$cfg['Servers'][$a]['auth_type'] = 'config';inconfig.inc.phpfile. - Change the word
$cfg['Servers'][$a]['auth_type'] = 'config';to$cfg['Servers'][$a]['auth_type'] = 'cookie';inconfig.inc.phpfile and Save the changes. - Now open browser and type
localhost/phpmyadmin. Enter username is root. password is null means empty. you don’t type anything leave blank and press GO button. - Now you can see change password link. please click that link.
- Set your phpMyAdmin password and retype again and press GO button.
Eje
3544 silver badges8 bronze badges
answered Jan 4, 2017 at 12:18
AVSAVS
711 silver badge3 bronze badges
- Go to
http://localhost/security/index.php - Select language, it redirects to
http://localhost/security/xamppsecurity.php - You will find an option to change the password here
answered May 19, 2014 at 9:51
rinuthomazrinuthomaz
1,3932 gold badges22 silver badges38 bronze badges
I only had to change one line of the file config.inc.php located in C:wampappsphpmyadmin4.1.14.
Put the right password here …
$cfg['Servers'][$i]['password'] = 'Put_Password_Here';
answered Jul 19, 2014 at 14:31
hoggarhoggar
3,6195 gold badges29 silver badges39 bronze badges
I just faced the mysql user password problem — ERROR 1045: Access denied for user: ‘root@localhost’ (Using password: NO) — when I tried to do a do-release-upgrade on my operational system. So I corrected it in 2 steps.
Firstly, as I did not had access on phpmyadmin, so I followed the «Recover MySQL root password» step on the tutorial mensioned by ThoKra:
https://www.howtoforge.com/setting-changing-resetting-mysql-root-passwords
Secondly, with one of the users that I know the password, I made some password changes to the others users through phpmyadmin itself according to SonDang’s information.
answered Apr 11, 2017 at 12:18
If you tried mysqladmin -u root password 'your_password' and MySQL says denied access, you need to change the my.ini so that the value password is blank. then try mysqladmin -u root password 'your_password' again. It should change your password and open my.ini again and change the value password to the previous one.
answered Jul 19, 2020 at 9:16
I believe the command you are looking for is passwd
answered Sep 1, 2012 at 2:31
DoboyDoboy
10.1k11 gold badges39 silver badges48 bronze badges
|
|
Content Cleanup Required |
Please do not make any edits to this article. Its contents are currently under review and being merged with the Ubuntu Server Guide. To find the Ubuntu Server Guide related to your specific version, please go to:
-
https://help.ubuntu.com/ and click on Ubuntu Server Guide
Why are you looking at this wiki page?
Are you looking at this page because you cannot access the mysql server installed on your pc/server when you were trying to see if it works well? Or do you receive error messages like the following? :
ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)
or
ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)
To resolve this problem ,a fast and always working way is the «Password Resetting» .
How can I reset my MySQL password?
Following this procedure, you will disable access control on the MySQL server. All connexions will have a root access. It is a good thing to unplug your server from the network or at least disable remote access.
To reset your mysqld password just follow these instructions :
- Stop the mysql demon process using this command :
-
sudo /etc/init.d/mysql stop
-
- Start the mysqld demon process using the —skip-grant-tables option with this command
-
sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &
-
Because you are not checking user privs at this point, it’s safest to disable networking. In Dapper, /usr/bin/mysqld… did not work. However, mysqld —skip-grant-tables did.
- start the mysql client process using this command
-
mysql -u root
-
- from the mysql prompt execute this command to be able to change any password
-
FLUSH PRIVILEGES;
-
- Then reset/update your password
-
SET PASSWORD FOR root@'localhost' = PASSWORD('password');
-
- If you have a mysql root account that can connect from everywhere, you should also do:
-
UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';
-
- Alternate Method:
-
USE mysql UPDATE user SET Password = PASSWORD('newpwd') WHERE Host = 'localhost' AND User = 'root';
-
- And if you have a root account that can access from everywhere:
-
USE mysql UPDATE user SET Password = PASSWORD('newpwd') WHERE Host = '%' AND User = 'root';
-
For either method, once have received a message indicating a successful query (one or more rows affected), flush privileges:
FLUSH PRIVILEGES;
Then stop the mysqld process and relaunch it with the classical way:
sudo /etc/init.d/mysql stop sudo /etc/init.d/mysql start
When you have completed all this steps ,you can easily access to your mysql server with the password you have set in the step before. An easy way to have a full control of your mysql server is phpmyadmin (www.phpmyadmin.net), software made in php that can give you a web interface that can be very usefull to people that havent got a lot of confidence with bash .To install phpmyadmin on you server you will need to have 4 things:
- web server apache
- php
- mysql server/mysql client installed
- php_mysql support for apache
All packages can be found browsing synaptic.
Another way, purge
I also had some problems with mysql just not accepting my password. I tried the other way as well and it just ended up being difficult. I had not been able to use mysql so it was empty anyway. If this is also your case you may opt for the PURGE way. This removes every file related to mysql. Depending on your installation the packages might be diffrent, mysql-server in 6.10 is called mysql-server-5.0 as an example.
USE THIS AS A LAST RESORT METHOD, YOU WILL LOSE ALL YOUR MYSQL DATA
sudo apt-get --purge remove mysql-server mysql-common mysql-client
sudo apt-get install mysql-server mysql-common mysql-client
In the next step be sure to chance the your-new-password with the password you want!
mysqladmin -u root password your-new-password sudo /etc/init.d/mysql restart
mysql -u root -p
You should now be logged in as root. Make sure to notedown your password! Thanks to Illuvator for posting this method in the ubuntu forum.
The Easiest Method
sudo dpkg-reconfigure mysql-server-N.N
(where N.N is the MySql Server version)











