Web lists-archives.com

Re: how to force mysql to use the name of my machine instead of localhost




On Sun, 16 Apr 2017 10:17:53 +0100
Abdelkader Belahcene <abelahcene@xxxxxxxxx> wrote:

> *Thanks for reply and links*
> 
> 
> *But I am sure, the problem is in mysql.*
> *Look at this: *
> 
> *my count is lite@lite*
> *and hostname  gives *
> *lite@lite:/opt/lampp$ hostname*
> *lite.umbb.dz <http://lite.umbb.dz>*
> 
> 
> *bin/mysql*
> 
> *ERROR 1045 (28000): Acces s denied for user 'lite'@'localhost' (using
> password: YES)*
> 
> *Here it tries to connect as 'lite'@'localhost', I am
> not  'lite'@'localhost', but lite@lite*
> *then  same thing as root, even if use -h option : *
> 
> *lite@lite:/opt/lampp$ bin/mysql -u root -h lite*
> *ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using
> password: YES)*
> *I tried  again, using the complete name, it adds localhost!!!!*
> 
> *lite@lite:/opt/lampp$ bin/mysql -u root@xxxxxxxxxxxx
> <root@xxxxxxxxxxxx> -p*
> *Enter password: *
> *ERROR 1045 (28000): Access denied for user 'root@xxxxxxxxxxxx
> <root@xxxxxxxxxxxx>'@'localhost' (using password: YES)*
> *Thanks a lot*

As deloptes said, the issue is in mysql permissions. I said a week ago:

"If it is a problem with mysql account privileges, then change them.

Mysql user privileges depend on the name of the user and the name of
the machine the user is connecting *from*. The name of the machine that
mysql is running on is irrelevant, and would be needed only when
setting up the connection on the remote machine using the mysql server's
hostname."

Wordpress will have created a user in the mysql privileges table, with
(theoretically) exactly the correct access permissions. But the user is
named 'xxxx@localhost'. The best way to proceed is to create another
user with exactly the same privileges, and exactly the same 'xxxx', but
'@<name or IP address of the mysql server>'. So for example the new
user is 'xxxx@12.34.45.67'.

What are you using to administer mysql? If a GUI-based method, such as
phpmyadmin, then open it on the whole installation, and look at the
Privileges tab for the user list, where you will find the user that
Wordpress has created. Then within the 'mysql' database, look at the
'db' table for detailed privileges. If you have no explicit mysql
administration utility, then use the built-in command line mysql
interface.

I am deliberately not being more specific, as if you are using mysql or
any other database, even just as an accessory to another application,
you cannot avoid acquiring at least a basic understanding of
administration, if only to avoid problems like the one you currently
have.

-- 
Joe