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

2017-04-16 Thread Joe
On Sun, 16 Apr 2017 20:45:56 +0100
Joe  wrote:

> On Sun, 16 Apr 2017 10:17:53 +0100
> Abdelkader Belahcene  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 *
> > 
> > 
> > *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 r...@lite.umbb.dz
> >  -p*
> > *Enter password: *
> > *ERROR 1045 (28000): Access denied for user 'r...@lite.umbb.dz
> > '@'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 '@localhost'. The best way to proceed is to create
> another user with exactly the same privileges, and exactly the same


> '', but '@'. So for

Sorry, of course, that should be 'of the Wordpress server'. Not awake
this evening.

> example the new user is '@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.
> 



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

2017-04-16 Thread Joe
On Sun, 16 Apr 2017 10:17:53 +0100
Abdelkader Belahcene  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 *
> 
> 
> *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 r...@lite.umbb.dz
>  -p*
> *Enter password: *
> *ERROR 1045 (28000): Access denied for user 'r...@lite.umbb.dz
> '@'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 '@localhost'. The best way to proceed is to create another
user with exactly the same privileges, and exactly the same '', but
'@'. So for example the new
user is '@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



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

2017-04-16 Thread deloptes
Abdelkader Belahcene 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 *
> 
> 
> *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 r...@lite.umbb.dz 
> -p*
> *Enter password: *
> *ERROR 1045 (28000): Access denied for user 'r...@lite.umbb.dz
> '@'localhost' (using password: YES)*
> *Thanks a lot*

There is a difference between using localhost and 127.0.0.1 (AFAIR).
Using localhost enforces using unix socket and not interface (tcp)
connection (AFAIR)

It all depends on giving the right permissions to your user. I think giving
root permissions to external interface is discouraged.
Having said that, what you need to do is give permission to the user to
connect properly

GRANT ALL PRIVILEGES ON * to ''@'127.0.0.1'
identified by  '';

bin/mysql -u  -p -h 127.0.0.1 

GRANT ALL PRIVILEGES ON * to ''@'lite.umbb.dz'
identified by  '';

bin/mysql -u  -p -h lite.umbb.dz 

it's not exactly rocket science

regards



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

2017-04-16 Thread Abdelkader Belahcene
*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 *


*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 r...@lite.umbb.dz 
-p*
*Enter password: *
*ERROR 1045 (28000): Access denied for user 'r...@lite.umbb.dz
'@'localhost' (using password: YES)*
*Thanks a lot*


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

2017-04-11 Thread deloptes
Abdelkader Belahcene wrote:

> thanks a lot for any idea

This has nothing to do with mysql or debian, but with wordpress. Please
refer the manual or subscribe to the wordpress list.
Perhaps someone else here may help you, but it would be OT IMO.

regards



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

2017-04-11 Thread Richard Owlett

On 04/11/2017 07:45 AM, Abdelkader Belahcene wrote:

Thanks for reply;
I give more details.
I install wordpress on my machine, it works fine on local,  I mean i if
write in the browser localhost/wordpress, it 's OK.

I can use myIP/worpress on a remote  machine to connect my server, It seems
working  fine, I get the main page,
BUT, CSS files are not read, I know that by prospecting the code source of
the page.

Wordpress store everything in database,  and so the name of the CSS file
for example, unfortunatly,  the path  used is full address of the file like
localhost/wordpress/blabla/style.css
here is the Big Problem

When the connection is local, no problem, since localhost is the host of
the server;

when the connection is  like :   http://myURL/wordpress,   we SHOULD FIND
the CSS file with  http://myURL/wordpress/blabla/style.css



 To solve the problem

   - either  we remove the absolute path for the files, and keep only  the
   relative part,  instead of storing  localhost/wordpress/blabla/style.css, we
   keep only wordpress/blabla/style.css
   - or we replace the localhost by the name of the machine or IP, that is
   what I want to do, I mean instead of storing in DB, localhost I tore the
   name of my machine like bela.enst.dz, the connetion w'll be done with
   this name and the problem is then solved

I used xampp to install apache, mysql and php. But the problem is the same
when I installed each element alone ( apache2, php, mysql)


when I used the command : localhost -f , I got the correct name
tmp$ hostname -f
bela.enst.dz

thanks a lot for any idea

Regards

bela



It depends to a degree on the details of how you installed WordPress 
[that is using apt-get/Synaptic/etc or downloading zip file from 
wordpress.org].
For that I suggest searching the Subject line of this group for about 
the last 5 years.


Some links that this Debian & WordPress newbie has found enlightening:
https://wiki.debian.org/WordPress

If apt-get/Synaptic/etc used for installation
http://localhost ["Apache2 Debian Default Page"]
/usr/share/doc/wordpress/README.Debian

HTH





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

2017-04-11 Thread Abdelkader Belahcene
Thanks for reply;
I give more details.
I install wordpress on my machine, it works fine on local,  I mean i if
write in the browser localhost/wordpress, it 's OK.

I can use myIP/worpress on a remote  machine to connect my server, It seems
working  fine, I get the main page,
BUT, CSS files are not read, I know that by prospecting the code source of
the page.

Wordpress store everything in database,  and so the name of the CSS file
for example, unfortunatly,  the path  used is full address of the file like
localhost/wordpress/blabla/style.css
here is the Big Problem

When the connection is local, no problem, since localhost is the host of
the server;

when the connection is  like :   http://myURL/wordpress,   we SHOULD FIND
the CSS file with  http://myURL/wordpress/blabla/style.css



 To solve the problem

   - either  we remove the absolute path for the files, and keep only  the
   relative part,  instead of storing  localhost/wordpress/blabla/style.css, we
   keep only wordpress/blabla/style.css
   - or we replace the localhost by the name of the machine or IP, that is
   what I want to do, I mean instead of storing in DB, localhost I tore the
   name of my machine like bela.enst.dz, the connetion w'll be done with
   this name and the problem is then solved

I used xampp to install apache, mysql and php. But the problem is the same
when I installed each element alone ( apache2, php, mysql)


when I used the command : localhost -f , I got the correct name
tmp$ hostname -f
bela.enst.dz

thanks a lot for any idea

Regards

bela


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

2017-04-10 Thread Joe
On Mon, 10 Apr 2017 07:51:56 +0100
Abdelkader Belahcene  wrote:

> My  machine  has another name than localhost like lite.bela.umbb,
> when I install mysql, it always takes the the localhost as the name
> of the machine. this yields in a problem for me, when I use for
> example wordpress and I want a remote connection.  because the
> localhost stored in DB is irrelevant from a remote machine.
> 
> The question is : how to force mysql to use the name of my machine
> instead of localhost  for mysql server
> 

Mysql does not have or need a machine name. What problem are you having?
What are you trying to do and what error messages are you getting?

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.

-- 
Joe