install the MySQL server side using the following three commands, respectively, and the client
sudo apt-get install mysql-server
sudo apt-get isntall mysql-client
sudo apt-get install libmysqlclient-dev
During installation, you will be prompted to set a password or something, note that the settings do not forget that after the installation is complete, you can use the following command to check if the installation is successful:
Check if the installation was successful
netstat -tap | grep mysql
after the above command is checked, if you see a socket with MySQL in the Listen state, the installation is successful.
The MySQL database can be used with the following commands:
mysql -u root -p
- u means to select the login user name,-p indicates the login user password, the above command input will prompt for a password, then enter the password can log in to MySQL.
Create a database First MySQL entry: gbk:create database test2 DEFAULT CHARACTER SET GBK COLLATE gbk_chinese_ci; Utf8:create DATABASE ' test2 ' DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci; eg:[[email protected] test]# Mysql-u Root-penter Password:welcome to the MySQL monitor. Commands end with; or \g.your MySQL connection ID is 5Server version:5.1.30-community mysql community Server (GPL) Type ' help; ' or ' \h ' for H Elp. Type ' \c ' to clear the buffer.mysql> CREATE DATABASE ' test ' DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci; Query OK, 1 row affected (0.06 sec) mysql> show databases;+--------------------+| database |+--------------------+| Information_schema | | cacti | | mysql | | test | |+--------------------+5 rows in Set ( 0.07 sec) This test library is in utf-8 format.
From for notes (Wiz)
Ubuntu MySQL Database installation