当前位置:网站首页>Mysql database installation

Mysql database installation

2022-06-13 04:33:00 gohxc

mysql Database installation

Environmental Science :windows10

1. download mysql

Download address :https://dev.mysql.com/downloads/mysql/
Download the latest version :mysql-8.0.12-winx64.zip, Please download other versions by yourself
After downloading , We will zip Extract the package to the corresponding directory , Here I put the unzipped folder in C:\software\mysql-8.0.12 Next .

2. To configure mysql

stay Windows In the system , The configuration file is in the installation directory by default my.ini file ( or my-default.ini), Open the folder you just unzipped C:\software\mysql-8.0.12 , We found that the unzipped directory did not my.ini file , It's OK to create your own .
Create... Under this folder my.ini The configuration file , edit my.ini Configure the following basic information :

[mysql]
#  Set up mysql Client default character set 
default-character-set=utf8

[mysqld]
#  Set up 3306 port 
port = 3306
#  Set up mysql Installation directory 
basedir=C:\software\mysql-8.0.12
#  Set up mysql Database data storage directory 
datadir=C:\software\mysql-8.0.12\data
#  Maximum connections allowed 
max_connections=20
#  The character set used by the server defaults to 8 Bit coded latin1 Character set 
character-set-server=utf8
#  The default storage engine that will be used when creating a new table 
default-storage-engine=INNODB

View all configuration items , May refer to :https://dev.mysql.com/doc/refman/8.0/en/mysqld-option-tables.html

3. initialization mysql

Open as administrator cmd Command line tools , Toggle directory :
cd C:\software\mysql-8.0.12\bin
Initialize database :
mysqld --initialize --console
After execution , Will be output root User's initial default password , as follows :

C:\software\mysql-8.0.12\bin>mysqld --initialize --console
2018-09-10T01:47:14.402512Z 0 [System] [MY-013169] [Server] C:\software\mysql-8.0.12\bin\mysqld.exe (mysqld 8.0.12) initializing of server in progress as process 8272
2018-09-10T01:47:33.792827Z 5 [Note] [MY-010454] [Server] A temporary password is generated for [email protected]: SErl6hlv&vf%
2018-09-10T01:48:16.423314Z 0 [System] [MY-013170] [Server] C:\software\mysql-8.0.12\bin\mysqld.exe (mysqld 8.0.12) initializing of server has completed

C:\software\mysql-8.0.12\bin>

among [email protected]: hinder “SErl6hlv&vf%” It's the initial password . Before changing the password , You need to remember the code , Subsequent login needs to use .
   If your hands are cheap , It's closing fast , Or don't remember , That's OK , Delete the initialized datadir Catalog , Execute the initialization command again , It's going to regenerate .

4. Installation services

stay MySQL Installation directory bin Execute command under directory
mysqld –install [ service name ]
The following service name can be left blank , The default name is mysql. Of course , If you need to install more than one on your computer MySQL service , It can be distinguished by different names , such as mysql5 and mysql8. This use
mysqld --install mysql8

After installation , By order net start mysql start-up MySQL Service. . as follows :

C:\software\mysql-8.0.12\bin>mysqld --install mysql8
Service successfully installed.

C:\software\mysql-8.0.12\bin>net start mysql8
mysql8  The service is starting  ..
mysql8  Service started successfully .

C:\software\mysql-8.0.12\bin>

5. Change password

stay MySQL Installation directory bin Execute command under directory :
mysql -u root -p
You will be prompted to enter the password , Enter the password obtained above .
Change user password , stay MySQL Middle execution command :

 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ' Your password ';

The command contains ”;” Semicolon
Then input quit Exit and log in again

In general use SQLyog, Search and download .
1. Use sqlyog link mysql
Configuration new connection error : Wrong number 2058, The analysis is mysql Password encryption has changed .
resolvent :

// Use the above 5 Method to change the password 
 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

2. see mysql Port number :
show global variables like 'port';

原网站

版权声明
本文为[gohxc]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202280522159408.html