Restore a database: mysql-h localhost-u root-p123456 Www
Back up a database: mysqldump-h localhost-u root-p123456 www > d:/www2008-2-26.sql
Backup data:
The code is as follows
Copy Code
Mysqldump-u User name-p password
The following are the configuration steps:1, the MySQL configuration file my.cnf location
2, how to start, stop MySQL, find a good startup file
Assuming that there are two machines, MySQL has been installed (as far as possible version, and two
The code is as follows
Copy Code
Mysql>select * from xi_table into outfile ' D:test.xls ';
Export to TXT file:
The code is as follows
Copy Code
SELECT * from xi_table into outfile ' d:test.txt ';
Mysqldump Export Command Base usage
The code is as follows
Copy Code
Mysqldump-u username-P [--opt] DATABASENAME [Table] > Export SQL file name
The default mysqldump exported SQL file contains not only the
COUNT (*) calculates the number of rows, including null
Count (column) calculates the number of rows for a particular column's value, and does not contain null values.
Count () is also used, and the use of Count (1) is the same as the result of
The following query selects all records and its date_col value is within the last 30 days:
The code is as follows
Copy Code
Mysql> SELECT something from tableWHERE To_days (now ())-To_days (Date_col)
DayOfWeek
1, find the problem of the program to join Mysql.colse () can be resolved.
2, directly modify the MySQL configuration, set time_wait time of not more than 5 seconds can
modifying methods in Linux systems
The code is as follows
Database backup:
Open cmd to execute the following statement:
The code is as follows
Copy Code
Mysqldump-h localhost-u root-proot databasename >d:databasename.sql
Database restore:
Open cmd to execute the
Workaround:
1. Add the "binary" attribute to the field containing Chinese as a binary comparison, such as changing "name char (10)" to "name char" binary.
2. If you use the source code to compile MySQL, you can compile MySQL using
SUBSTR () is equivalent to the substring () function, and substring () is very powerful and flexible.
1. Intercept string from leftLeft (str, length)
Description: Left (intercepted field, intercept length)
1, left (str,length); Select Left
MySQL sometimes because of power off or other causes of the database corruption, the wrong message is as follows:
Mysql:can ' t Open file: ' Sdb_sessions. Myi '. (errno:145)
For more information, and the Support Center at
We can use MySQL's own
The code is as follows
Copy Code
Mysql> SELECT something from tableWHERE To_days (now ())-To_days (Date_col) DayOfWeek (date)
Returns the week index of date (1= Sunday, 2 = Monday, ...). 7= Saturday). These index values
Second, the grammarMATCH (Col1,col2,...) Against (expr [search_modifier])Search_modifier: {in BOOLEAN MODE | With QUERY expansion}For example: SELECT * from Tab_name WHERE MATCH (col1,col2) against (Search_word);The table here needs to be MyISAM
Format: Grant Select on database. * To User name @ login host identified by "password"
Example 1, add a user test1 password for ABC, so that he can log on any host, and all databases have query, insert, modify, and delete permissions. First connect
MySQL Database link Query class
Class Mysqlquery{var $sql;//sql Statement Execution resultsvar $query;//sql statementvar $num//return number of recordsvar $r;//return arrayvar $id//Return database ID numberExecute mysql_query () statementfunction
Nonsense not to say, although you can install MySQL directly through the Yum, but in order to be able to have a clearer understanding of the installation process, we still use the source code to compile the installation.
The code is as
The first type of manual simple to join can be implemented automatically start MySQL, behind is nothing to do write a section of the Shell code.
MySQL set to Linux service
The code is as follows
Copy Code
At the same time, the amount of online access continues to increase for 1G memory server Obviously feel the difficulty of severe when even every day will panic or occasional server card This problem once bothered me for more than half a month MySQL
MySQL is a database software with excellent performance, and PHP is a powerful server-side scripting language. In the development of Shanxi Aluminum Factory website, I have used PHP4.0 + MySQL3.23.38 to establish a variety of applications. Next, we
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