Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have two physical machines. I would like to connect Apache on one machine to MySql on the other. Do I need to do anything else other then add the IP address of the Apache box to the configs of the Mysql box? Or am I doing something wrong
what configs are you referring to?
Something in the middle of Apache and MySQL?
I essentially just want my apache machine (box1) to connect to my mysql machine (box2) . So every time my site is accessed from box1, which will be public facing, if a database is used on the site (Wordpress), box2 handles it. I essentially need both machines to communicate with each other.
I essentially just want my apache machine (box1) to connect to my mysql machine (box2) . So every time my site is accessed from box1, which will be public facing, if a database is used on the site (Wordpress), box2 handles it. I essentially need both machines to communicate with each other.
it is more a matter of configuring the MySQL box to accept network connections, then configuring the WordPress (or other) DB to use that machine for access.
The examples I give here are for Slackware but will be very similar for other distros...
First, on the MySQL machine, make sure the server is not started with --skip-networking option. This may either be added in the MySQL start script, like /etc/rc.d/rc.mysqld, OR it might be found in /etc/my.cnf. If it is found, comment it out and restart the MySQL server, however that is done on your machine (/etc/rc.d/rc.mysqld restart for Slackware).
Next, you will need to grant access rights to a user from the Apache machine. From the shell as root (or MySQL admin user)
Code:
mysql -pxxxxxxxx (start the mysql client)
GRANT ALL ON DB.* TO apache-user@apache-host IDENTIFIED BY 'XXXXXXXX';
Where xxxxxxxx and XXXXXXXX are the respective user passwords, DB is the database name.
'apache-user' is the name used from the Apache machine (not necessarily a username on that machine) and apache-host is the host name or IP address of the Apache machine.
Finally, on the Apache machine in the WordPress or other config, set the equivalent of:
Your distro may provide different ways of restarting the mysqld daemon, and the hosts of course must be visible to each other on the network wither by name or address, but these are the basic requirements.
Last edited by astrogeek; 11-14-2013 at 06:10 PM.
Reason: typos, hilighting, clarity
When you say root here (as you can see I'm not very good at this) do you mean Linux Root or Mysql Root? I'm not sure if this http://dev.mysql.com/doc/refman/5.5/...rmissions.html and the Linux Root are the same. Sorry :-(
mysql -uroot -p <enter>
and enter the root password and you're golden.
Quote:
Originally Posted by astrogeek
GRANT ALL ON DB.* TO apache-user@apache-host IDENTIFIED BY 'XXXXXXXX';
apache-user can be ANY name you like for the connection/userid but
apache-host should be somethling like 'ipa.ddr.ess' for explict permissions from a single host.
another example:
Code:
GRANT ALL ON DB.* TO fredflintstone@'192.168.1.5' IDENTIFIED BY 'betty rubble is HOT';
When you say root here (as you can see I'm not very good at this) do you mean Linux Root or Mysql Root? I'm not sure if this http://dev.mysql.com/doc/refman/5.5/...rmissions.html and the Linux Root are the same. Sorry :-(
Usually Linux root, but actually any MySQL admin user with GRANT privileges, that is why I said:
Code:
From the shell as root (or MySQL admin user)
Other than restarting the mysqld daemon which will generally require Linux root privs, everytihng else is in MySQL context.
I don't know a fraction of what you guys know, but I really like debian and mint...I will try this when I get home. I always thought root for mysql was different then root from a fresh unix/linux install. I thought mysql root was something that was created after...wow
I am using debian btw...but have another machine that I'm ready to try LFS on. I have a bit going on.
I don't know a fraction of what you guys know, but I really like debian and mint...I will try this when I get home. I always thought root for mysql was different then root from a fresh unix/linux install. I thought mysql root was something that was created after...wow
I am using debian btw...but have another machine that I'm ready to try LFS on. I have a bit going on.
You are correct, a MySQL user named 'root' is not the same as the Linux root user. But when you start the mysql client without specifying a user, the Linux login user is assumed. So most installations by default create a MySQL user named 'root' with full privs as a convenience, just so that the system root user is kind of automatically the MySQL super-admin user too. But in reality there is zero connection between the system root and any MySQL user that also happens to be named root.
On debian you have to change /etc/mysql/my.cnf to have the server listen on an ip address that is reachable from the network. Find the line with bind-address and change the value to the ip of the server. Afterwards restart mysql
Code:
# get ip
ip addr
# edit mysql config
editor /etc/mysql/my.cnf
# restart mysql
service mysql restart
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.