This article provides a quick and detailed understanding of the SELECT statements in the MySQL database.
The basic syntax of the SELECT statement in MySQL is:
The following is a reference clip:
SELECT [STRAIGHT_JOIN] [SQL _SMALL_RESULT]
[SQL
How to solve the Chinese problem of MySQL database:
1. my. ini MySQL Configuration File Settings
[Client]
Default-character-set = gbk
[Mysqld]
Default-character-set = gbk
2. Start the MySQL service to create your database
3. Verify the
Nowadays, developers are constantly developing and deploying LAMP (Linux? , Apache, MySQL, PHP/Perl) architecture applications. However, the server administrator often has no control over the application itself, because the application is compiled
Back up database
Database files are very important. If one day the server system crashes and is not restored, it will cause a huge loss. Therefore, we need to back up the database occasionally.
After selecting the database to be backed up,
Generally, the table has a Create date Field, and other databases have default options. MySQL also has the default value timestamp. However, in MySQL, the value of timestamp is updated even if it is inserted or modified!
In this way, it is not the
Mysql tutorial exporting database tutorial Methods
Method 1
Run mysqldump -- opt-h192.168.0.156-uusername-ppassword -- skip-lock-tables databasename> database. SQL In the mysql bin directory.
You can change the ip address to localhost.
If navicate
Problem status
Restarting mysql also fails. You can only see information similar to the following:
Forcing close of thread 12232 user: 'root'
Use mysqladmin to easily monitor mysql:
Mysqladmin-uroot-p ******** status-I 1
It is found that Queries per
The most common method for mysql random query is as follows:
1 SELECT * FROM tablename order by rand () LIMIT 1
The php manual explains this:
About selecting random rows from a MySQL table:
SELECT * FROM tablename order by rand () LIMIT 1
Works for
Mysql Master/Slave databases are not synchronized today
First go to the Master database:
Mysql> show processlist; check whether there are too many Sleep processes. It is normal.
Show master status; also normal.
Mysql> show master status;
+ ----------
After MySQL is installed, a root user and an anonymous user will be automatically created, which is ignored by many users, this is probably because anonymous users are set to be only available locally by default.
However, if MySQL is to be used as
Because SupeSite needs to call Discuz! And UCHome data, so if they are not installed in the same database, SupeSite database users must pair Discuz! And UCHome databases have read, modify, delete, and other permissions. In this case, you need to
A String or String is a finite sequence composed of zero or multiple characters. It is generally recorded as s = 'a1a2 • an '(n> = 0 ). It is the data type that represents text in programming languages.Generally, the entire string is used as the
Server restart
When mysqld is started, all authorization table content is read into the memory and takes effect from that time.
Immediately applied by the server
Modifications made to the authorization table using GRANT, REVOKE, or set password will
1. Create a stored procedure
1. Basic Syntax:
Create procedure sp_name ()
Begin
.........
End
2. parameter transfer
Ii. Call the Stored Procedure
1. Basic Syntax: call sp_name ()
Note: The stored procedure name must be enclosed in parentheses, even
Useful common statements.
MYSQL displays databases or tables:
Reference content is as follows:Show databases; // you can then use database_name;Show tables;
Change the table name in MYSQL:
Alter table table_name rename new_t;
Add MYSQL
1005: An error occurred while creating the table.
1006: database creation failed
1007: the database already exists. An error occurred while creating the database.
1008: the database does not exist. An error occurred while deleting the database.
1
Use shell to write a script to monitor the running status of the mysql process and test whether mysql can be connected. If not, send an email and send an alarm. As for how to monitor, there are actually many commands. For example, most commands in
You must have used the Database Import and Export function in phpmyadmin, which is very convenient. However, in practical application, I found the following problems:
1. The size of the database exceeds a certain size. For example, if the size of 6
Are you very worried about getting MySQL to change the character set? Don't worry. The following articles will give you a correct solution. The following articles mainly introduce the solution for changing the character set of MySQL. The following
Where condition Query
The Code is as follows:
Select * from news where DATE (adddate)
'2017-04-20 '-INTERVAL 5 DAY and '2017-04-20' + INTERVAL 5 DAY
Select * from news where DATE (adddate) in ('2017-04-20 ', '2017-04-15', '2017-04-25 ')
Use of IF
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.