Subscribe:

Ads 468x60px

Pages

Showing posts with label Mysql. Show all posts
Showing posts with label Mysql. Show all posts

Wednesday, August 24, 2011

MySQL Checksum

This is another tool in the same toolkit as archiver. I just saw a great blog post on it athttp://blog.arabx.com.au/?p=883. Documentation can be found athttp://mysqltoolkit.sourceforge.net/doc/mysql-checksum-filter.html. This is an invaluable tool for ensuring your replicated tables are staying in sync, something that MySQL replication does not do. Tables will drift and if you are dealing with critical data for read support, reports or backups, this will prove invaluable.

This is referenced from the following site
Read more...

Nagios Plugins for Monitoring MySQL

You can come to know how to setup Nagios pluging for monitoring the mysql server by seeing this video and as well as pdf file
I am about to present the very first public appearance of PalominoDB's nagios plugin for MySQL.  This has been running on several clients in production for about 6 months, so we know it's stable.  The PDF's of the presentation slides and white papercan be downloaded, and are also available from our Community section (presentationsand white papers) in the menu bar at the top of each page.  Also you can download the code to use in your Nagios infrastructure.



The link of the pdf file. Please click here

Read more...

Tuesday, August 9, 2011

Backup & Restore MS SQL Server 2008 Database


The following tutorial explains you the backing up and restoration of your MS SQL Server 2008 Database using the Microsoft SQL Server Management Studio.

Microsoft SQL Server Management Studio Express (SSMSE) which is an free open source graphical management tool which can be used to manage your SQL Server 2008 Express Edition. You can use these backups later if a disaster strikes. It is always better to backup your database, because you never know if the information is lost or the database goes corrupt.

The backup file you download will need to be in .bak file extension. Database stored on the shared servers, the backups will be generated on the server itself. If you wish to have a copy of your server backup, then you may need to contact the windows support team.
In order to backup your MS SQL Server 2008 Database on your windows dedicated server hosting platform, follow the steps shown below:

First, you need to configure the Microsoft SQL Server Management Studio on your local machine. If you don’t have it, you can download it from the following location.
http://www.microsoft.com/downloads/en/details.aspx?familyid=6053C6F8-82C8-479C-B25B-9ACA13141C9E&displaylang=en
Step 1: Open your Microsoft SQL Server Management Studio, whichever you prefer, standard or express edition.
Step 2: Using your Database Username and Password, simply login to your MS SQL server database.
Step 3: Select the database >> Right-click >> Tasks >> Back Up [as shown in the image below]:
Backup MS SQL Server 2008 Database
Once you click on the “Backup” the following Backup Database window will appear [as shown in the image below]:
Backup MS SQL Server 2008 Database Folow Step 2
Step 4: Select the following options:
  1. Backup type: Full
  2. Under Destination, Backup to: Disk
Step 5: Now, by clicking on the “Add” button the following window will appear to select the path and file name for the database backup file [as shown in the image below]:
Backup MS SQL Server 2008 Database - Select Backup Destination
Step 6: Select the destination folder for the backup file and enter the “File name” with .bak extension [as shown in the image below]:
Backup MS SQL Server 2008 Database - Locate A Database Files
Make sure you place your MS SQL database .bak file under the MSSQL backup folder.
Step 7: Hit the OK button to finish the backup of your MS SQL Server 2008 Database. Upon the successful completion of database backup, the following confirmation window will appear with a message “The backup of database “yourdatabasename” completed successfully. [as shown in the image below]:
Backup MS SQL Server 2008 Database - Confirmation Screen
Following the above shown steps, you will be able to create a successful backup of your MS SQL Server 2008 Database into the desired folder.

How to Restore MS SQL Server 2008 Database Backup File ?
In order to restore a database from a backup file, follow the steps shown below:
Step 1: Open your Microsoft SQL Server Management Studio Express and connect to your database.
Step 2: Select the database >> Right-click >> Tasks >> Restore >> Database [as shown in the image below]:
Restore MS SQL Server 2008 Database
Step 3:  The following “Restore Database“ windows will appear. Select “From device” mentioned under the “Source for restore” and click the button infront of that to specify the file location [as shown in the image below]:
Restore MS SQL Server 2008 Database - Step 2
Step 4: Select the option “Backup media as File” and click on the Add button to add the backup file location [as shown in the image below]:
Restore MS SQL Server 2008 Database - Specify Backup
Step 5: Select the backup file you wish to restore and Hit the OK button [as shown in the image below]:
Restore MS SQL Server 2008 Database Locate The Backup File
That’s it! You will get the confirmation windows with a message “The restoration of database “yourdatabasename” completed successfully.” Now you know the procedure of backing up and restoring MS SQL Server 2008 Database.
Read more...

Monday, August 8, 2011

Database Connection Error

Symptoms :-
Getting "Database Connection Error" while accessing Atmail webmail by webmail.domain.com


Error :-
Quote:
Database Connection Error
DB Error: connect failed


* Verify the SQL database is running
* Check the SQL server is listening to the specified socket, IP address
* Check the global configuration file (/var/www/atmail/libs/Atmail/Config.php) for the correct database details
* Verify the database server is running correctly
* Verify the MySQL /etc/my.cnf file has the correct settings for the number of database connections
Cause :- Password for the mysql user atmail is not correct as per mentioned in Atmail password file.


