Install Mysql online on ubuntu and perform some operations

Source: Internet
Author: User
Tags mysql commands mysql login

Install Mysql online on ubuntu and perform some operations

Install Mysql online on ubuntu and perform some operations

1. Three commands used to install Mysql:

Open the terminal and enter sudoapt-get install mysql-server.

Enter sudoapt-get install mysql-client.

Enter sudo apt-get install libmysqlclient-dev.

2. installation steps:

Install mysql-server:

Set the mysql login password:

Confirm Password:

Installation result:

3. Install mysql-client:

<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + IDxpbWcgc3JjPQ = "http://www.2cto.com/uploadfile/Collfiles/20150127/20150127095542108.jpg" alt = "\">

4. Install libmysqlclient-dev:

Installation result:

5. After the installation is complete, run the following command to check whether the installation is successful:

  Sudonetstat-tap "grep mysql

If mysql socket is in the listen status, the installation is successful.

6. Enter mysql:

Access result:

7. Some SQL operations:

View All databases:

Create a database:

View the created database:

Enter the specified database:

Create a table:

View fields and some non-empty information:

Insert data:

View table information:

Insert Chinese characters:

Garbled display:

8. Solve the garbled problem:

Run the following command:

Add the following pink area content:

Restart mysql:

9. Verify whether garbled characters are resolved:

RepeatCreate a database:

Enter the database:

Create a table:

Insert data containing Chinese characters:

Query table content:

Normal display of Chinese characters:

Exit mysql, not close:

Close the database:

Result:

10. Some mysql commands:

Start the service:

Sudo/etc/init. d/mysql start

Close the service:

Mysqladmin-u root-p shutdown

Restart the service:

Sudo/etc/init. d/mysql restart

Go to mysql:

Mysql-u username-p

Press enter and enter the password. after entering the password, you can enter it. After Entering the terminal, the command line is changed to mysql>

After entering the mysql interface, the command should end with a; otherwise, the command will not return after execution.

Exit mysql:

Quit;

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.