I had the same problem in Ubuntu 20.04. However setting root password to empty with
ALTER USER 'root'@'localhost' IDENTIFIED BY '';
as suggested in other answer did not help. I was still getting the same error from the phpmyadmin setup. I chose the «ignore» option in that phpmyadmin setup dialog, and then manually created phpmyadmin database and user, and manually created tables as follows:
mysql> create database phpmyadmin;
mysql> create user 'phpmyadmin'@'localhost' identified by 'some_passwd';
mysql> grant all privileges on phpmyadmin.* to 'phpmyadmin'@'localhost';
Where ‘some_password’ was the same as I specified in the setup dialog and which in consequence was saved in /etc/phpmyadmin/config-db.php
Then I went to /usr/share/phpmyadmin/sql
and ran
$ mysql -u phpmyadmin -p phpmyadmin < create_tables.sql
and specified that ‘some_password’. This made phpmyadmin happy and it started to work as expected.
I also needed to allow the webserver access to /usr/share/phpmyadmin
in apache2 config, because the phpmyadmin setup failed to do that properly.
I know that this question has already been asked but the answers do not solve my problem.
MySQL-Server version: 8.0.23-0ubuntu0.20.04.1 (Ubuntu)
OS: Kubuntu 20.04 amd64
I have now uninstalled and reinstalled MySQL Server 8.0.
During the first MySQL server installation I was asked for password validation policy
I selected: level 2 = STRONG.
Now, after reinstalling MySQL server, when I run mysql_secure_installation
, the question about «password validation policy» is not asked anymore.
I think this issue is related to the «password validation policy», because after the «Kubuntu 20.04» installation I uninstalled the KWalletManager and now the passwords can only be stored in plain text, like my WiFi password. I tried to fix this by reinstalling «KWalletManager» but for some reason it did not work.
How to fix this?
dbconfig-common
An error occurred while installing the database:
ERROR 1045
(28000): Access denied for user ‘debian-sys-maint’@’localhost’ (using
password: YES) . Your options are:
- abort — Causes the operation to fail; you will need to downgrade,
reinstall, reconfigure this package, or otherwise
manually intervene
to continue using it. This will usually also
impact your ability to
install other packages until the
installation failure is resolved.- retry — Prompts once more with all the configuration questions
(including ones you may have missed due to the debconf priority
setting) and makes another attempt at performing the operation.- retry (skip questions) — Immediately attempts the operation again,
skipping all questions. This is normally useful only if you
have
solved the underlying problem since the time the error
occurred.- ignore — Continues the operation ignoring dbconfig-common errors.
This will usually leave this package without a functional
database.
The MySQL service runs without errors.
systemctl status mysql.service
● mysql.service — MySQL Community Server
Loaded: loaded
(/lib/systemd/system/mysql.service; enabled; vendor preset:
enabled)
Active: active (running) since Wed 2021-05-12 18:23:39
CEST; 4h 35min ago
Main PID: 5410 (mysqld)
Status: «Server is
operational»
Tasks: 39 (limit: 16722)
Memory: 331.3M
CGroup: /system.slice/mysql.service
└─5410 /usr/sbin/mysqldMai 12 18:23:38 anonymous systemd3: Starting MySQL Community
Server…
Mai 12 18:23:39 anonymous systemd3: Started MySQL
Community Server.
The password is encrypted
cat etc/mysql/debian.cnf
Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = XXXXXXXXXXXXXXXX
socket =
/var/run/mysqld/mysqld.sock
[mysql_upgrade]
host =
localhost
user = debian-sys-maint
password =
XXXXXXXXXXXXXXXX
socket = /var/run/mysqld/mysqld.sock
Log in via Command Line Interface
mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with
; or \g.
Your MySQL connection id is 29
Server version:
8.0.23-0ubuntu0.20.04.1 (Ubuntu)Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered
trademark of Oracle Corporation and/or its
affiliates. Other names
may be trademarks of their respective
owners.Type
‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input
statement.mysql> \q
Bye
I can also login without a password.
mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your
MySQL connection id is 30
Server version: 8.0.23-0ubuntu0.20.04.1
(Ubuntu)Copyright (c) 2000, 2021, Oracle and/or its
affiliates.Oracle is a registered trademark of Oracle
Corporation and/or its
affiliates. Other names may be trademarks
of their respective
owners.Type ‘help;’ or ‘\h’ for
help. Type ‘\c’ to clear the current input statement.mysql> \q
Bye
mysql -u debian-sys-maint -p
Enter password:
ERROR 1045
(28000): Access denied for user ‘debian-sys-maint’@’localhost’ (using
password: YES)
mysql -u debian-sys-maint
ERROR 1045 (28000): Access denied for user ‘debian-sys-maint’@’localhost’ (using password: NO)
This might seem redundant but I was unable to find a correct solution.
I was unable to login to mysql using the mysql console.It is asking for a password and I have no clue what I actually entered.(Is there a way to get the password or change it?)
This is how my config.inc look.
When I try to open phpmyadmin I get this error(#1045 — Access denied for user ‘root’@’localhost’ (using password: YES))
<?php
/* Servers configuration */
$i = 0;
/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'prakash123';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
/* End of servers configuration */
$cfg['DefaultLang'] = 'en-utf-8';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
/* rajk - for blobstreaming */
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
?>
I have tried to uninstall( Plus Deleted all the related files) WAMP and reinstall.It didn’t help either.
While reinstalling WAMP server it is not asking for any username password stuff I don’t know why.
Any help is highly appreciated.
asked May 30, 2013 at 20:54
4
I first changed the root password running mysql at a prompt with
mysql -u root -p
Update password:
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
Edited line in the file config.inc.php
with the new root password:
$cfg['Servers'][$i]['password'] = 'MyNewPass'
Stop and re-start mysql service (in Windows: mysql_stop.bat
/mysql_start.bat
)
and got phpMyAdmin to work!
EDIT 2017: for MySQL≥5.7 use authentication_string
in place of Password
(see this answer):
`UPDATE mysql.user SET authentication_string=PASSWORD('MyNewPass') WHERE User='root';
`
Ritesh
4,7386 gold badges27 silver badges41 bronze badges
answered Oct 15, 2013 at 11:16
user2314737user2314737
27.2k20 gold badges102 silver badges114 bronze badges
3
The problem was I have 2 instances of Mysql installed and I didn’t know the password for both instances.Just check if port 80 is used by any of the programs.
This is what I did
1.Quit Skype because it was using port 80.(Please check if port 80 is used by any other program).
2.Search for Mysql services in task manager and stop it.
3.Now delete all the related mysql files.Make sure you delete all the files.
4.Reinstall
radbyx
9,37221 gold badges84 silver badges127 bronze badges
answered Aug 8, 2013 at 20:19
PrakashPrakash
7,8164 gold badges48 silver badges45 bronze badges
Well, there are many solutions already given above. If there are none of them works, maybe you should just try to reset your password again to ‘root’ as described here, and then reopen http://localhost/phpMyAdmin/
in other browser. At least this solution works for me.
answered Oct 27, 2013 at 20:18
yunhasnawayunhasnawa
8251 gold badge14 silver badges30 bronze badges
This worked for me.
In your config file
$cfg['Servers']['$i']['password'] = 'yourpassword';
In your mysql shell, login as root
mysql -u root
change your password or update if you’ve forgotten the old one
UPDATE mysql.user SET Password=PASSWORD('yourpassword') WHERE User='root';
stop and restart your mysql server from the xampp control panel. phpmyadmin can login to see your databases
answered Jul 1, 2018 at 23:43
mysql.exe->Run as administrator or go to following path C:\wamp\bin\mysql\mysql5.5.24\bin and than right click on mysql.exe go to properties and than select tab as Compatibility and see the bottom of dialog box in privilege level and just check the Run this program as an administrator and then click apply ok.finished now you open success phpMyadmin. bye
answered Aug 5, 2013 at 15:40
mysql -u root -p
UPDATE mysql.user SET Password=PASSWORD('mypass') WHERE User='root';
- Flush the privileges:
FLUSH PRIVILEGES;
- Exit by typing:
Exit
-
Edited line in the file config.inc.php with the new root password:
$cfg['Servers'][$i]['password'] = 'mypass'
-
be succss
answered Dec 29, 2014 at 9:08
1
Go to ‘config.inc.php’. Write your password over here — $cfg['Servers'][$i]['password'] =''
answered Jan 21, 2015 at 17:42
halkujabrahalkujabra
2,8643 gold badges25 silver badges36 bronze badges
This process is quite simple in correcting the the error. What is happening is a failure to connect to phpMyAdmin. In order to fix the problem you simply need to provide the correct password to the system phpMyAdmin configuration file located in apps\phpMyadmin\config.ini.php
1. the root should already be set as user
2. Insert the password between ‘ ‘ and that it.
If you still have problems then this means that the user name and /or the password need to be updated or inserted into the DB. to do this use the command line tool and do an update.
UPDATE mysql.user SET Password=PASSWORD(‘Johnny59 or whatever you want to use’) WHERE User=’root’;
answered Jan 26, 2015 at 2:52
Go to config.inc.php
, find $cfg['Servers'][$i]['password']
and remove any password provided, i.e change $cfg['Servers'][$i]['password'] = 'password';
with $cfg['Servers'][$i]['password'] = '';
Now you can launch phpMyAdmin
Selecting Users menu from phpMyAdmin, select the root user and click Edit previlidges.
Now scroll down to Change Password area, switch between No Password and Password to provide your new password.
that’s it.
answered Jun 20, 2015 at 8:52
I had the same error today. I had installed Djangostack and when I checked my task manager there were two instances of mysqld running. I checked one was for wamp server and the other was for django stack. I ended the one for django stack, restarted all services in wamp server and I was able to access phpmyadmin
answered Jun 22, 2015 at 9:15
NgenoNgeno
213 bronze badges
after installation i started wamp and i was asked for user and pass which were already set on default (user:admin pass: dots), and that was wrong with a message from your topic. Than, i just entered:
Username: root Password: (leave it empty)
and it worked for me!!
answered Aug 2, 2016 at 11:39
0
-
Go to
C:\xampp\phpMyAdmin
-
Edit the
config.inc.php
file -
Replace
$cfg['Servers'][$i]['auth_type'] = 'config';
by
$cfg['Servers'][$i]['auth_type'] = 'cookie';
For now on the PHPMyAdmin
will ask you for your password, no more error.
ata
3,4085 gold badges20 silver badges31 bronze badges
answered Feb 20, 2018 at 20:35
Try the following code:
$cfg['Servers'][$i]['password'] = '';
if you see Password column field as ‘No’ for the ‘root’ user in Users Overview
page of phpMyAdmin.
рüффп
5,18734 gold badges67 silver badges113 bronze badges
answered Oct 24, 2013 at 9:17
PerisPeris
293 bronze badges
with MariaDb, above solutions doesn’t works.
Use (exemple below with ubuntu 16.04 and mariadb-server Distrib 10.0.28):
sudo mysql_secure_installation
…
Change the root password? [Y/n]
New password:
answered Jan 26, 2017 at 10:45
bcag2bcag2
1,9981 gold badge17 silver badges31 bronze badges
I have encountered similar mistakes, and later found that my password is wrong.
answered Aug 14, 2017 at 1:28
管浩浩管浩浩
631 silver badge4 bronze badges
For UNIX, try this. It worked for me:
- connect MySQL use Navicat Premium with inital root/»password»
UPDATE mysql.user
SET authentication_string = PASSWORD('MyNewPass'), password_expired = 'N'
WHERE User = 'root' AND Host = 'localhost';
FLUSH PRIVILEGES;- restart MySQL
answered Feb 17, 2017 at 2:37
AaronAaron
191 bronze badge
1
First you have to go config.inc.php file then change the following instruction
$cfg['Servers'][$i]['user'] ='';
$cfg['Servers'][$i]['password'] ='';
or
answered Aug 23, 2017 at 15:30
1
If you arrived here because you can’t log into your phpMyAdmin, then try the root password from your Mysql instead of the password you put during phpMyAdmin installation.
answered Oct 10, 2017 at 11:38
Kaizoku GambareKaizoku Gambare
3,1433 gold badges29 silver badges41 bronze badges
Just now I have this situation and I have tried this way which is very easy.
First stop your mysql service using this command:
service mysql stop
and then just again start your mysql service using this command
service mysql start
I hope it may help others…
STiLeTT
1,02310 silver badges23 bronze badges
answered Dec 1, 2017 at 10:51
Sachin ShahSachin Shah
4,4833 gold badges24 silver badges50 bronze badges
After I updated my MySql, I was getting the same error message.
It turned out that after installing a different version on MySql, inside the my.ini, the port was different. Previous MySql version had port 3306 but the new one have port 3308.
Check your MySql my.ini, if it is different use the port from .ini in your connection.
answered Jan 9, 2020 at 23:52
GuntarGuntar
4738 silver badges23 bronze badges
php artisan serve
this command get the env contents for the first time and if you update .env file need to restart it.
in my case my username and dbname is valid and php artisan migrate worked
but need to cntrl+c , to cancel php artisan serve , and run it again
php artisan serve
answered Feb 19, 2020 at 17:51
Check the name of Environment Variable
Case with me:
- I was using
sqlalchemy
in apython-flask
project and got this issue. - IDE used: PyCharm
- In my
config.py
file I had setupSQLALCHEMY_DATABASE_URI
as:
SQLALCHEMY_DATABASE_URI = os.getenv("DATABASE_URI")
Mistake I did (it was a silly mistake 😅)
- While setting
evironment_variables
in PyCharm, I did:
SQLALCHEMY_DATABASE_URI=<my_db_uri>
Solution
- I changed the above to:
DATABASE_URI=<my_db_uri>
Namaste 🙏
answered Apr 6, 2021 at 6:34
Deepam GuptaDeepam Gupta
2,3841 gold badge30 silver badges33 bronze badges
In the my.ini file in C:\xampp\mysql\bin, add the following line after the [mysqld]
command under #Mysql Server
:
skip-grant-tables
This should remove the error 1045.
answered Dec 20, 2017 at 7:23
1
if multiple myslq running on same port no
enter image description here
Right click on wamp and test port 3306
if its wampmysqld64 its correct else change port no and restart server
radbyx
9,37221 gold badges84 silver badges127 bronze badges
answered Jun 16, 2018 at 12:00
SachinsSachins
311 silver badge7 bronze badges
Дата: 25.11.2013
Автор: Василий Лукьянчиков , vl (at) sqlinfo (dot) ru
Статистика форума SQLinfo показывает, что одной из наиболее популярных проблем является ошибка mysql №1045 (ошибка доступа).
Текст ошибки содержит имя пользователя, которому отказано в доступе, компьютер, с которого производилось подключение, а также ключевое слово YES или NO, которые показывают использовался ли при этом пароль или была попытка выполнить подключение с пустым паролем.
Типичные примеры:
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES) — сервер MySQL
— сообщает, что была неудачная попытка подключения с локальной машины пользователя с именем root и
— не пустым паролем.
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: NO) — отказано в
— доступе с локальной машины пользователю с именем root при попытке подключения с пустым паролем.
ERROR 1045 (28000): Access denied for user ‘ODBC’@‘localhost’ (using password: NO) — отказано в
— доступе с локальной машины пользователю с именем ODBC при попытке подключения с пустым паролем.
Причина возникновения ошибки 1045
Как ни банально, но единственная причина это неправильная комбинация пользователя и пароля. Обратите внимание, речь идет о комбинации пользователь и пароль, а не имя пользователя и пароль. Это очень важный момент, так как в MySQL пользователь характеризуется двумя параметрами: именем и хостом, с которого он может обращаться. Синтаксически записывается как ‘имя пользователя’@’имя хоста’.
Таким образом, причина возникновения MySQL error 1045 — неправильная комбинация трех параметров: имени пользователя, хоста и пароля.
В качестве имени хоста могут выступать ip адреса, доменные имена, ключевые слова (например, localhost для обозначения локальной машины) и групповые символы (например, % для обозначения любого компьютера кроме локального). Подробный синтаксис смотрите в документации
Замечание: Важно понимать, что в базе не существует просто пользователя с заданным именем (например, root), а существует или пользователь с именем root, имеющий право подключаться с заданного хоста (например, root@localhost) или даже несколько разных пользователей с именем root (root@127.0.0.1, root@webew.ru, root@’мой домашний ip’ и т.д.) каждый со своим паролем и правами.
Примеры.
1) Если вы не указали в явном виде имя хоста
GRANT ALL ON publications.* TO ‘ODBC’ IDENTIFIED BY ‘newpass’;
то у вас будет создан пользователь ‘ODBC’@’%’ и при попытке подключения с локальной машины вы получите ошибку:
ERROR 1045 (28000): Access denied for user ‘ODBC’@‘localhost’ (using password: YES)
так как пользователя ‘ODBC’@’localhost’ у вас не существует.
2) Другой первопричиной ошибки mysql 1045 может быть неправильное использование кавычек.
CREATE USER ‘new_user@localhost’ IDENTIFIED BY ‘mypass’; — будет создан пользователь ‘new_user@localhost’@’%’
Правильно имя пользователя и хоста нужно заключать в кавычки отдельно, т.е. ‘имя пользователя’@’имя хоста’
3) Неочевидный вариант. IP адрес 127.0.0.1 в имени хоста соответствует ключевому слову localhost. С одной стороны, root@localhost и ‘root’@’127.0.0.1’ это синонимы, с другой, можно создать двух пользователей с разными паролями. И при подключении будет выбран тот, который распологается в таблице привелегий (mysql.user) раньше.
4) Аккаунт с пустым именем пользователя трактуется сервером MySQL как анонимный, т.е. позволяет подключаться пользователю с произвольным именем или без указания имени.
Например, вы создали пользователя »@localhost с пустым паролем, чтобы каждый мог подключиться к базе. Однако, если при подключении вы укажите пароль отличный от пустого, то получите ошибку 1045. Как говорилось ранее, нужно совпадение трех параметров: имени пользователя, хоста и пароля, а пароль в данном случае не совпадает с тем, что в базе.
Что делать?
Во-первых, нужно убедиться, что вы используете правильные имя пользователя и пароль. Для этого нужно подключиться к MySQL с правами администратора (если ошибка 1045 не дает такой возможности, то нужно перезапустить сервер MySQL в режиме —skip-grant-tables), посмотреть содержимое таблицы user служебной базы mysql, в которой хранится информация о пользователях, и при необходимости отредактировать её.
Пример.
SELECT user,host,password FROM mysql.user;
+—————+——————+——————————————-+
| user | host | password |
+—————+——————+——————————————-+
| root | house-f26710394 | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| aa | localhost | *196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7 |
| test | localhost | |
| new_user | % | |
| | % | *D7D6F58029EDE62070BA204436DE23AC54D8BD8A |
| new@localhost | % | *ADD102DFD6933E93BCAD95E311360EC45494AA6E |
| root | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
+—————+——————+——————————————-+
Если изначально была ошибка:
-
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
значит вы указывали при подключении неверный пароль, так как пользователь root@localhost существует. Сам пароль храниться в зашифрованном виде и его нельзя узнать, можно лишь задать новый
SET PASSWORD FOR root@localhost=PASSWORD(‘новый пароль’);
-
ERROR 1045 (28000): Access denied for user ‘ODBC’@‘localhost’ (using password: YES)
в данном случае в таблице привилегий отсутствует пользователь ‘ODBC’@’localhost’. Его нужно создать, используя команды GRANT, CREATE USER и SET PASSWORD.
Экзотический пример. Устанавливаете новый пароль для root@localhost в режиме —skip-grant-tables, однако после перезагрузки сервера по прежнему возникает ошибка при подключении через консольный клиент:
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
Оказалось, что было установлено два сервера MySQL, настроенных на один порт.
phpmyadmin
При открытии в браузере phpmyadmin получаете сообщение:
Error
MySQL said:
#1045 — Access denied for user ‘root’@’localhost’ (using password: NO)
Connection for controluser as defined in your configuration failed.
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
Ни логина, ни пароля вы не вводили, да и пхпадмин их нигде требовал, сразу выдавая сообщение об ошибке. Причина в том, что данные для авторизации берутся из конфигурационного файла config.inc.php Необходимо заменить в нем строчки
$cfg[‘Servers’][$i][‘user’] = ‘root’; // MySQL user
$cfg[‘Servers’][$i][‘password’] = »; // MySQL password (only needed
на
$cfg[‘Servers’][$i][‘user’] = ‘ЛОГИН’;
$cfg[‘Servers’][$i][‘password’] = ‘ПАРОЛЬ’
Установка новой версии
Устанавливаете новую версию MySQL, но в конце при завершении конфигурации выпадает ошибка:
ERROR Nr. 1045
Access denied for user ‘root’@‘localhost’ (using password: NO)
Это происходит потому, что ранее у вас стоял MySQL, который вы удалили без сноса самих баз. Если вы не помните старый пароль и вам нужны эти данные, то выполните установку новой версии без смены пароля, а потом смените пароль вручную через режим —skip-grant-tables.
P.S. Статья написана по материалам форума SQLinfo, т.е. в ней описаны не все потенциально возможные случаи возникновения ошибки mysql №1045, а только те, что обсуждались на форуме. Если ваш случай не рассмотрен в статье, то задавайте вопрос на форуме SQLinfo
Вам ответят, а статья будет расширена.
Дата публикации: 25.11.2013
© Все права на данную статью принадлежат порталу SQLInfo.ru. Перепечатка в интернет-изданиях разрешается только с указанием автора и прямой ссылки на оригинальную статью. Перепечатка в бумажных изданиях допускается только с разрешения редакции.
I have been trying to install phpmyadmin on my Debian 9 (stretch) system, I already have apache, php and mysql installed and working. When I run
sudo apt-get install phpmyadmin
it downloads but the installation throws this error:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
even though I know I have a password for mysql. Is there a way I can force phpmyadmin to use a password when logging into mysql??
asked Jan 30, 2019 at 1:03
Configure/create a /root/.my.cnf
file and put the following contents:
[client]
user=root
password=yourPasswordHere
Then re-run the installation process. The issue is that phpmyadmin is attempting to log in to your mysql server and you have not provided a username/password to the phpmyadmin install script. Check the PMA documentation on where to configure this in PMA’s config file.
answered Jul 16, 2019 at 21:14
You must log in to answer this question.
Not the answer you’re looking for? Browse other questions tagged
.
Not the answer you’re looking for? Browse other questions tagged
.