1. Download The jdbc driver:
Http://dev.mysql.com/downloads/connector/j/
2. Add the jdbc jar package to the libs directory of the project and build path.
2. Modify the environment variable: export PATH =/usr/local/mysql/bin/: $ {PATH}
3. No Password for root @ localhost by default
4. Change the password:
Command Line: mysqladmin-u root-p password root
Commands in the MYSQL environment:
Mysql> UPDATE mysql. user SET password = PASSWORD ('new password') WHERE User = 'root ';
Mysql> flush privileges;
5. Restart mysql
/Library/StartupItems/MySQLCOM restart
Stop mysql
/Library/StartupItems/MySQLCOM stop
6. Go to test
Mysql-u root-proot
Use test
7. Create a new test table
Create table table1 (username varchar (20) primary key, password integer );
8. Insert Test Data
Insert into table1 values ('yyz', 123456 );
Insert into table1 values ('pengk', 123456 );
Insert into table1 values ('yjj ', 123456 );
Insert into table1 values ('pj, 123456 );
Insert into table1 values ('cl', 123456 );
9. write code