Windows安装Mysql Zip绿色版

安装服务

REM 自动启动
mysqld --install
mysqld --defaults-file="D:\Program Files\mysql\mysql.ini" --initialize --explicit_defaults_for_timestamp
net start mysql

REM 手动启动
mysqld --install-manual
mysqld --defaults-file="D:\Program Files\mysql\mysql.ini" --initialize --explicit_defaults_for_timestamp
net start mysql

REM 卸载服务
mysqld --remove
# mysql.ini 内容
[mysql]
default-character-set=utf8
 
[mysqld]
basedir = D:\Program Files\mysql
datadir = D:\Program Files\mysql\data
port = 3306
max_connections=200
character-set-server=utf8
default-storage-engine=INNODB
 
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

初始密码

查看Data目录下**.err文件,搜索"password is generated",结束就是初始密码

mysql初始密码是无法作为登陆使用的,所以登陆mysql必须修改自动生成的密码。

mysql -u root -h 127.0.0.1 -p
Enter password: (enter the random password here)
 
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');
mysql> flush privileges;

There are no comment yet.

HTML tag cannot be used in this comment.