Tree output
function Get_array ($user _id, $top =0) {Global $mysql, $_g;$sql = "Select user_id as name from ' {spreads_users} ' where p1.spreads_userid= ' {$user _id} '";$rows = $mysql->db_fetch_arrays ($sql);if ($top ==1) {$arr [0][' name ']=
Using Php+mysql encountered a character disorder problem, the solution:
After mysql_connect add a set NAMES UTF8, you can make the UTF8 database to eliminate garbled, for the GBK database uses set NAMES GBK, the code is as follows:
The
Its MySQL default character set turns out to be Swedish (LATIN1_SWEDISH_CI). Manually one table to modify the character set to Unicode multiple languages (UTF8_UNICODE_CI).
Had to check the data, found a solution, that is, after mysql_connect add a
The code is as follows
Copy Code
function replace () {$sql = Db_query ("Select Field_languages_value,nid from {content_type_company_profile} WHERE"Field_languages_value like '%mandarin chinese% ' ");while ($result = Db_fetch_object ($
Write a MySQL backup script, let's see what's wrong with the place.
This is the first shell script I wrote, so let's see,
I can send it to whoever needs it.
You can put this script into the crontab, perform it once every morning, and automatically
Description
table_name--the name of the tablefield_name--Field Namefrom_str--a string to replaceto_str--replaced with string
Example 1
The code is as follows
Copy Code
UPDATE ' table_name ' SET ' field_name ' = replace
To view the MySQL file directory My.ini file, you can find similarDatadir= "D:/beeagle/program files/mysql/mysql Server 5.0/data/" The path is the MySQL Data directoryDefault in: "C:\Documents and Settings\All Users\Application Data\mysql\mysql
Workaround One , modify the My.cnf file
Found it
Query_cache_size =0
Guess that's what this problem is causing, no query cache open
(General 1G on 64M cache)
My server's memory is 4G,
Adjusted to
The code is as follows
Copy
First we want to enter your MySQL server, use net stop mysql to stop MySQL, and then run the DOS command, enter CMD in the run, and then switch to the MySQL bin directory, run the command:
The code is as follows
Copy Code
Dbhost to your database server address (small tip: General host default database server address is: localhost)Dbuser change to your database user namePassword change to your database user passworddbname change to your database nameBackup.sql
1. Query a table in the different parts of table BField not in (result set)
Select Aurl from Atab WHERE aurl isn't in (select DISTINCT burl from Btab)Note: MySQL supports subqueries starting at 5.0.
If you compare multiple fields, you can use
Take a practical example to understand the associated subquery
Left join: A left-hand connection that returns all the records in the left table and the records in the right table that are equal to the join field.Right join: A right-hand join that
I. INTRODUCTIONWith the popularization of Internet applications, the storage and access of massive data has become the bottleneck of system design. For a large Internet application, billions of PVS per day will undoubtedly cause a considerable load
1. User creation, permission, and deletion1. Connect to MySqlConnection: mysql-h host address-u user name-p user password (note: u and root do not need to add spaces, the same is true for others)Disconnected: exit (press enter)Open cmd and
How MySQL optimizes LIMITIn some cases, when you use LIMITRow_countWithout HAVING,MySQLQueries are processed in different ways.· If you use LIMIT to select only some rowsMySQL selectionWhen you perform a full table scan, it will use indexes in some
Since I have been in school for so many years, I have come to the conclusion that learning from an example is the fastest and most effective, and can cultivate a strong practical ability. This is a good way to learn. Try not to access. For example,
As the company's website traffic grows, MySQL naturally becomes a bottleneck. Therefore, I have been studying MySQL optimization recently. The first step is to naturally think of MySQL system parameter optimization, as a database system for a
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.