Home >Database >Mysql Tutorial >mysql default installation

mysql default installation

WBOY
WBOYOriginal
2023-05-20 11:27:38755browse

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

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

CentOS:

sudo yum update
sudo yum install mysql-server mysql

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

CentOS:

sudo systemctl start mysqld

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

sudo service mysql status

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

Ubuntu and Debian:

sudo service mysql stop

CentOS:

sudo systemctl stop mysqld

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

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

bind-address = 127.0.0.1

Comment it out:

#bind-address = 127.0.0.1

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

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!

Statement:
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
Previous article:centos yum install mysqlNext article:centos yum install mysql