Thursday, July 29, 2010 22:20

MySQL Study Note

Tagged with:
Posted by Rexleed on Monday, January 5, 2009, 13:14
This news item was posted in MySQL category and has 0 Comments so far.

This is my study note about mysql :)

MySQL
==============================================
http://www.mysql.com

Usages
———————

System parameters
*select version(),user(),current_date,now();

Install/Remove MySQL service
*mysql -install|remove
*net start|stop mysql (this command will not work if use mysqld –standalone)
*mysqladmin -u root -p shutdown(it works in all status)

Commands
*Cancel the command \c

Backup the data
*mysqldump -u root -ppasswd user|othertable|–all-database>backup.sql

Load the data from text file
*load data local infile ‘data.txt’ into table user;
Format of data.txt: spaced out by tab, use “\n” to replace null.

Grant privilege to users
*grant select,insert,delete,update on mysql.* to newuser@localhost;

Change the password
* mysqladmin -u root -p[oldpassword] password [newpassword]

Frequently Asked Questions
———————————–

How to provide transaction?
*CREATE TABLE ‘tablename’()TYPE=innoDB;

Note
————————————
Hibernate’s MySQL dialect
*hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
*hibernate.connection.url=jdbc\:mysql\://localhost/lidnux?useUnicode\=true&characterEncoding\=utf-8  #pay attention to ‘\’
*hibernate.connection.driver_class=com.mysql.jdbc.Driver

Related Posts

Leave a Reply

You can leave a response, or trackback from your own site.