Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phpmyadmin #1045 Cannot log in to the MySQL server. after installing mysql command line client

I installed wamp.phpmyadmin working fine. Now that I have installed mysql command line client I am not able to connect to my databases from mysql command line or phpmyadmin. After restarting I could not access phpmyadmin #1045 Cannot log in to the MySQL server. In addition to that my mysql command line not accepting my password and rejects my config files:

C:\wamp\bin\mysql\mysql5.5.24

my.ini

port=3306

my config.inc.php

$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'whtevr';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

httpd.conf

listen port:80

C:\Program Files\MySQL\MySQL Server 5.0

my.ini

port:3306

Again, I reinstalled mysql command line with port changed to 3307

port:3307

WAMP works fine accessing all the databases but from mysql command line client I could not access all my databases. It is only showing show databases;

information_schema 
mysql 
test
like image 716
black Avatar asked Jan 02 '14 16:01

black


People also ask

What phpMyAdmin used for?

phpMyAdmin is a free software tool written in PHP that is intended to handle the administration of a MySQL or MariaDB database server. You can use phpMyAdmin to perform most administration tasks, including creating a database, running queries, and adding user accounts.

Is phpMyAdmin and MySQL same?

MySQL is a RDBMS (Relational DataBase Management System), PhpMyAdmin is a web application wich let you manage (with a visual interface) MySQL Databases.

Is phpMyAdmin and PHP same?

phpMyAdmin is a free software tool written in PHP, intended to handle the administration of MySQL over the Web.

How do I access my phpMyAdmin?

Access the phpMyAdmin console through the secure SSH tunnel you created, by browsing to http://127.0.0.1:8888/phpmyadmin. Log in to phpMyAdmin by using the following credentials: Username: root. Password: application password.


2 Answers

In case MySQL Server is up but you are still getting the error:

For anyone who still have this issue, I followed awesome tutorial http://coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-9-mavericks/

However i still got #1045 error. What really did the trick was to change localhost to 127.0.0.1 at your config.inc.php. Why was it failing if locahost points to 127.0.0.1? I don't know. But it worked.

===== EDIT =====

Long story short, it is because of permissions in mysql. It may be set to accept connections from 127.0.0.1 but not from localhost.

The actual answer for why this isn't responding is here: https://serverfault.com/a/297310

like image 161
JGutierrezC Avatar answered Oct 26 '22 11:10

JGutierrezC


I was experiencing the same problem on OS X. I've solved it now. I post my solution here for anyone who has the similar issue.

Firstly, I set the password for root in mysql client:

shell> mysql -u root
mysql> FLUSH PRIVILEGES;
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MY_PASSWORD');

Then, I checked the version info:

shell> /usr/local/mysql/bin/mysqladmin -u root -p version
...
Server version    5.6.26
Protocol version  10
Connection        Localhost via UNIX socket
UNIX socket       /tmp/mysql.sock
Uptime:           11 min 0 sec
...

Finally, I changed the connect_type parameter from tcp to socket and added the parameter socket in config.inc.php:

$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'socket';
$cfg['Servers'][$i]['socket'] = '/tmp/mysql.sock';
like image 6
micmia Avatar answered Oct 26 '22 12:10

micmia