Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
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.
At my company, When I came in...one of the servers is a small webserver that just hosts our website, it used to host a scalix e-mail server but I've since moved to Google Apps.
Anyways, I've been slowly converting the servers to VMware, I'm onto the Webserver now.
I am Running CentOS5.5, I've installed the new server on the VMware client.
What I don't know how to do is copy the apache 2.0 server (which files,commands,etc) over to the new one so that I can start to run the web server from the VM.
Also, I do know that to get the website to work, I do have to type /etc/init.d/mysqld start
Does that my I have mysqul database configs as well that need to be transferred? I know the website is in PHP, our webmaster has done it all with that. So I just set up an FTP for him to login to the admin folder to do any of his uploads.
Please read through the explanations before doing any of these steps.
This is a mysql function that will pull out the user names, passwords and all related user settings from a Mysql database. The usage of this, would be to grab any specialized users for the application, and move them and their passwords and permissions to a new mysql database.
Code:
mygrants() {
# Displays all grant information
# Usage: mygrants [-h -u -p]
mysql -B -N $@ -e "SELECT DISTINCT CONCAT(
'SHOW GRANTS FOR ''', user, '''@''', host, ''';'
) AS query FROM mysql.user" | mysql $@ | sed 's/\(GRANT .*\)/\1;/;s/^\(Grants for .*\)/## \1 ##/;/##/{x;p;x;}'; }
# Once you copy and paste this into a terminal, simply type 'mygrants'
Now that you have your mysql users, we have to grab the databases in mysql and move them else where. This script will output (dump) all databases to sql files that can be copied to another location and imported. Only import the ones to do with your application,.. I would NOT suggest importing mysql.sql.
Code:
# Get database names
databases="$($mysql -u $muser -h $mhost -p$mpass -Bse 'show databases')"
# Get database dumps
mkdir /root/database_backup
for db in $databases
do
$mysqldump --routines --complete-insert --single-transaction --quick -u $muser -h $mhost -p$mpass $db > /root/database_backup/$db.sql
$md5sum /root/database_backup/$db.sql > /root/database_backup/$db.sql.md5
done
Then grab a copy of your website:
Code:
cd /root;
tar czvf website-backup.tar.gz /var/www
After doing these 3 steps you will have 3 things:
1) A user list that can be inserted into a new mysql db (Copy and paste output of mygrants into new database)
2) Database dumps that can be imported into a new mysql db (Use 'mysql' to import the dumps)
3) A backup of your website that can be unzipped to a new server (Copy it to the new server, untar it, move it to the correct place)
Last edited by szboardstretcher; 02-01-2011 at 01:55 PM.
One question, The first part that I copy and paste. Where is the output of all this? Is there something I'm supposed to copy to move to the new server?
One question, The first part that I copy and paste. Where is the output of all this? Is there something I'm supposed to copy to move to the new server?
Thanks, sorry for sounding like a newb...but I am
When you run the 'mygrants' function, it will output a lot of stuff. Grab anything relating to your Webuser, like "phpadmin" or "phpuser" or whatever, and paste it into your new mysql instance. Obviously, you do not want to grab usernames and passwords that you do not intend on using.
Click 'yes' on the bottom right of my post if you found my post helpful.
When I fill in those parameters...I get this output
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
I'm not sure what username and password i'm supposed to put there. Just incase I tried both root with the root password. I also tried the username mysql with its associated password.
Typically that error means that there is no mysql server listening for connections. Are you running the commands on the server that has MySQL or on a separate host? Also make sure that the mysql process is running and that it is listening (port 3306)
If you type
Code:
ps aux | grep mysql
you should see multiple lines including something like
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.