The length function can test for character lengths in the specified field, but some attentive friends will find that the length function is different from the lengths of the coded tests.
Utf-8: Length () 3 lengths of a Chinese character
Gbk:length
Phenomenon: Web site access more and more slow, and finally inaccessible, after the check found that the disk is full. Careful inquiry down to confirm is because the binlog of MySQL too much occupied space.
Analysis process and solution: Usually
When you encounter a shutdown unexpectedly error when you open a local environment xampp MySQL, how do you solve it?
About MySQL enable failed, the following occurs:
14:39:05 [MySQL] error:mysql shutdown unexpectedly.
14:39:05 [MySQL]
Log on to the MySQL server with root
Mysql-h Localhost-u Root
Give any host the use of username remote access
Mysql>grant all privileges in *.* to ' username ' @ '% ' with GRANT OPTION
Setting the specified user can only access from the
Found a solution from the Internet, here to record:
1. Admin login system, stop MySQL service or end mysqld-nt process;2. Go to the command line and come to MySQL's installation directory. Suppose the installation directory is d:/mysql/, cmd enter
Thread_cache_size
Query process Usage
The code is as follows
Copy Code
Mysql> show global status like ' thread% ';+ ——————-+ ———-+| variable_name | Value |+ ——————-+ ———-+| threads_cached | 26 || threads_connected | 510 |
Now let's look at the SQL Association lookup join,
This is a big problem in my early days, how two tables relate to each other, in fact, there's something called join, and then there's the inner join,right Join,left join
I basically use left JOIN,
1. When using case method (not recommended)-
The code is as follows
Copy Code
SELECTCOUNT (DISTINCT user_id) User_count,CaseWhen create_time>1395046800 and create_timeWhen create_time>1395050400 and create_timeWhen create_
Can only say that I food, found on the internet did not find who explained their four differences, it can only own. The following is a MySQL client to see the help information, directly posted to explain it.
User:returns the current MySQL username
Error connection
Warning:mysql_connect () [Function.mysql-connect]: [2002]
Hostname should be modified at this time, for example, in the CI configuration database (database.php) from:
$db [' Default '] [' hostname '] = ' localhost '; To:
$db ['
MySQL defaults to only local logins, and the following actions allow users to have remote permissions, taking root as an example.
in command state
First, allow users to log on at any IP, and have all the permissions of all databases:
Grant all
If it does not exist, insert the new data
The code is as follows
Copy Code
$sql = "INSERT into {$ecs->table (' Cat_lang ')} (CAT_ID,LANG_ID,CAT_NAME,KEYWORDS,CAT_DESC)VALUES ({$cat _id},{$k}, ' {$val [' cat_name ']} ', '
Add the "binary" property to the field containing Chinese as a binary comparison, such as changing "name char (10)" to "name char" binary.If you use the source code to compile MySQL, you can compile MySQL using the--WITH--CHARSET=GBK parameter, so
Assuming the MySQL username and password is root xxx, the database is test
Import SQL
The code is as follows
Copy Code
Mysql-hlocalhost-uroot-pxxx Test
Exporting SQL
The code is as follows
Let's first look at what happens to a slave registration to master, first slave need to send a Com_register_slave type request (sql_parse.cc) command to master, where master will use Register_ The slave function registers a slave to slave_list.
The wrong answer has been adopted, misleading others.
Char Max 255 charactersvarchar maximum 65,535 bytes (so, different character sets, the number of characters can be stored differently)Text Max 65535 characters
1)VARCHAR l+1 Byte, where lTEXT l+
The varchar type of MySQL database tutorial has a maximum length limit of 255 in the version below 5.0.3, and its data range can be 0~255.
In the MySQL5.0.3 and above versions, the length of the varchar data type is supported to 65535, which means
Index
Use indexes to quickly access specific information in the Database tutorial table. An index is a structure that sorts the values of one or more columns in a database table, such as the Last Name (lname) column of the employee table. If you
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.