MySQL is a commonly used relational database management system that can run on various operating systems. In Linux systems, the installation and configuration of MySQL is very simple. Here are some basic steps to help you easily install and configure MySQL on your Linux system.
Step one: Download MySQL
Before installation, you need to download the latest installation package from the MySQL official website. You can go to https://dev.mysql.com/downloads/mysql/ to download and select the appropriate version to download.
Step 2: Install MySQL
After completing the download of MySQL, start the installation. Enter the following command in the terminal:
sudo apt-get update sudo apt-get install mysql-server
The above command will install the MySQL server from the APT repository. During the installation process, a prompt will appear asking you to enter the password of the MySQL root user. Remember this password as you may need to use it to access the MySQL database later.
Step 3: Start MySQL
After the installation is completed, the system will automatically start the MySQL server. However, if the server does not start automatically, please use the following command to start it manually:
sudo systemctl start mysql
Step 4: Configure MySQL
MySQL uses 127.0.0.1 as the server address by default. If you need to allow remote access to the MySQL server, you need to make some configurations.
First, edit the MySQL configuration file. Open a terminal and enter the following command:
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Find the bind-address
attribute in the configuration file and comment it out so that it becomes:
#bind-address = 127.0.0.1
Save changes After that, restart the MySQL server:
sudo systemctl restart mysql
Step 5: Set the MySQL user and password
After the installation is completed, MySQL has a root user by default (administrator user in the Linux system), and have set a password. If you want to create a new user or reset the password in MySQL, you can use the following command:
mysql -u root -p
Then enter the password of the MySQL root user and enter the MySQL console. In the console, you can execute the following command to create a new user:
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
username will be replaced with the new user's username, and password will be replaced with the new user's password. @'%' indicates that the user is allowed to access the MySQL server from any host. If you want to restrict this user to access the MySQL server from a specific host, you can replace @'%' with the IP address or hostname of the specific host.
Next, you can grant the new user permissions to access and manage MySQL databases using the following command:
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%';
This will grant the new user all the permissions of the root user, including access to and management of all MySQL databases . % means applicable to any host. If you need to restrict this user to managing a specific database, replace . with the specific database name.
After completing the above steps, you can successfully install and configure the MySQL server and start using the database to save and manage data.
The above is the detailed content of mysql linux installation configuration. For more information, please follow other related articles on the PHP Chinese website!

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 Linux new version
SublimeText3 Linux latest version

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 English version
Recommended: Win version, supports code prompts!
