Simple MySQL Tutorial Group Statistics statement Instance Code/*ID name code_id code_name is_true Score1 31, Handsome is 5.2 tickets, 32 grand, 4.3 31, Handsome is 4.4 Sheets 32 Lavish No 35 Lee 41 Handsome is 56 Lee 42 Lavish is 3
Take a look at
First, create the user:
Create user creates a new MySQL account. To use create user, you must have the global Create user permission for the MySQL database or have insert permissions. For each account, create user creates a new record in the
1. Back up MySQL:
Export a library to a SQL file
The code is as follows
Copy Code
Mysqldump db_name >/home/hx/backup/name.sql-uroot-p
Back up multiple libraries (using the-b parameter)
The code is
One, in your computer DOS mode, at the beginning of the-> run input "cmd"
Second, then go to your MySQL directory in the bin directory.
Then use the source command, followed by the script file (such as the. SQL used here)
Mysql>source
Advantages and disadvantages of MySQL log backups
Benefits: is to revert to a point in time, or an operation SQL statement
Disadvantage: A large log file is generated
MySQL log recovery method in Windows
1. Open MySQL LogFind [mysqld] in the
Creating a Database
Command:
The code is as follows
Copy Code
Create DATABASE
Example 1:
Create a database named XHKDB
The code is as follows
Copy Code
1. CREATE database name;2.
Use the command mode xcopy command to save the following code as a Bak.bat file.
The code is as follows
Copy Code
net stop MySQLxcopy D:/phpstudy/mysql/data/sql111cn/*.* d:/db_backup/%date:~0,10%//ynet start MySQL
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
Left JOIN syntax
The code is as follows
Copy Code
Table_references:Table_reference [, Table_reference] ...Table_reference:Table_factor| Join_tableTable_factor:Tbl_name [[as] alias][{use| ignore| FORCE} INDEX (Key_list)]|
Batch search:
The SELECT statement is used to select data from the database.
Grammar
The code is as follows
Copy Code
SELECT column_name (s) from table_name
Instance
The code is as follows
This way MySQL will automatically convert all table names to lowercase characters when created and found (this option defaults to 1 in Windows and 0 in Unix). Starting with MySQL 4.0.2, this option also applies to database names.
When you change
Question One
111217 23:23:57 Innodb:database is not shut down normally!Innodb:starting crash recovery.innodb:reading tablespace information from the ... ibd files ...innodb:restoring possible Half-written data pages from the
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
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
// Database connection tutorial$ Link_id = mysql tutorial _ connect ("localhost", "root", "") or die ("connection failed ");If ($ link_id){// Select a databaseMysql_select_db ("my_test ");// The above is the connection part of the header database,
$ Errmsg = "";If (! @ Mysql_connect ("localhost", "trainee", "abc123 ")){$ Errmsg = "Cannot connect to database ";} @ Mysql_select_db ("wellho ");// First run ONLY-need to create table by un commenting this// Or with silent @ we can let it fail
Data verificationClear spacesThe trim function will clear spaces at the beginning and end of the data. Its syntax is:Trim ($ first_name );Processing of required fieldsSome fields must be entered in your database. In this way, the fields
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