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
During the installation process, you first need to agree to the MySQL license agreement. Click "I Accept" to proceed to the next step.
MySQL provides three installation types, including:
In this article, we choose the Custom installation type. After clicking "Custom", users can customize MySQL installation path and other options.
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.
The installation process is expected to take a few minutes, users can wait patiently.
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.
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:
mysql -u root -p
You need to enter the administrator password to enter the MySQL management interface.
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.
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:
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"); // 进行数据操作
} catch (Exception e) {
e.printStackTrace();
}
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!