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