MySQL免安装配置(windows)

原创
2017/01/07 22:42
阅读数 88

1、配置MySQL的环境变量

2、在${MYSQL_HOME}目录下创建data文件夹

3、将my-default.ini重命名为my.ini,并作以下修改:    

    basedir=...

    datadir=...

    port=...

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
basedir=D:/Install/mysql-5.7.13
datadir=D:/Install/mysql-5.7.13/data/
port=3306

# server_id = .....

character-set-server=utf8
default-storage-engine=INNODB

# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M

sql_mode=STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

3、初始化MySQL数据库(管理员身份)

方式1:mysqld --initialize-insecure --user=mysql --console
方式2:mysqld --initialize --user=mysql --console (生成临时密码)

4、安装数据库服务

mysqld -install

5、启动MySQL服务,右键“计算机”>"管理">"服务与应用程序">"服务"

net start mysql

6、登录数据库

mysql -uroot -p

7、修改数据库密码,同时将"localhost"修改为"%",防止出现"java.sql.SQLException: null,  message from server: "Host '***' is not allowed to connect to this *** server"

use mysql;
alter user 'root'@'%' identified by '123456';
flush privileges;

 

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部