How to install mysql for linux ubuntu
This article mainly explains "linux ubuntu how to install mysql", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "linux ubuntu how to install mysql" bar!
Linux ubuntu install mysql method: 1, open the terminal, update the software package list; 2, through "$sudo apt-get install mysql-server mysql-client" to install MySQL;3, use the root account to log in.
The operating environment of this paper: ubuntu 16.04system, mysql8, Dell G3.
[Linux] installation and use of MySQL in Ubuntu16.04 environment
Recently, I have been writing a small feature that wants to store data in MySQL, so install MySQL on the Ubuntu16.04 installed on the local virtual machine for use. Here is the process of installation and easy use.
1. Operation environment
Ubuntu16.04
two。 Open the terminal and update the list of software packages
$sudo apt update
3. Install MySQL
$sudo apt-get install mysql-server mysql-client
The following window will appear during the installation process, where you need to fill in the password of MySQL's root account and confirm
4. Initialize the MySQL security script
$sudo mysql_secure_installation
Mysql_secure_installation will involve whether to change the password of the root account, whether to remove anonymous users, whether to allow remote login, whether to delete the test database, and so on.
5. After installation, we first log in with the root account and enter the password of the root account set during the installation.
$mysql-u root-p
6. Create MySQL databases and users
$create database blogdata; # create a database named blogdata $grant all on blogdata.* to 'bloguser' identified by' test1234'; # create user bloguser
You can view the database:
$show databases
7. Log out of the root account (quit) and log in to MySQL with the newly created user
$mysql-u bloguser-p blogdata
8. Create a tabl
CREATE TABLE article (id INT, name VARCHAR, created_time DATETIME, view_num INT, com_num INT, channel VARCHAR (20), get_time DATETIME)
9. Insert data
INSERT INTO article (id,name,created_time,view_num,com_num,channel,get_time) VALUES (1, "test", "2019-11-20 10:00:00", 2 bky, "2019-11-22 14:00:00")
10. Simple query
Select * from article
11. Other commands
Exit the MySQL command line:
Mysql > quit
View the running status of MySQL:
$sudo systemctl status mysql.service
Stop the MySQL database service:
$sudo systemctl stop mysql.service
Start the MySQL database service:
$sudo systemctl start mysql.service
Restart the MySQL database service:
$sudo systemctl restart mysql.service
View the MySQL configuration file:
$sudo vim / etc/mysql/mysql.conf.d/mysqld.cnf Thank you for reading, this is the content of "how to install mysql in linux ubuntu". After the study of this article, I believe you have a deeper understanding of how to install mysql in linux ubuntu, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!