2、解压到任意路径,比如"D:\Programm Files\"。
3、进入MySQL路径,复制my-small.ini为my.ini,
在[mysqld]部分添加
basedir = "D:/Program Files/Mysql-5.5.10-win32"
datadir = "D:/Program Files/Mysql-5.5.10-win32/data"。
# 设置mysql服务器的字符集(可选)
default-character-set=gbk
[client]
# 设置mysql客户端的字符集(可选)
default-character-set=gbk
4、将MySQL的bin目录路径添加到系统变量里。(可选)
5、注册服务
CMD进入MySQL/bin文件夹
mysqld --install "MySQL Database Service" --defaults-file="D:\Program Files\MySQL-5.5.10-win32\my.ini"
("MySQL Database Service"为服务名,带空格需用引号,可自取)
("D:\Program Files\MySQL-5.5.10-win32\my.ini"为INI路径,带空格需用引号)
启动服务
net start "MySQL Database Service"
6、首次登陆MySQL
mysql -u root -p
(密码为空)
7、设置密码
mysql> use mysql
Database changed
mysql> update user set PASSWORD = PASSWORD('你的新密码') where USER='root' and HOST='localhost';
Query OK, 1 row affected (0.05 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges;
mysql> exit
mysql 简单sql语句
create database test1;
show databases;
use test1;
show tables;
drop database test1;
use test1;
create table testtable(name varchar(10), number int(10));
desc test;
show create table test \G; 查看详细的表定义
drop table test;