mysql installation version configuration

WBOY
Release: 2023-05-12 10:01:07
Original
458 people have browsed it

MySQL is an open source relational database management system that is widely used in web development, data analysis, data mining and other fields. MySQL has the characteristics of low cost, high performance, stability, reliability, and ease of use, and has been widely used by many enterprises and individuals. This article will introduce the configuration method of the MySQL installation version.

1. Download the installation file

MySQL official website provides various versions of MySQL, the most commonly used of which is MySQL Community Edition. Users need to select the corresponding MySQL Community Edition to download according to their operating system version. After the download is complete, double-click the installation file and install according to the system prompts.

2. Install MySQL

  1. Agree to the license agreement

During the installation process, you first need to agree to the MySQL license agreement. Click "I Accept" to proceed to the next step.

  1. Select the installation type

MySQL provides three installation types, including:

  • Developer Default
  • Server Only
  • Custom

In this article, we choose the Custom installation type. After clicking "Custom", users can customize MySQL installation path and other options.

  1. Select the installation location

Users can choose the installation location of MySQL. In this example, we choose the C drive for installation. Click "Next" to continue to the next step.

  1. Start installation

The installation process is expected to take a few minutes, users can wait patiently.

  1. Installation completed

After the installation is completed, the user will be prompted whether to start the MySQL service. To start the MySQL service, select "Yes", otherwise select "No".

3. MySQL configuration

After the MySQL installation is completed, some basic configuration is required to ensure that MySQL runs normally and can be connected by other applications.

  1. Start the MySQL service

If you choose to start the MySQL service during the MySQL installation, MySQL will start automatically. If not selected, you need to start the MySQL service manually.

The method to manually start the MySQL service is:

  • Find the "MySQL" program group in the start menu.
  • Select "MySQL Server 8.0"->"MySQL 8.0 Command Line Client".
  • Use the following command to start the MySQL service:

mysql -u root -p

You need to enter the administrator password to enter the MySQL management interface.

  1. Change the administrator password

After the installation is completed, the administrator account password is blank by default, so you need to set the administrator account password. In the MySQL management interface, use the following command to change the administrator password:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

Among them, new_password is the new password, please set it A password that is complex yet easy to remember.

  1. Configure firewall rules

If you need to access the MySQL server, you need to ensure that the firewall allows remote access to the MySQL service port. By default, MySQL uses port 3306. Users can open the corresponding TCP ports according to their own needs. In Windows systems, you can configure it through the following steps:

  • Open "Control Panel"->"Windows Defender Firewall"->"Advanced Settings".
  • Select "Inbound Rules"->"New Rule".
  • Follow the prompts to set the rules, select the "Port" type, and enter the TCP 3306 port.
  • Save settings and close the window.

4. Connect to MySQL

After the MySQL installation is completed, you can connect to MySQL through other applications to perform data operations. When connecting to MySQL, you need to provide the correct user name, password, host name, port and other information.

In the Java program, the code example for connecting to MySQL is as follows:

try {

// 加载MySQL驱动 Class.forName("com.mysql.cj.jdbc.Driver"); // 建立MySQL连接 Connection connection = DriverManager.getConnection( "jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC","root","password"); // 进行数据操作
Copy after login

} catch (Exception e) {

e.printStackTrace();
Copy after login

}

Among them, "localhost" is the MySQL server address, "test" is the database name, "root" is the user name, and "password" is the password. It needs to be modified according to the actual situation.

Summary

This article introduces the configuration method of the MySQL installation version, including downloading the installation file, installing MySQL, MySQL configuration and connecting to MySQL. As an open source and free relational database management system, MySQL has broad application prospects. From a developer's perspective, you need to master the basic operating methods of MySQL and understand the advantages and disadvantages of MySQL.

The above is the detailed content of mysql installation version configuration. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!