Install MySQL under Ubuntu

Source: Internet
Author: User

Now the software is more and more good to install, especially in Ubuntu under the installation of software, there is no skill, just need to use apt-get inatll in the case of networking. Before you decide to install MySQL, determine if the system already has MySQL installed. Such as:

  

It can be seen that MySQL is not installed in the system. Perform the sudo apt-get install Mysql-server my-client below. :

Enter y into the installation interface, during the installation process, will pop up an interface required to enter the root of the MySQL password, here must input, save the installation and then set the password. Such as

Then you will be asked to confirm, then lose again, then the system will automatically install MySQL until completed.

After the MySQL installation is complete, we can check to see if the system already has the MySQL service through Netstat-tap|grep MySQL, for example,

The above information appears stating that we have successfully installed MySQL.

The following is a simple configuration

After the installation is complete, modify the/ETC/MYSQL/MY.CNF (this file is the MySQL profile). Comment out the binding-address=127.0.0.1 in the file. Other configurations are changed as needed.

Login Database command: mysql-u root-p Enter the password we set earlier, you can log in successfully.

If you want to see the character set used by the database, you can enter show variables like ' character% ';(note that semicolons must not be omitted)

If you want to change these, you can change them in my.cnf.

This installs MySQL successfully.

Introduce several common commands for MySQL

First, the library operation

1. Create a database
Command: Create databases < database name >
For example, to create a database named Test
mysql> CREATE DATABASE test;
2. Show all databases
Command: Show databases

mysql> show databases;
3. Delete Database
Command: Drop databases < database name >
Example: Delete a database named test
mysql> drop database test;
4. Connect to the database
Command: Use < database name >
For example: If the test database exists, try to access it:
mysql> use test;
Screen tip: Database changed
5. View the database currently in use
Mysql> Select Database ();

6. The current database contains table information:
Mysql> Show tables;

MySQL's exit command is quit or exit. When I quit, I entered exit and asked me to add one more;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.