[MySQL Advanced Road丨Part 2] Database Installation and Configuration

insert image description here

[MySQL Advanced Road丨Part 2] Database Installation and Configuration

Method 1: Execute the command with the command line tool

Download address: MySQL download address

After entering the URL, click MySQL Community Server:
insert image description here

Select version:

insert image description here

We choose version 5.7.24 in the historical version

insert image description here

Install to the MySQL folder on the D drive

insert image description here

Copy the bin directory path after decompression

insert image description here

Add the bin directory path to the Path of the system variable

insert image description here

Then add a configuration file mysql.ini and a data folder in the D:\Software\MySQL\mysql-5.7.24-winx64 directory

The content of the mysql.ini file is as follows:

[mysql]

# 设置mysql客户端默认字符集
default-character-set=utf8 

[mysqld]

#设置3306端口
port = 3306


# 设置mysql的安装目录
basedir=D:\Software\MySQL\mysql-5.7.24-winx64

# 设置mysql数据库的数据的存放目录
datadir=D:\Software\MySQL\mysql-5.7.24-winx64\data

# 允许最大连接数
max_connections=200

# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8

# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB

insert image description here

win+R to open the control panel, input mysqld install, the page echoes successful installation

insert image description here

NOTE If you get an error message when running a command
in cmd , this is usually due to a permission issue. To resolve this issue, there are a few things you can try:mysqld installInstall/Remove of the Service Denied!

  1. Run cmd as administrator : Right-click on "Command Prompt" or "Windows PowerShell" and select "Run as Administrator". This will provide increased permissions and privileges to perform the install operation.

  2. Make sure you have proper permissions : Check that your user account has sufficient permissions to install the service. Make sure you are an administrator on the computer or have appropriate privileges.

  3. Check firewalls and security software : Some firewalls or security software may restrict the creation or modification of system services. Temporarily disable any firewall or security software, and retry running the "mysqld install" command.

insert image description here
insert image description here
Enter net start mysqlto start the service, the page will displayStart successfully

After the startup is successful, enter mysql -u root -pand continue to press Enter.

insert image description here

Then enter again in cmd net start mysqlto start the service

insert image description here

After successful startup, entermysqladmin -u root -p password

insert image description here

Enter on the line enter password

Then set a password to suggest setting a simple and easy-to-remember password such root、useras

If we want to log in to the local MySQL database, we only need to enter the following command:

mysql -u root -p

Press Enter to confirm, if installed correctly and MySQL is running, you will get the following response:

Enter password:

If the password exists, enter the password to log in, if it does not exist, press Enter to log in directly. After successful login, you will see the following prompt:

Welcome to the MySQL monitor…

At this point, the installation and configuration of MySQL has been completed.

Method 2: Install MySQL with msi

If you have multiple errors when using method 1 to install and configure the database, you can use method 2 to install MySQL.

Download link: MySQL download address

As shown in the picture:

insert image description here
As shown in the picture:

insert image description here

As shown in the picture:

insert image description here
As shown in the picture:

insert image description here

install to folder

The steps are as shown in the figure:

insert image description here

As shown in the picture:

insert image description here
Wait for the download to complete

insert image description here
The steps are as shown in the figure:

insert image description here
The configuration is as follows:

insert image description here
The steps are as shown in the figure:

insert image description here
Proceed as follows:

insert image description here

Proceed as follows:

insert image description here
Proceed as follows:

insert image description here
Proceed as follows:

insert image description here
Proceed as follows:

insert image description here
Proceed as follows:

insert image description here

Proceed as follows:

insert image description here
Proceed as follows:

insert image description here
After that click continuouslyFinishcan

If the following page appears, the installation is successful:

insert image description here
OpenCommand Line Client

insert image description here
Enter the password: rootto use MySQL

insert image description here

Summarize

The above is[MySQL Advanced Road丨Part 2] Database Installation and Configuration

Follow-up will share [MySQL Advanced Road丨Part 3]MySQL management and connection

I am Qiu said , see you next time.

Guess you like

Origin blog.csdn.net/2301_77485708/article/details/131270255