MySQL Useful Command

If you are the database administrator, today post will help you to mange your server easily.

mysqladmin ping
-check whether the server is alive

mysqladmin status
-display a short server status message.

mysqladmin variable
-display the server system variables and their value.

mysqladmin proc stat
-all command shortened

mysqladmin processlist
-Shows active mysql connections and queries

mysqladmin drop database_name
-Dropsdeletes the selected database

mysqladmin create database_name
-Creates a mysql database

mysql -u username -p password databasename < databasefile.sql
-Restores a MySQL database from databasefile.sql

mysqldump -u username -p password databasename > databasefile.sql
-Backup MySQL database to databasefile.sql

Restore MySQL database with MySQLdump

MySQL database is one of the famous database engine used from the IT world.

To you might have a question such as how to move the current hosted database to another server? Actually it is very easy through the command line.

You may refer to the step as below to restore your database file.

Restore database with password.

mysql -h [remote_IP] -u [username] -p [password] [database_name] < [database_name].sql

Restore database without password

mysql -h [remote_IP] -u [username] [database_name] < [database_name].sql

Restore database from the remote server(you’ve logged into the server that wish to restore database)

mysql -u [username] [database_name] < [database_name].sql

7 New DataTypes for SQL Server 2008

For a database administrator , please aware that SQL Server 2008 will now have new datatypes as below are the list.

DATE – ANSI-compliant date data type
TIME – ANSI-compliant time data type with variable precision
DATETIMEOFFSET – timezone aware/preserved datetime
DATETIME2 – like DATETIME, but with variable precision and large date range
GEOMETRY – “flat earth” spatial data type
GEOGRAPHY – “round earth” spatial data type
HIERARCHYID – represents hierarchies using path enumeration model

The first four datatypes are regular SQL datatypes but the last three datatypes are exposed as .NET system UDTs.