MySQL免安裝配置(windows)

一、配置MySQL的環境變量java

二、在${MYSQL_HOME}目錄下建立data文件夾mysql

三、將my-default.ini重命名爲my.ini,並做如下修改:    sql

    basedir=...數據庫

    datadir=...ide

    port=...ui

[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

三、初始化MySQL數據庫(管理員身份)this

方式1:mysqld --initialize-insecure --user=mysql --console
方式2:mysqld --initialize --user=mysql --console (生成臨時密碼)

四、安裝數據庫服務code

mysqld -install

五、啓動MySQL服務,右鍵「計算機」>"管理">"服務與應用程序">"服務"server

net start mysql

六、登陸數據庫rem

mysql -uroot -p

七、修改數據庫密碼,同時將"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;
相關文章
相關標籤/搜索