MySQL5.7 database installation and configuration

Install MySQL5.7 under Windows10

First of all, we need to obtain the MySQL installation package. It is recommended to install the decompressed version of MySQL 5.7. Baidu searched for MySQL to find the official website of MySQL. It is better to download the development tools from the official website. Why...not much to say...

Here is the download address of MySQL5.7 for everyone, because the new MySQL8 has just been launched. Stability needs to be verified by the market, so high versions are not considered, but according to the official MySQL documentation, the speed is twice that of MySQL 5.7, which sounds scary~~~

Download address of MySQL5.7: https://dev.mysql.com/downloads/mysql/5.7.html#downloadsInsert picture description here
Insert picture description here

After the download is complete, put it into a directory without a Chinese path. Because of my computer disk problem, I chose to extract it to

D:\Program Files\MySQL

It is recommended that you decompress it to a drive letter other than the C drive, the reason you know...

The directory structure after decompression:
Insert picture description here

Here you need to create a my.ini file. Create a new txt text, change the suffix name to ini, and name the file name as my. Open and edit with notepad++. After editing the file, be sure to save it in ANSI format! ! ! Save in ANSI format! ! ! Save in ANSI format! ! !

At present, the configuration file in this my.ini is enough for us to learn and use, and we will modify part of the content according to actual needs later. Now the main role of this file is to provide support for the basic configuration of the MySQL database and during the installation process, such as the location of the datadir directory, which will be created during the installation process.

[client]
port = 3306
 
[mysqld]
#设置3306端口
port = 3306
# 设置mysql的安装目录 tips:这里的目录是你自己的安装目录,这个是我的安装目录,你不能用的哦
basedir=D:\Program Files\MySQL
# 设置mysql数据库的数据的存放目录 tips:同上一条
datadir=D:\Program Files\MySQL\data
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
 
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8

Now initialize MySQL. Open the command prompt CMD and switch to the bin directory in your MySQL unzipped directory. Start playing commands! ! !

Tips:

1. If it is windows10, you need to use the administrator to open
2. If there is a missing dll file, Baidu downloads the corresponding VC++ library from the MS official website

First enter the following command to initialize MySQL:

mysqld --initialize --user=mysql --console 

Insert picture description here

A random temporary password will be generated at the end of the operation, which must be saved . It’s better to save it in text in case you lose it

Insert picture description here
(If the initialization fails, the display is not warning but error.
Solution: ①Try to initialize after downloading and running vcredist.exe
②If it has already been run, it still does not work, delete the data folder in the directory structure and try to initialize again)

Initialization is complete, start to install MySQL

6-s?dzlv&e)F

mysqld --install mysql

Insert picture description here

Enter the name to start MySQL:

net start mysql

Enter the command to enter the mysql database

mysql -uroot -p

Hit enter, then copy the initialization password you just saved, you can enter the MySQL database

Insert picture description here

Modify your MySQL password. Don't forget, the initialization password is a bit anti-human, you know.

mysql>set password=password('新密码'); #新密码是你自己的密码,一定要有分号结尾

Next, in order to facilitate the operation, configure the environment variables, as at the time of the JDK, the content to be configured is as follows:

添加:
	变量名:MYSQL_HOME
	变量值:D:\Program Files\MySQL #这里是你自己的安装路径
编辑:
	变量名:path
	最后添加上:;%MYSQL_HOME%\bin;

Insert picture description here
Insert picture description here

After the operation is completed, it is OK! ! ! In the current situation, MySQL is self-starting after booting. If you want to turn off self-starting, please Baidu! ! ! Enter exit at the command line to exit mysql. Done!!!

Guess you like

Origin blog.csdn.net/xue_yun_xiang/article/details/115141136