Home >Database >Mysql Tutorial >How to install and start MySQL in Ubuntu system
MySQL is a popular relational database management system that supports multiple operating systems, such as Linux, Windows and Mac OS. In this article, we will introduce how to install and start MySQL in Ubuntu system.
1. Install MySQL
sudo apt-get update
sudo apt-get install mysql-server
sudo systemctl status mysql
If the MySQL service has been started, "active (running)" will be displayed; otherwise, you The service needs to be started manually.
sudo systemctl start mysql
sudo systemctl enable mysql
2. Connect to the MySQL server
mysql -u root -p
This command will prompt you for the MySQL root user password. After entering your password, you will enter the MySQL shell.
3. Common MySQL commands
The following are some commonly used MySQL commands:
CREATE DATABASE dbname;
DROP DATABASE dbname;
CREATE TABLE tablename (column1 datatype, column2 datatype, column3 datatype, ...);
DROP TABLE tablename;
INSERT INTO tablename (column1, column2, column3, ...) VALUES (value1, value2, value3, ...);
SELECT column1, column2, ... FROM tablename WHERE condition;
UPDATE tablename SET column1 = value1, column2 = value2, ... WHERE condition;
DELETE FROM tablename WHERE condition;
4. Summary
MySQL is a relational database management system that is easy to learn, easy to use, safe and reliable. In this article, we introduce how to install and start MySQL in Ubuntu system, and introduce some commonly used MySQL commands. I hope this article will help you understand MySQL.
The above is the detailed content of How to install and start MySQL in Ubuntu system. For more information, please follow other related articles on the PHP Chinese website!