View MySQL version and character encoding

Source: Internet
Author: User

MySQL version:

when logging into the database:

Mysql> SELECT @ @version;

Mysql> select version ();

Status

mysql> status;

When you are not logged into the database:

Mysql-v

MySQL--version

D:\mysql\bin>mysql-vd:\mysql\bin>mysql--version

MySQL--help | findstr distrib//windows Terminal

MySQL--help | grep distrib//linux Terminal

d:\phpstudy\mysql\bin>mysql --help | findstr  Distrib------------------------------------------------------------------------------------------------------------------ View MySQL database and table encoding format view MySQL database and table encoding format 1. View the database encoding format 1    mysql> show variables  like  ' character_set_database ';      2. View the encoding format of the datasheet 1    mysql > show create table < table name >;     3. Specifies the character set of the database when the database is created mysql> create database < database name > character set utf8;4. Specifies the encoding format of the data table when the data table is created Create table  tb_books  (    name varchar)  not null,     price double not null,    bookcount int not null,     author varchar ( not null )  default charset = utf8 ; 5. Modify the encoding format of the database mysql>alter database < dataLibrary name > character set utf8;6. Modify data table encoding format mysql>alter table < table name > character  set utf8;7. Modifying the field encoding format mysql>alter table < table name > change < field name > < Field name > < type > character set utf8;mysql>alter table user change  username username varchar ( character set utf8 not null; 8). Add foreign Key Mysql>alter table tb_product add constraint fk_1 foreign key ( Factoryid)  references tb_factory (Factoryid);mysql>alter table < table name > add  constraint < foreign key Name > foreign key< field name > REFERENCES < outer table name >< field name >;9. Delete foreign key mysql>alter table tb_people drop foreign key fk_1;mysql>alter  table < table name > drop foreign key < foreign key name >;


View MySQL version and character encoding

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.