日期:2014-05-16 浏览次数:20744 次
# The following options will be passed to all MySQL clients [client] #password = your_password port = 3306 #设置mysql客户端的字符集 default-character-set = utf8 # The MySQL server [mysqld] port = 3306 #设置mysql的安装目录 basedir = D:\mysql-5.5.20-win32 #设置mysql数据库的数据存放目录,必须是data或者\xxx-data datadir = D:\mysql-5.5.20-win32\data #设置服务器段的字符集 character_set_server = utf8
mysqld --install mysql --defaults-file=d:\mysql-5.5.20-win32\my.ini
mysqld --install mysql
sc delete mysql
net start mysql
net stop mysql
mysql -h hostname -u username -p
mysql -hhostname -uusername -p
mysql -uroot -p
mysql -uroot -p
mysql> update mysql.user set password="root" where User="root"; mysql> flush privileges;
mysql -uroot -proot
show databases;--显示数据库 use databasename; --用数据库 show tables;--显示表 create table tablename(field-name-1 fieldtype-1 modifiers,field-name-2 fieldtype-2 modifiers,....);--创建表 alter table tablename add new-fielname new fieldtype--为表加入新列 insert into tablename(fieldname-1,fieldname-2,fieldname-n)valuse(value-1,value-2,value-n)--增 delete from tablename where fieldname=value--删 update tablename set fieldname=new-value where id=1--改 select * from tablename--查 desc tablename--表定义描述 show create table tablename--可以查看引擎 alter table tablename engine=InnoDB--修改引擎 create table tablename(id int(11),name varchar(10) )type=INNODB--建表是设置引擎
mysql> select now(),user(),version(); +---------------------+----------------+-----------+ | now() | user() | version() | +---------------------+----------------+-----------+ | 2012-02-26 20:29:51 | root@localhost | 5.5.20 | +---------------------+----------------+-----------+ 1 row in set (0.00 sec)