Archive for December, 2009

While working on Mysql server many security experts’ recommend for changing passwords frequently to enhance security. It is nothing difficult to change the password of SQL Server Users, you can easily change the password on a SQL Server Username via Query Analyzer. Changing the password with Query Analyzer makes easy to synchronize change the password on the database server at the same time as it is changed in the connection string. This method provides the flexibility for changing the password at the most suitable time for the application.

To change the SQL Server Username password, just you need to connect to the database with “Query Analyzer” using the SQL Server Username which is going to be updated along with the current password and then run:

“sp_password” to change the password.
sp_password [ [ @old = ] ‘old_password’ , ]
{ [ @new =] ‘new_password’ }
[ , [ @loginame = ] ‘login’ ]
The Office Microsoft Documentation for sp_password
Here is a plain example that changes the current password from
“currentPSWD” to “newPSWD”;
sp_password ‘currentPSWD’, ‘newPSWD’

Make sure to use a strong password, (”newPSWD” as demonstrated above is just an example) and do a quick test to confirm that the new password is working, close Query Analyzer and then re-connect with the new password.

It is obvious, but still difficult to remember to change the password in your connection string if this SQL Username is used in your code. Once you’ve changed the password and confirmed after testing it with Query Analyzer, make sure to update the connection string with the new password and confirm that the whole thing working properly.

Mysqldump program can be used to dump the contents of a MySQL database and allow the transfer of a MySQL database and MySQL tables between different MySQL servers. The SQL statements can be redirected to a file however you should be sure that there is no activity going on while you process for this. Firewalls will not block the access to the MySQL database, A small PHP script which has to be copied to the webserver encapsulates and encrypts the access to the MySQL database.

The mysqldump program supports the following options;

-#, –debug=[options] Output debug information to log. Generally ‘d:t:o,filename`. See Appendix C for further details.
-?, –help Display usage information and exit.
-c, –compleat-insert Generate complete insert statements. (Don’t exclude values that conform to the column default.)
-h, –host=[hostname] Connect to hostname.
-d, –no-data Export only schema information. (Exclude data.)
-t, –no-create-info Export only data, exclude table creation information. (The opposite of -d.)
-p, –password=[password] The password to use when connecting to the web server. Note there can be no space between the -p and the password.
-q, –quick Don’t buffer query results, dump directly to STDOUT.
-u, –user=[username] Username for login. mysqldump will assume you wish to use your current login name if this option is excluded from the command line.
-v, –verbose Print verbose information about the various execution stages of mysqldump.
-P, –port=[port] The port to use when connecting to
-V, –version Output mysqldump version information and exit.

It also enable you to pipe the output of mysqldump to the MySQL client program to replicate a database but you should make sure-no updates are taking place while you’re doing this.

EXAMPLE:
mysqladmin create foo
mysqldump mysql | mysql foo

Hope this help!