The most basic MySQL command and VI command

Source: Internet
Author: User

1.MySQL Basic Command operation

All MySQL commands need to end with a semicolon, and a single command can be written into multiple lines.

Connection database:mysql–u root–p;

  View all databases:show databases;

  Creating a database: Create databasesdatabaename;

  Select database: UsedatabaseName;

    Database operations can be performed only after the database is selected.

  Delete databases:drop database databaseName;

  Creating table: Create TABLE use(ID varchar () primary key, name varchar (TEN) not null);

  View all tables:show tables;

  Delete tables:drop table tableName;

2. Character Set

  MySQL character set is Latin by default during installation and does not support Chinese. This will cause great problems in the actual development process, so it is generally necessary to modify the character set to UTF8. When installing in Windows, you can choose the default character set of UTF8, but it is not possible to use command installation directly under Linux, and it is more complex to modify the character set under Linux (several times you have encountered a problem). Personal feel can try to transcode the way, similar to Java in Urlencoder and Urldecoder methods, hbase data stored in the Bytes.tobytes method, so there will be no garbled problem, the disadvantage is that the encoding and decoding need to consume time.

3. The most basic VI operation

Although the graphical user interface to modify the file is very convenient, but some time must be modified by VI, but the VI is powerful, but also complex. Very basic a few VI command, later to use again to learn it.

There are three states of VI: Input Mode,command mode and line mode.

1) Enter file:vi filename;

2) at the beginning of VI, automatically in command mode, press i from command mode into input mode;

3) in input mode, the same as normal file modification;

4) After the modification is complete, press ESC to return to command mode;

5) Enter the ZZ archive and Exit VI, if an accident happens halfway through the command : q! Force leave (no changes are saved).

The most basic MySQL command and VI command

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.