1.下載jdbc驅動:
http://dev.mysql.com/downloads/connector/j/
2.加入jdbc的jar包至項目的libs目錄並build path
2.修改環境變量:export PATH=/usr/local/mysql/bin/:${PATH}
3.默認root@localhost沒有密碼
4.修改密碼:
命令行:mysqladmin -u root -p password root
MYSQL環境中的命令:
mysql> UPDATE mysql.user SET password=PASSWORD(’新密碼’) WHERE User=’root’;
mysql> FLUSH PRIVILEGES;
5.重啟mysql
/Library/StartupItems/MySQLCOM/MySQLCOM restart
停止mysql
/Library/StartupItems/MySQLCOM/MySQLCOM stop
6.進入test
mysql -u root -proot
use test7.新建一張測試表
create table table1 (username varchar(20) primary key,password integer);
8插入測試數據insert into table1 values('yyz',123456);
insert into table1 values('pengkv',123456);
insert into table1 values('yjj',123456);insert into table1 values('pj',123456);
insert into table1 values('cl',123456);
9.書寫代碼