Home > Database > Mysql Tutorial > mysql default installation

mysql default installation

WBOY
Release: 2023-05-20 11:27:38
Original
751 people have browsed it

MySQL is a free, open source relational database management system that is widely used in various web applications and is one of the most popular databases today. This article will describe how to install MySQL by default in the Linux operating system.

The installation process of MySQL is quite simple and can be installed automatically through the package manager or manually downloaded and installed. Popular Linux distributions such as Ubuntu, Debian and CentOS all provide the default version of MySQL. We can enter the following command in the terminal window to check whether MySQL has been installed:

mysql --version
Copy after login

If MySQL has been installed, it will be returned MySQL version information, otherwise it will prompt that the command is not found.

If MySQL is not installed, we can use the following command to install it:

Ubuntu and Debian:

sudo apt-get update
sudo apt-get install mysql-server
Copy after login

CentOS:

sudo yum update
sudo yum install mysql-server mysql
Copy after login

During the installation process , we need to set the MySQL root user password, which is the key to managing the database.

After the installation is complete, we can start the MySQL service through the following command:

Ubuntu and Debian:

sudo service mysql start
Copy after login

CentOS:

sudo systemctl start mysqld
Copy after login

You can use the following command To confirm whether MySQL is running:

sudo service mysql status
Copy after login

We can also use the following command to stop the service:

Ubuntu and Debian:

sudo service mysql stop
Copy after login

CentOS:

sudo systemctl stop mysqld
Copy after login

Sometimes, we need to access the MySQL server through remote connection, and the MySQL configuration file needs to be modified to allow remote connections. We can use the following command to open the MySQL configuration file:

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Copy after login

In the opened MySQL configuration file, we need to find the following line:

bind-address = 127.0.0.1
Copy after login

Comment it out:

#bind-address = 127.0.0.1
Copy after login

Save the file and restart the MySQL service.

In addition, we can also connect to the MySQL database through the following command:

mysql -u root -p
Copy after login

This command will prompt for the MySQL root user password and open the MySQL command line terminal.

MySQL is not safe after default installation. Managing database security is crucial. We should learn how to protect and encrypt databases, establish access control lists and firewall rules to protect databases from hackers.

In short, MySQL is a popular relational database management system, and it is very simple to install the MySQL version through the package manager. We can use some commands to control the starting and stopping of the MySQL service. Additionally, to make the MySQL server more secure, basic database administrator skills are required to protect it from hackers.

The above is the detailed content of mysql default installation. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template