(1) Mysql installation and configuration

1. Mysql download

  1. Official website download address: https://www.mysql.com/downloads/
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
  2. If for project requirements, you need to download the old version if
    https://dev.mysql.com/downloads/
    Insert picture description here
    Insert picture description here
    version of Download: https://downloads.mysql.com/archives/community/ (later if troublesome can enter this address downloaded)
    Insert picture description here
  3. The form of mysql we download here is in the form of compressed package, because it is so convenient, it will not cause unnecessary trouble when it is removed.
  4. After decompressing the compressed package, we can configure the corresponding mysql

2. Mysql configuration

  1. Configure MYSQL_HOME, this is the directory where our mysql is decompressed
    Insert picture description here
    Insert picture description here
  2. Add mysql bin directory on Path variable
    Insert picture description here
    Insert picture description here
  3. New mysql configuration file to the end of the .ini (my.ini here for an example)
    Insert picture description here
    the specific content of my.ini
[mysqld]
# 目录一定要切换成自己的安装目录
basedir = F:\mysql-5.7.24-winx64
# 这里的data目录不需要手动建,后面通过命令初始化
datadir =F:\mysql-5.7.24-winx64\data
port = 3306
# 这里是为例跳过密码验证
skip-grant-tables

(--------- The following steps have been installed before, so it is the installation of the screenshot course, but the commands are the same except for the directory change ----------------)
4. Start CMD in administrator mode , and switch the path to the bin directory under mysql, then enter mysqld -install (install mysql)

mysqld -install

Insert picture description here
5. Initialize the data file
Here can help us generate the corresponding data file

mysqld --initialize -insecure --user=mysql

Insert picture description here
6. Start mysql

net start mysql

Insert picture description here
7. Enter mysql -u root -p
Insert picture description here
When the following characters are displayed, it means that the startup was successful (this is that our database has no password set)
Insert picture description here
8. After entering the interface, change the root password (this will change our database password to (123456)

update mysql.user set authentication_string=password('123456') where user='root' and Host='localhost';

Insert picture description here
9. Refresh permissions

flush privileges;

Insert picture description here
10. Modify the
skip-grant-tables in my.ini file to comment this line (because we have set a password)

[mysqld]
# 目录一定要切换成自己的安装目录
basedir = F:\mysql-5.7.24-winx64
# 这里的data目录不需要手动建,后面通过命令初始化
datadir =F:\mysql-5.7.24-winx64\data
port = 3306
# skip-grant-tables
  1. Log in to mysql with a password
mysql -u root -p123456

Insert picture description here

Thinking:

Attentive people may have discovered this wonderful use of skipping passwords. If our password is forgotten, we can set it in the configuration file of my.ini, and then complete a wave of raccoon cat to change the prince by changing the password above.

------------ The above content is the record after learning the mad god saying Java -------------------

Published 86 original articles · won praise 6 · views 7256

Guess you like

Origin blog.csdn.net/TheWindOfSon/article/details/105645608