mysql 5.7.12 winx64 Installation configuration method graphic tutorial
- 2020-12-26 05:56:25
- OfStack
I didn't make a summary when installing mysql before, so I replaced it with a new computer and added the installation record. During the installation, I found some installation records of netizens and found a lot of pits
1. mysql-5.7.12-winx64.zip download
The official download address: http: / / dev mysql. com/downloads mysql /
2. Unzip to C:\job\mysql-5.7.12-winx64
3. Create a new my.ini configuration file under C:\job\ mysql-5.7.12-ES26en64
It is as follows:
#################### Configuration file start ###################
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** 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
[mysqld]
port=3306
basedir ="C:\job\mysql-5.7.12-winx64/"
datadir ="C:\job\mysql-5.7.12-winx64/data/"
tmpdir ="C:\job\mysql-5.7.12-winx64/data/"
socket ="C:\job\mysql-5.7.12-winx64/data/mysql.sock"
log-error="C:\job\mysql-5.7.12-winx64/data/mysql_error.log"
#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="C:\job\mysql-5.7.12-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"
skip-grant-tables
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#################### End of profile ###################
The key is the following configuration, where the directory name of datadir must be: C:\job\ ES37en-5.7.12-ES38en64 /data/, plus ES40en-ES41en-ES42en to make root password-free and login
4. In windows system environment variable path, add the following contents
C: \ job \ mysql 5.7.12 - winx64 \ bin; (Notice the semicolon.)
5. Register mysql as windows system service
The specific action is to execute the following command from the command line (you need to run the command line as an administrator) :
cd C:\Windows\System32
Run ES63en.exe as an administrator
You need to switch to the bin directory, otherwise the service directory will be specified as C:\job\ ES69en-5.7.12-ES70en64 \bin
Add service command: mysqld install MySQL -- ES77en-ES78en ="C:\job\ ES81en-5.7.12-ES82en64 \ my.ini"
The remove service command is: mysqld remove
6. After step 5 is successful, initialize the data directory
C:\job\mysql-5.7.12-winx64\bin
>
mysqld --initialize
This step is important and uninitialized, which could cause the mysql service to fail to start (pit 1)
7. Open system service management
You can see the mysql system service
Start the mysql command from the command line: net start mysql
Turn off the mysql command: net stop mysql
8. Modify the root password
Command line execution:
mysql � uroot
mysql>show databases;
mysql>use mysql;
mysql> update mysql.user set authentication_string=password('12345') where user='root' and Host = 'localhost';
mysql> alter user 'root'@'localhost' identified by '12345';
mysql> FLUSH PRIVILEGES;
mysql> QUIT
Pit 2: The Password field is no longer in the user table under the new version of the mysql database. Instead, the encrypted user password is stored in the authentication_string field
9. Remote login configuration
root users are allowed to remotely log in from anywhere and have all library operation permissions as follows:
1) Use root to log in mysql before the machine:
Command line execution: ES136en-ES137en ES138en-ES139en
Enter the password (the password set in step 7) : 12345
2) Authorization operation:
mysql > GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '12345' WITH GRANT OPTION;
Overload authorization table:
mysql > FLUSH PRIVILEGES;
Exit mysql: quit
Special Topics:
Installation tutorial for different versions of mysql
mysql 5.7 installation tutorial for each version
mysql 5.6 Installation tutorial for each version
mysql8.0 Installation tutorial for each version