Common MySQL Commands


Command To Connect To MySQL Server :

mysql -u username -p password -h hostname -Pportnumber

Backup All The Databases From MySQL Server :

mysqldump -uroot -p password –all-databases > c:\backup_all_db.sql

Import SQL File To Specific Database In MySQL Server :

mysqldump -h hostname -uroot -proot -Pportnumber testdb < testdb.sql

Continue reading

Advertisements

Generate Random String Using MySQL


Have you ever wanted to generate a random string in MySQL, say for assigning a random password to a list of users?


SELECT SUBSTRING(MD5(RAND()) FROM 1 FOR 6) AS passwordString

This generates a 6 character string where the characters are taken randomly from the MD5 command (and therefore in the range a-z and 0-9).

Enjoy………

By Jagat Kothari Posted in MySQL Tagged

Help Saving MySQL


In April 2009, Oracle announced that it had agreed to acquire Sun. Since Sun had acquired MySQL the previous year, this would mean that Oracle, the market leader for closed source databases, would get to own MySQL, the most popular open source database.

If Oracle acquired MySQL on that basis, it would have as much control over MySQL as money can possibly buy over an open source project. In fact, for most open source projects (such as Linux or Apache) there isn’t any comparable way for a competitor to buy even one tenth as much influence. But MySQL’s success has always depended on the company behind it that develops, sells and promotes it. That company (initially MySQL AB, then Sun) has always owned the important intellectual property rights (IPRs), most notably the trademark, copyright and (so far only for defensive purposes) patents. It has used the IPRs to produce income and has reinvested a large part of those revenues in development, getting not only bigger but also better with time.
Continue reading