Cloud server Window Server 2012R System Installation MySQL detailed tutorial
- 2020-06-03 08:57:52
- OfStack
I used the cloud server of Aliyun to build a website for practice. I did not know how to build MySQL under Window Server 2012R2 system. Baidu finally solved the problem, so I wrote down the steps again in case I forgot to build next time.
1. Download the software package from MySQL official website
2. After decompression, put it in the corresponding hard disk. I put it in the E disk. Then make a copy of the configuration file my-ES12en.ini in the unzipped folder and name it my.ini. Then change the contents to the following
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[client]
default-character-set=utf8
port=3306
[mysqld]
port=3306
character_set_server=utf8
basedir ="E:\MySQL\mysql-5.7.17-winx64"
datadir ="E:\MySQL\mysql-5.7.17-winx64/data/"
tmpdir ="E:\MySQL\mysql-5.7.17-winx64/data/"
socket ="E:\MySQL\mysql-5.7.17-winx64/data/mysql.sock"
log-error="E:\MySQL\mysql-5.7.17-winx64/data/mysql_error.log"
character_set_server=utf8
#server_id = 2
#skip-locking
max_connections=100
table_open_cache=256
query_cache_size=1M
tmp_table_size=32M
thread_cache_size=8
innodb_data_home_dir="E:\MySQL\mysql-5.7.17-winx64\data"
innodb_flush_log_at_trx_commit =1
innodb_log_buffer_size=128M
innodb_buffer_pool_size=128M
innodb_log_file_size=10M
innodb_thread_concurrency=16
innodb-autoextend-increment=1000
join_buffer_size = 128M
sort_buffer_size = 32M
read_rnd_buffer_size = 32M
max_allowed_packet = 32M
explicit_defaults_for_timestamp=true
#sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
3. Enter the bin folder of MySQL under dos to carry out relevant commands
Enter the following three commands:
mysqld -console
mysqld --initialize
mysqld install
After successful configuration, an data folder will be generated under the mysql root directory.
4. Change your password
1. To my.ini, add 1 row under [mysqld] skip-ES37en-ES38en (ignore authorization table), which is a useful parameter when you forget the root password.
2. Start MySQL and type mysql-ES45en-ES46en in DOS to be user and p to be password. Remember that there should be no space between u and p and the user name and password.
3.
mysql> update mysql.user set authentication_string=password('12345') where user='root' and Host = 'localhost'
; In brackets is your password. Remember to have a semicolon at the end.
4. mysql > flush privileges;
5. mysql > quit;
6. Go back to the configuration file, delete the line ES68en-ES69en-ES70en and save and restart mysql.
7. Then change the password and use it
mysql>SET PASSWORD = PASSWORD('123456');
Once configured, you can access Mysql via DOS.