Show tables or show tables from database;
Explanation: displays the names of all tables in the current database.
Show databases;Explanation: displays the names of all databases in MySQL.
Show processlist;Explanation: displays all processes
Today I wrote a small
Program, Very small, but it is able to establish a link between PHP and MySQL and implement simple SQL statements.
This is the first test for beginners.
ProgramSource codeAs follows:CopyCodeThe Code is as follows: $ Conn =
Create two test tables and create the unique constraint on the id column.
Mysql> create table test1 (id int, name varchar (5), type int, primary key (id ));
Query OK, 0 rows affected (0.01 sec)
Mysql> create table test2 (id int, name varchar (5),
Start and Stop the mysql service in the window
Start mysql databaseNet start mysql
Stop a mysql databaseNet stop mysql
Restart the mysql databaseNet restart mysql
Command line format: use of basic mysql commands
1. Command Cancellation\ C
2. Exit
Recently, we have studied the implementation of MYSQL random extraction. For example, to randomly extract a record FROM the tablename table, the general syntax is: SELECT * FROM tablename order by rand () LIMIT 1.
However, I checked the MYSQL
One solution:
If an error occurs during Website access, check my. cnf: It is found that innodb_buffer_pool_size = 2048 M is too large and can be adjusted to innodb_buffer_pool_size = 1024M. There are other solutions to this problem on the Internet,
Through previous operations on mysql, I first excluded mysql configuration issues and checked whether msyql is running normally. By checking the *. errfile In the mysql data DIRECTORY (change the extension name to .txt), I can check it in notepad.
Mind Map
Click an image to view the large image.
IntroductionSituation: If your table structure is poorly designed or your index design is poor, please optimize your table structure design and assign appropriate indexes so that your query
1. Calculate the number of years
You figured out how old this person is on your birthday.
Copy codeThe Code is as follows: SELECT DATE_FORMAT (FROM_DAYS (TO_DAYS (now ()-TO_DAYS (@ dateofbirth), '% y') + 0;
2. Difference between two time points
Unsigned is a non-negative number. You can use this type to increase the data length!
For example, if the maximum value of tinyint is 127, the maximum value of tinyint unsigned is 127*2.
The unsigned attribute is only for integer type, while the
Developers often find that they do not use indexed or limit n statements, which will have a great impact on the database, for example, a large table with tens of millions of records needs to be fully scanned, or filesort is constantly performed,
Copy codeThe Code is as follows: one:
Declare @ s varchar (20)
Declare @ I varchar (20)
Set @ I =''
Set @ s = 'new members must purchase 350 yuan product'
While PATINDEX ('% [0-9] %', @ s)> 0
Begin
Set @ I = @ I + substring (@ s, PATINDEX ('% [0-9] %
Copy codeThe Code is as follows: class mysql
{
Private $ db; // datebase connect
Private $ result; // mysql result
Static private $ mysql; // mysql object
Private function _ construct ()
{// The work before Create an object
$ This-> db =
In MySQL database operations, we often write some SQL statements to implement the functions we want. However, it seems difficult for beginners of MySQL databases. This article summarizes six useful SQL statements. Beginners can use the following
I can see the post on "http/rest client" on the blog of Zhang banquet. I will skip all the installation steps. Next I will go directly to the test stage: virtual machine.
Copy codeThe Code is as follows: [root @ localhost ~] # Uname-
Linux sunss 2.6.
Ultimately, the following solutions are provided:
1. Clear the installation directory of MYSQL. The default value is C: \ Program Files.
2. Clear the MYSQL Data storage directory, which is generally in the C: \ Documents and Settings \ All Users.
1. query the first row of records:
Select * from table limit 1
2. query records from row n to row m
Select * from table1 limit n-1, m-n;
SELECT * FROM table LIMIT 5, 10; returns records FROM 6th rows to 15th rows
Select * from employee limit 3,
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