Home > Database > Mysql Tutorial > body text

How to configure mysql after downloading it

下次还敢
Release: 2024-04-05 16:54:23
Original
547 people have browsed it

In order to configure the downloaded MySQL, you need to complete the following steps: download MySQL and install it; initialize MySQL; modify the configuration file (change the root password, set connection parameters); create the mysqld service; start MySQL; connect through the MySQL shell Go to MySQL; create database and user.

How to configure mysql after downloading it

MySQL configuration guide after downloading

1. Download MySQL

Visit the MySQL official website https://www.mysql.com/downloads/ to download the MySQL version suitable for your operating system.

2. Install MySQL

Follow the instructions in the installation wizard to install. Make sure to select the "Custom" installation option so you can choose the installation path and configuration options.

3. Initialize MySQL

After the installation is complete, open a command prompt or terminal window and run the following command:

<code>mysql_install_db --user=mysql --basedir=/path/to/mysql --datadir=/path/to/data</code>
Copy after login

4 . Configure MySQL

  • Modify the configuration file

Open the MySQL configuration filemy.cnf (usually located at /etc/mysql/my.cnf or /usr/local/mysql/etc/my.cnf), make the following modifications as needed:

  • Change root password: Find the [mysql] section and add password=new_password.
  • Set connection parameters: Adjust settings such as bind-address, port, and max_connections to suit your specific need.
  • Create the mysqld service

On a Linux system, run the following command to create the mysqld service:

<code>sudo systemctl enable mysqld</code>
Copy after login

On Windows systems, run the following command to create the mysqld service:

<code>net start mysql</code>
Copy after login

5. Start MySQL

Use the following command to start MySQL:

<code>sudo systemctl start mysqld</code>
Copy after login

6. Connect to MySQL

Use the following command to connect to MySQL through the MySQL shell:

<code>mysql -u root -p</code>
Copy after login

Enter the root password you set in step 4.

7. Create a database and user

Create a database and user:

<code>CREATE DATABASE database_name;
CREATE USER 'username' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON database_name.* TO 'username';</code>
Copy after login

Now, you have successfully configured MySQL.

The above is the detailed content of How to configure mysql after downloading it. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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 Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template