In fact, we used only the MySQL tutorial show usage in fact one, in the MySQL simple operation as follows
Show Table
This will show all the tables, but in the PHP tutorial, we'll look at the following code
$server = ' localhost ';
$user = '
1. Export the entire database
Mysqldump-u user name-p--default-character-set=latin1 Database name > exported file name (database default encoding is latin1)
Mysqldump-u wcnc-p SMGP_APPS_WCNC > Wcnc.sql
2. Export a table
Mysqldump-u user name-P
Show tables or show tables from database_name; Displays the names of all tables in the current database
show databases; Displays the names of all databases in MySQL
Show columns from table_name to database_name; or show columns from
In fact, there is no other function to support it, just use some of the SQL statements provided by MySQL can be.
For simplicity's sake, take the MySQL system table user as an example to remove all the possible values for the Select_priv column.
When you use MySQL (show tables), you sometimes need to see information about tables and fields (whether the table and a field exist, etc.) ~ ~ and PHP provides such related functions as: Mysql_list_dbs (), Mysql_list_fields (), But the
first, start and exit
1, into MySQL: Start the MySQL Command line Client (MySQL's DOS interface), directly enter the installation of the password can be. The prompt at this point is:mysql>
2, Exit Mysql:quit or exit
Second, the library operation1.
There are a lot of basic commands in MySQL, and the show command is one of them, and it's easy to confuse the use of SHOW commands in many users.This article brings together numerous uses of the show command. 1. Show tables or show tables from
Show tables or show tables from database_name;Explanation: Displays the names of all tables in the current database
show databases;Explanation: Displays the names of all the databases in MySQL
Show Processlist;Explanation: Displays all processes
This section describes:Table structure Operations
Create a data table,
View data tables and view fields,
Modify the data table structure
Delete a data table
Field operations
New fields,
Modify the field data
MySQL Modify table syntax=========================Add column [Add column name]=========================①alter table name Add column list Type column parameter "Add column to last face of table"Example: ALTER TABLE test add username char (a) not null
Modify the syntax of a table=========================add column [Add column name]=========================①alter table name Add column list Type column parameter "Add column to last face of table"Example: ALTER TABLE test add username char (a) not
MySQL installation directoryDatabase directory/var/lib/mysql/Configuration file/usr/share/mysql (mysql.server command and configuration file)Related commands/usr/bin (Mysqladmin mysqldump and other commands)Startup scripts/etc/init.d/mysql (startup
To Create a table:#首先登录mysqlmysql-uroot Open a database mysql>use db1;Create a parent table, which we name as province,Mysql> CREATE table province (ID smallint auto_increment key, name varchar () not NULL);Create a child table named student, where
Table OperationsNote: You should connect to a database by using use before the operation.Build tableCommand: CREATE table ( [,.. ]);Example:Mysql> CREATE TABLE MyClass (> ID int (4) NOT null primary key auto_increment,> Name char () NOT NULL,>
MySQL Common commandsMySQL installation directoryDatabase directory/var/lib/mysql/Configuration file/usr/share/mysql (mysql.server command and configuration file)Related commands/usr/bin (Mysqladmin mysqldump and other commands)Startup
Show Processlist; only the first 100 are listed, if you want to list them all please use show full processlist to download ;Show columns from table_name to database_name; or show columns from database_name.table_name; or show fields;Explanation:
MySQL Add, delete, check, change operation command:First, modify MySQL Database passwordFormat: Mysqladmin-u username-P Old password password new password.Second, viewSee how many databases: Notice the back with S#查看SHOW DATABASES;#查看表USE blog; SHOW
MySQL常用指令,java,php程序员,数据库工程师必备。程序员小冰常用资料整理MySQL common commands (for reference)The most common display commands are:1. Display the list of databases.show databases;2. Display the data table in the library:Use MySQL;Show tables;3, display the
CREATE TABLE tab2 as (SELECT * from TAB1)The storage engine for this practice table also uses the server's default storage engine instead of the source table's storage engine, which copies the contents of the table together.CREATE talbe tab2
1. Use the command (A B D) to view the table structure of the user table in the MySQL database? A desc User B Show create TABLE user C Show columns for user D describe userAnalytical:The command to view the MySQL table structure is as follows:DESC
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.