Wednesday, December 5th, 2007 11:01 PM
A perl script to stop crond if mysqld is down
#!/usr/bin/perl
# See if MySQL server is alive or not
$mysql_status = `/etc/init.d/mysqld status`;
print "MySQL Status: $mysql_status\n";
unless($mysql_status =~ /running/) {
print "Stopping Cron... ";
#If MySQL is not running, kill the crond
$cron = `/etc/init.d/crond stop`;
print $cron;
}
print "\n";
[tags][/tags]
No Comments »
Tuesday, November 27th, 2007 12:18 AM
You can connect to a remote mysql server if you have the necessary permissions…
mysql -h mysql.remote.com -u user
No Comments »
Friday, August 24th, 2007 10:37 PM
Backup all files in /var/lib/mysql to another folder
To restore, stop mysqld if it is running
service stop mysqld
Move all database files back to /var/lib/mysql. Make sure that all the folder and files in that folder belongs to mysql
chown -R mysql.mysql /var/lib/mysql
Try starting mysql
service start mysqld
[tags]mysql,database,table,backup,data,db,restore[/tags]
1 Comment »
Thursday, April 19th, 2007 12:45 AM
MySQL
./configure --prefix=/usr/local/mysql --localstatedir=/var/lib/mysql --with-mysqld-user=mysql --with-unix-socket-path=/tmp/mysql.sock --without-comment --without-debug --without-bench
make
make install
cp support-files/my-medium.cnf /etc/my.cnf
chown root:sys /etc/my.cnf
chmod 644 /etc/my.cnf
chown -R root:mysql /usr/local/mysql
chown mysql:mysql /var/lib/mysql
./scripts/mysql_install_db
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &
/usr/local/mysql/bin/mysql
Apache
./configure --prefix=/usr/local/apache --enable-so --enable-cgi--enable-info --enable-rewrite --enable-speling --enable-usertrack --enable-deflate --enable-ssl --enable-mime-magic
make
make install
PHP
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --disable-debug --enable-ftp --enable-inline-optimization --enable-magic-quotes --enable-mbstring --enable-mm=shared --enable-safe-mode --enable-track-vars --enable-trans-sid --enable-wddx=shared --enable-xml --with-dom --with-gd --with-gettext --with-mysql=/usr/local/mysql --with-regex=system --with-xml --with-zlib-dir=/usr/lib --with-gettext --with-gdbm
make
make install
cp -p php.ini-recommended /usr/local/php/php.ini
Configuration
httpd.conf
php.ini
No Comments »
Saturday, March 17th, 2007 07:49 PM
This command can be used to backup MySQL database.
mysqldump -u <User> -p <Database name> [<Table name>] > backup.sql
This command will create a file ‘backup.sql’ that will have all the data of the Database. The <Table name> is optional.
The database can be restored from such a dump using the command
mysql -u <User> <Database name> < backup.sql
Example
I backup all the task in Nexty using this command.
mysqldump -u root Apps_Nexty > nexty.sql
This will create a file called ‘nexty.sql’ - which can be restored using the command…
mysql -u root Apps_nexty < nexty.sql
[tags]mysql,backup,import,export,restore,database,command,dump,sql[/tags]
1 Comment »