[root@support007 ~]# cat "/etc/psa-webmail/atmail/.atmail.shadow"
d62kgaczkOmrqP [This is the password of mysql user admin]


[root@support007 ~]# mysql -uatmail -p
Enter password: [Here I have used d62kgaczkOmrqP password for login as user atmail it fails as password of the user is not correct]
ERROR 1045 (28000): Access denied for user 'atmail'@'localhost' (using password: YES)


Solution :-
Just reset the password for mysql user atmail as per mentioned in atmail password file "/etc/psa-webmail/atmail/.atmail.shadow"
Read more...

Back up and Restore your MySQL database




If you have shell or telnet access to your web server, you can backup your MySQL data by using the mysqldump command. This command connects to the MySQL server and creates an SQL dump file. The dump file contains the SQL statements necessary to re-create the database. Here is the proper syntax:


$ mysqldump --opt -u [uname] -p[pass] [dbname] > [backupfile.sql]


* [uname] Your database username
* [pass] The password for your database (note there is no space between -p and the password)
* [dbname] The name of your database
* [backupfile.sql] The filename for your database backup
* [--opt] The mysqldump option


For example, to backup a database named 'Tutorials' with the username 'root' and with no password to a file tut_backup.sql, you should accomplish this command:


$ mysqldump -u root -p Tutorials > tut_backup.sql


This command will backup the 'Tutorials' database into a file called tut_backup.sql which will contain all the SQL statements needed to re-create the database.


Sometimes it is necessary to back up more that one database at once. In this case you can use the --database option followed by the list of databases you would like to backup. Each database name has to be separated by space.


$ mysqldump -u root -p --databases Tutorials Articles Comments > content_backup.sql


Back up your MySQL Database with Compress


If your mysql database is very big, you might want to compress the output of mysqldump. Just use the mysql backup command below and pipe the output to gzip, then you will get the output as gzip file.


$ mysqldump -u [uname] -p[pass] [dbname] | gzip -9 > [backupfile.sql.gz]


If you want to extract the .gz file, use the command below:
$ gunzip [backupfile.sql.gz]


Restoring your MySQL Database


Above we backup the Tutorials database into tut_backup.sql file. To re-create the Tutorials database you should follow two steps:


* Create an appropriately named database on the target machine
* Load the file using the mysql command:


$ mysql -u [uname] -p[pass] [db_to_restore] < [backupfile.sql]


Have a look how you can restore your tut_backup.sql file to the Tutorials database.


$ mysql -u root -p Tutorials < tut_backup.sql


To restore compressed backup files you can use following command
gunzip < [backupfile.sql.gz] | mysql -u [uname] -p[pass] [dbname] 

Read more...

Saturday, July 2, 2011

Interview Questions - Part I


Harvest company interview question:
-----------------------------------


Mysql server
------------
1.what is the switch, router and hub?
2.who was owned by the ubuntu os?
3.how to share file through nfs?
4.why need of samba? what is the service name used of samba and config file of samba?
5.how to take a backup and restore the mysql server?
6.what is a port no for ftp, mysql and https
7.Do you have any idea on clouding?


Apache:
-------
1.What is virtualhost in apache?
2.what is ip based and namebase website
3.what are types of log files present in the apache and what r there?
4.can i create websites with multiple ports?
5.where u will mention the logs in config file?
6.what is the difference b/w the access and custom logs
7.where thes log files present?
8.what is are the log files present in the apache
9.How many virtualhost can we assign
10.what is 500 error? why it will get?
11.what is 404 error? why it will get?
12.what is rewrite?


LAMP:
-----
1.What is a LAMP suite?
2.I am setting up LAMP successfully.
  a.But when i browsing i am getting blanks page why?
  b.when i browsing the site. i can see the list of directories. when i click them it will be downloaded. but the directories should not be downloaded. then what u will do?(i dont not actually directories or files)
  c.I have index.php page. when the client visit to index page it should show index.html not index.php. wat u will do for this?
  (i said by doing alias we can do this. then interviewer questioned me. if i have multiple pages with .php extention then pages should be visible in html extension.)

Read more...

Friday, June 24, 2011

Backup MySql server database using bash script

Create the bash shell script for taking the My Sql server database backup
#vim mysqlbackup.sh
#!/bin/sh
# backup mysql databases shell script

DATE=$(date +%Y-%m-%d)
MYSQL=$(which mysql)
MYSQLDUMP=$(which mysqldump)
MYSQL_USER="root"
MYSQL_PASS="password"
HOSTNAME=$(hostname)
GZIP=$(which gzip)
ARG="-u $MYSQL_USER -p$MYSQL_PASS"
DATABASES=$($MYSQL $ARG -s -e "SHOW DATABASES;")
BACKUP_PATH="/home/backup/$DATE/mysql"


! [ -d $BACKUP_PATH ] && mkdir -p $BACKUP_PATH

for DB in $DATABASES
do
BACKUP_FILE="$BACKUP_PATH/$HOSTNAME-mysql-$DB-$DATE.sql.gz"
$MYSQLDUMP $ARG $DB | $GZIP -9 > $BACKUP_FILE
done
:wq
Read more...