1 View Linux Distributions
[Root@typecodes ~]# Cat/etc/redhat-releaseCentOS Linux release 7.2.1511 (Core)
2 Download the MySQL official yum Repository
According to the Linux distribution (CentOS, Fedora is the Red Hat system), from the MySQL
To understand why there are garbled, we must first understand: from the client request, to MySQL storage data, and then the next time from the table to retrieve the client process, which links will be encoded/decoded behavior. In order to better
1.php An example of connecting to a database.2.php closes the database connection.3.php executes the SQL statement.4.php gets the information about the SQL statement execution error.5.php gets the query result set.6.php gets all the records in the
Chinese Pinyin Whole spelling
The code is as follows
Copy Code
--Create a Chinese phonetic control temporary tableCREATE TABLE IF not EXISTS ' T_base_pinyin ' (' Pin_yin_ ' varchar (255) CHARACTER SET GBK not NULL,' Code_
Master MySQL Settings
1, edit the main MySQL server MySQL configuration file my.cnf, under [mysqld] Add the following parameters:
Log-bin=mysql-bin//open MySQL binary log
Server-id=1//server ID cannot be duplicated
BINLOG-DO-DB=DZX2//need to
Note: This document has two MySQL instances, multiple instance methods and so on
Linux operating system: centOS6.3 64bit (Installation of the system default development package)
Example one:
MySQL version: mysql-5.0.56
Front End (nginx+php) ip:192.168.10.8Back end (independent MySQL) ip:192.168.10.5Software version: libiconv-1.14.tar.gz mysql-5.1.63.tar.gz php-5.2.17.tar.gz php-5.2.17-fpm-0.5.14.diff.gz Php-5.2.17-max-input-vars.patch1. Install MySQL on the back
MySQL inserts when record does not exist, update when record existsThere are basically three kinds of solutions on the Internet.
First type:
Example one: inserting more than one record
Suppose you have a clients table with a primary key of client_
Login MySQL database system, with show processlist analysis to see the current running state.
Mysql> show Processlist;
+-–+ ————-+ —————— –+
| Id | User | Host | db | Command | time| State | Info
+-–+ ————-+ —————— –+
|207|root |192.168.0.2:5162
DROP TABLE IF EXISTS ' Pcms_channel ';
CREATE TABLE IF not EXISTS ' Pcms_channel ' (
' CID ' tinyint (3) unsigned not NULL auto_increment,
' Name ' char ' not NULL COMMENT ' channel name ',
' ParentID ' tinyint (4) not NULL COMMENT ' parent id ',
Company all servers finally put to the same room, opened the intranet access. This way, you have to change the configuration of some MySQL from the server
and become intranet access.
BackupThe first is to shut down the MySQL server (slave end) and
When you first install MySQL on a machine, the authorization table in the MySQL database is initialized like this:
You can connect as root from the local host (localhost) without specifying a password. Root user has all permissions (including
Analysis reason one: MySQL's automatic backup function may cause the database to shut down the service before the backup, but when this starts the server does not respond,
Start-run-services.msc, open Windows service to find MySQL services and
1] The common method, the efficiency is too low
The code is as follows
Copy Code
SELECT * FROM Table ORDER by rand () LIMIT 10;
[2] Method of join:
The code is as follows
Copy Code
MySQL tutorial sexplain syntax and usage
Explain [extended] select ... from ... where ...
If extended is used, then after the explain statement is executed, you can use the show warnings statement to query the corresponding
Optimization
Process with analyze and deal with them on a regular basis
ANALYZE [Local | No_write_to_binlog] TABLE tb1_name[, Tbl_name] ...
Define Tables Analyze Table table_name
CHECK TABLE Tb1_name[,tbl_name] ... [option]...option = {QUICK | FAST | MEDIUM |
Connect MySQL and run the following command:
The code is as follows
Copy Code
Mysql-u root-pMysql>use MySQL;Mysql>select host from user where user= ' root ';Mysql>update User Set host = '% ' where user = ' root
/* Table structure for storing posts ------------------------------------------------------Create table bbsrow (Bbsrow_id int (6) not null auto_increment, // ID of the subscriberBbsrow_auth varchar (20) not null, // Post authorBbsrow_parentid int (6)
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