可以設(shè)計(jì)兩張關(guān)聯(lián)表 一個(gè)用來(lái)保存信息 一個(gè)用來(lái)保存X.Y點(diǎn)的信息 或者M(jìn)ysql也支持空間數(shù)據(jù),Geometry類(lèi)型即可。
百色網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián)公司,百色網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為百色數(shù)千家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)公司要多少錢(qián),請(qǐng)找那個(gè)售后服務(wù)好的百色做網(wǎng)站的公司定做!
若有問(wèn)題,請(qǐng)您及時(shí)追問(wèn)我
若滿(mǎn)意,請(qǐng)您及時(shí)采納
謝謝您的關(guān)照~
CHARINDEX返回零,因?yàn)樽址?.0” 不能在“Microsoft SQL Server”中被找到。接下來(lái)通過(guò)兩個(gè)例子來(lái)看看如何使用CHARINDEX函數(shù)來(lái)解決實(shí)際的T-SQL問(wèn)題。
Mysql創(chuàng)建數(shù)據(jù)庫(kù)時(shí)會(huì)在如下目錄創(chuàng)建以數(shù)據(jù)庫(kù)名為名的目錄
show?variables?like?"%datadir%";
數(shù)據(jù)文件日志也就在相應(yīng)目錄下了。
日志大小、看看這些參數(shù)是否能達(dá)到你的目的:
命令行參數(shù)
–log-bin=filename:記錄二進(jìn)制日志文件的位置,盡量指定路徑名,如果不指定的話(huà)則保存在數(shù)據(jù)目錄;
–log-bin-index=file:記錄二進(jìn)制日志文件索引的位置,保存了日志文件名;
–max_binlog_size:單個(gè)文件最大多少;
–binlog-do-db=db_name:哪個(gè)數(shù)據(jù)庫(kù)使用,只有這個(gè)數(shù)據(jù)庫(kù)使用;
–binlog-ignore-db=db_name:哪個(gè)數(shù)據(jù)庫(kù)不使用,只有這個(gè)數(shù)據(jù)庫(kù)不使用;
系統(tǒng)變量
log_bin:日志的位置;
binlog_cache_size:二進(jìn)制日志緩存大小,是每一個(gè)連接進(jìn)來(lái)的線(xiàn)程分配的大小,不是整個(gè)服務(wù)器的大小;
max_binlog_cache_size:最大緩存大小;
max_binlog_size:單個(gè)文件最大大小,超過(guò)此大小則再分配一個(gè)文件,但是一個(gè)事務(wù)必須在一個(gè)文件中,所以可能會(huì)稍大點(diǎn);
binlog_cache_use:當(dāng)前連接使用的binlog緩存的事務(wù)的數(shù)量,使用show?status?like?‘binlog_cache_use’查看(show?status命令顯示了所有連接到mysql服務(wù)器的狀態(tài)值);
binlog_cache_disk_use:如果binlog_cache_use不夠用,則在磁盤(pán)上緩存,應(yīng)該盡量避免;
binlog_do_db:設(shè)置master-slave時(shí)使用;
binlog-ignore-db:設(shè)置哪個(gè)數(shù)據(jù)庫(kù)不記錄日志;
sync_binlog:緩存與硬盤(pán)的同步頻率(commit多少下同步一次,0表示服務(wù)器自動(dòng)控制);
1、選取最適用的字段屬性,盡可能減少定義字段長(zhǎng)度,盡量把字段設(shè)置NOT NULL,例如'省份,性別',最好設(shè)置為ENUM
2、使用連接(JOIN)來(lái)代替子查詢(xún):
a.刪除沒(méi)有任何訂單客戶(hù):DELETE FROM customerinfo WHERE customerid NOT in(SELECT customerid FROM orderinfo)
b.提取所有沒(méi)有訂單客戶(hù):SELECT FROM customerinfo WHERE customerid NOT in(SELECT customerid FROM orderinfo)
c.提高b的速度優(yōu)化:SELECT FROM customerinfo LEFT JOIN orderid customerinfo.customerid=orderinfo.customerid
WHERE orderinfo.customerid IS NULL
3、使用聯(lián)合(UNION)來(lái)代替手動(dòng)創(chuàng)建的臨時(shí)表
a.創(chuàng)建臨時(shí)表:SELECT name FROM `nametest` UNION SELECT username FROM `nametest2`
4、事務(wù)處理:
a.保證數(shù)據(jù)完整性,例如添加和修改同時(shí),兩者成立則都執(zhí)行,一者失敗都失敗
mysql_query("BEGIN");
mysql_query("INSERT INTO customerinfo (name) VALUES ('$name1')";
mysql_query("SELECT * FROM `orderinfo` where customerid=".$id");
mysql_query("COMMIT");
5、鎖定表,優(yōu)化事務(wù)處理:
a.我們用一個(gè) SELECT 語(yǔ)句取出初始數(shù)據(jù),通過(guò)一些計(jì)算,用 UPDATE 語(yǔ)句將新值更新到表中。
包含有 WRITE 關(guān)鍵字的 LOCK TABLE 語(yǔ)句可以保證在 UNLOCK TABLES 命令被執(zhí)行之前,
不會(huì)有其它的訪(fǎng)問(wèn)來(lái)對(duì) inventory 進(jìn)行插入、更新或者刪除的操作
mysql_query("LOCK TABLE customerinfo READ, orderinfo WRITE");
mysql_query("SELECT customerid FROM `customerinfo` where id=".$id);
mysql_query("UPDATE `orderinfo` SET ordertitle='$title' where customerid=".$id);
mysql_query("UNLOCK TABLES");
6、使用外鍵,優(yōu)化鎖定表
a.把customerinfo里的customerid映射到orderinfo里的customerid,
任何一條沒(méi)有合法的customerid的記錄不會(huì)寫(xiě)到orderinfo里
CREATE TABLE customerinfo
(
customerid INT NOT NULL,
PRIMARY KEY(customerid)
)TYPE = INNODB;
CREATE TABLE orderinfo
(
orderid INT NOT NULL,
customerid INT NOT NULL,
PRIMARY KEY(customerid,orderid),
FOREIGN KEY (customerid) REFERENCES customerinfo
(customerid) ON DELETE CASCADE
)TYPE = INNODB;
注意:'ON DELETE CASCADE',該參數(shù)保證當(dāng)customerinfo表中的一條記錄刪除的話(huà)同時(shí)也會(huì)刪除order
表中的該用戶(hù)的所有記錄,注意使用外鍵要定義事務(wù)安全類(lèi)型為INNODB;
7、建立索引:
a.格式:
(普通索引)-
創(chuàng)建:CREATE INDEX 索引名 ON tablename (索引字段)
修改:ALTER TABLE tablename ADD INDEX [索引名] (索引字段)
創(chuàng)表指定索引:CREATE TABLE tablename([...],INDEX[索引名](索引字段))
(唯一索引)-
創(chuàng)建:CREATE UNIQUE 索引名 ON tablename (索引字段)
修改:ALTER TABLE tablename ADD UNIQUE [索引名] (索引字段)
創(chuàng)表指定索引:CREATE TABLE tablename([...],UNIQUE[索引名](索引字段))
(主鍵)-
它是唯一索引,一般在創(chuàng)建表是建立,格式為:
CREATA TABLE tablename ([...],PRIMARY KEY[索引字段])
8、優(yōu)化查詢(xún)語(yǔ)句
a.最好在相同字段進(jìn)行比較操作,在建立好的索引字段上盡量減少函數(shù)操作
例子1:
SELECT * FROM order WHERE YEAR(orderDate)2008;(慢)
SELECT * FROM order WHERE orderDate"2008-01-01";(快)
例子2:
SELECT * FROM order WHERE addtime/724;(慢)
SELECT * FROM order WHERE addtime24*7;(快)
例子3:
SELECT * FROM order WHERE title like "%good%";
SELECT * FROM order WHERE title="good" and name"good";
mysql耗內(nèi)存嗎?很多人都說(shuō)MySQL占用了很大的虛擬內(nèi)存,那么這個(gè)問(wèn)題應(yīng)該怎么解決呢?下面是我收集整理的一些方法,現(xiàn)在分享給大家!
解決mysql耗內(nèi)存的具體方法一:
在分析的過(guò)程中發(fā)現(xiàn)最耗內(nèi)存的是MySQL,其中近1GB的內(nèi)存被它吞了,而且不在任務(wù)管理器體現(xiàn)出來(lái)。這個(gè)數(shù)據(jù)庫(kù)軟件是EMS要用到了,所以必須要運(yùn)行。這個(gè)軟件在安裝的時(shí)候會(huì)根據(jù)機(jī)器的實(shí)際內(nèi)存自動(dòng)進(jìn)行配置,PC機(jī)物理內(nèi)存越多,它默認(rèn)占有的內(nèi)存就越多,難怪3GB的內(nèi)存被它給吞了近1GB。
優(yōu)化方法:
1. 退出EMS clientserver
2. 在CMD里運(yùn)行:net stop mysql
3. 找到MySQL\MySQL Server的安裝目錄,里面有個(gè)my.ini文件,參考附件的配置對(duì)參數(shù)query_cache_size tmp_table_size myisam_sort_buffer_size key_buffer_size innodb_buffer_pool_size進(jìn)行修改,注意不要改動(dòng)innodb_log_file_size,修改前備份my.ini
4. 在CMD里運(yùn)行:net start mysql,如果提示成功,則說(shuō)明修改的參數(shù)沒(méi)有什么問(wèn)題,如果失敗,重新調(diào)整一下上面的參數(shù)
5. 找到EMS 安裝目錄runGUI.bat runServer.bat腳本,找到-Xmx700m,改為-Xmx256m,注意修改前備份這兩個(gè)文件,感謝Liping Sun提供幫助
6. 重新運(yùn)行EMS
前后對(duì)比,對(duì)于3GB的PC,發(fā)現(xiàn)可以節(jié)省近1GB的內(nèi)存。對(duì)于2GB的PC,也可以節(jié)省600-800MB。優(yōu)化后發(fā)現(xiàn)EMS啟動(dòng)稍微慢一些,但是其它的軟件運(yùn)行速度提高了很多,不在經(jīng)常出現(xiàn)卡機(jī)現(xiàn)象了。如果在運(yùn)行過(guò)程中發(fā)現(xiàn)EMS特別慢的話(huà),自己也可以適當(dāng)放大上面提到的一些參數(shù)。
my.ini
# MySQL Server Instance Configuration File
# ----------------------------------------------------------------------
# Generated by the MySQL Server Instance Configuration Wizard
#
#
# Installation Instructions
# ----------------------------------------------------------------------
#
# On Linux you can copy this file to /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options
# (@localstatedir@ for this installation) or to
# ~/.my.cnf to set user-specific options.
#
# On Windows you should keep this file in the installation directory
# of your server (e.g. C:\Program Files\MySQL\MySQL Server X.Y). To
# make sure the server reads the config file use the startup option
# "--defaults-file".
#
# To run run the server from the command line, execute this in a
# command line shell, e.g.
# mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# To install the server as a Windows service manually, execute this in a
# command line shell, e.g.
# mysqld --install MySQLXY --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# And then execute this in a command line shell to start the server, e.g.
# net start MySQLXY
#
#
# Guildlines for editing this file
# ----------------------------------------------------------------------
#
# In this file, you can use all long options that the program supports.
# If you want to know the options a program supports, start the program
# with the "--help" option.
#
# More detailed information about the individual options can also be
# found in the manual.
#
#
# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]
port=3306
[mysql]
default-character-set=utf8
# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.
#
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port=3306
#Path to installation directory. All paths are usually resolved relative to this.
basedir="D:/Program Files/MySQL/MySQL Server 5.1/"
#Path to the database root
datadir="C:/Documents and Settings/All Users/Application Data/MySQL/MySQL Server 5.1/Data/"
# The default character set that will be used when a new schema or table is
# created and no character set is defined
character-set-server=utf8
# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB
# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the
# connection limit has been reached.
max_connections=1510
# Query cache is used to cache SELECT results and later return them
# without actual executing the same query once again. Having the query
# cache enabled may result in significant speed improvements, if your
# have a lot of identical queries and rarely changing tables. See the
# "Qcache_lowmem_prunes" status variable to check if the current value
# is high enough for your load.
# Note: In case your tables change very often or if your queries are
# textually different every time, the query cache may result in a
# slowdown instead of a performance improvement.
query_cache_size=16M
# The number of open tables for all threads. Increasing this value
# increases the number of file descriptors that mysqld requires.
# Therefore you have to make sure to set the amount of open files
# allowed to at least 4096 in the variable "open-files-limit" in
# section [mysqld_safe]
table_cache=3020
# Maximum size for internal (in-memory) temporary tables. If a table
# grows larger than this value, it is automatically converted to disk
# based table This limitation is for a single table. There can be many
# of them.
tmp_table_size=4M
# How many threads we should keep in a cache for reuse. When a client
# disconnects, the client's threads are put in the cache if there aren't
# more than thread_cache_size threads from before. This greatly reduces
# the amount of thread creations needed if you have a lot of new
# connections. (Normally this doesn't give a notable performance
# improvement if you have a good thread implementation.)
thread_cache_size=64
#*** MyISAM Specific options
# The maximum size of the temporary file MySQL is allowed to use while
# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
# If the file-size would be bigger than this, the index will be created
# through the key cache (which is slower).
myisam_max_sort_file_size=100G
# If the temporary file used for fast index creation would be bigger
# than using the key cache by the amount specified here, then prefer the
# key cache method. This is mainly used to force long character keys in
# large tables to use the slower key cache method to create the index.
myisam_sort_buffer_size=4M
# Size of the Key Buffer, used to cache index blocks for MyISAM tables.
# Do not set it larger than 30% of your available memory, as some memory
# is also required by the OS to cache rows. Even if you're not using
# MyISAM tables, you should still set it to 8-64M as it will also be
# used for internal temporary disk tables.
key_buffer_size=16M
# Size of the buffer used for doing full table scans of MyISAM tables.
# Allocated per thread, if a full scan is needed.
read_buffer_size=64K
read_rnd_buffer_size=256K
# This buffer is allocated when MySQL needs to rebuild the index in
# REPAIR, OPTIMZE, ALTER table statements as well as in LOAD DATA INFILE
# into an empty table. It is allocated per thread so be careful with
# large settings.
sort_buffer_size=256K
#*** INNODB Specific options ***
# Use this option if you have a MySQL server with InnoDB support enabled
# but you do not plan to use it. This will save memory and disk space
# and speed up some things.
#skip-innodb
# Additional memory pool that is used by InnoDB to store metadata
# information. If InnoDB requires more memory for this purpose it will
# start to allocate it from the OS. As this is fast enough on most
# recent operating systems, you normally do not need to change this
# value. SHOW INNODB STATUS will display the current amount used.
innodb_additional_mem_pool_size=9M
# If set to 1, InnoDB will flush (fsync) the transaction logs to the
# disk at each commit, which offers full ACID behavior. If you are
# willing to compromise this safety, and you are running small
# transactions, you may set this to 0 or 2 to reduce disk I/O to the
# logs. Value 0 means that the log is only written to the log file and
# the log file flushed to disk approximately once per second. Value 2
# means the log is written to the log file at each commit, but the log
# file is only flushed to disk approximately once per second.
innodb_flush_log_at_trx_commit=1
# The size of the buffer InnoDB uses for buffering log data. As soon as
# it is full, InnoDB will have to flush it to disk. As it is flushed
# once per second anyway, it does not make sense to have it very large
# (even with long transactions).
innodb_log_buffer_size=5M
# InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and
# row data. The bigger you set this the less disk I/O is needed to
# access data in tables. On a dedicated database server you may set this
# parameter up to 80% of the machine physical memory size. Do not set it
# too large, though, because competition of the physical memory may
# cause paging in the operating system. Note that on 32bit systems you
# might be limited to 2-3.5G of user level memory per process, so do not
# set it too high.
innodb_buffer_pool_size=32M
# Size of each log file in a log group. You should set the combined size
# of log files to about 25%-100% of your buffer pool size to avoid
# unneeded buffer pool flush activity on log file overwrite. However,
# note that a larger logfile size will increase the time needed for the
# recovery process.
innodb_log_file_size=88M
# Number of threads allowed inside the InnoDB kernel. The optimal value
# depends highly on the application, hardware as well as the OS
# scheduler properties. A too high value may lead to thread thrashing.
innodb_thread_concurrency=8
解決mysql耗內(nèi)存的具體方法二:
更改后如下:
innodb_buffer_pool_size=576M -256M InnoDB引擎緩沖區(qū)占了大頭,首要就是拿它開(kāi)刀
query_cache_size=100M -16M 查詢(xún)緩存
tmp_table_size=102M -64M 臨時(shí)表大小
key_buffer_size=256m -32M
重啟mysql服務(wù)后,虛擬內(nèi)存降到200以下.
另外mysql安裝目錄下有幾個(gè)文件:my-huge.ini 、my-large.ini、my-medium.ini...這幾個(gè)是根據(jù)內(nèi)存大小作的建議配置,新手在設(shè)置的時(shí)候也可以參考一下。
2G內(nèi)存的MYSQL數(shù)據(jù)庫(kù)服務(wù)器 my.ini優(yōu)化 (my.ini)
2G內(nèi)存,針對(duì)站少,優(yōu)質(zhì)型的設(shè)置,試驗(yàn)特:
table_cache=1024 物理內(nèi)存越大,設(shè)置就越大.默認(rèn)為2402,調(diào)到512-1024最佳
innodb_additional_mem_pool_size=8M 默認(rèn)為2M
innodb_flush_log_at_trx_commit=0 等到innodb_log_buffer_size列隊(duì)滿(mǎn)后再統(tǒng)一儲(chǔ)存,默認(rèn)為1
innodb_log_buffer_size=4M 默認(rèn)為1M
innodb_thread_concurrency=8 你的服務(wù)器CPU有幾個(gè)就設(shè)置為幾,默認(rèn)為8
key_buffer_size=256M 默認(rèn)為218 調(diào)到128最佳
tmp_table_size=64M 默認(rèn)為16M 調(diào)到64-256最掛
read_buffer_size=4M 默認(rèn)為64K
read_rnd_buffer_size=16M 默認(rèn)為256K
sort_buffer_size=32M 默認(rèn)為256K
max_connections=1024 默認(rèn)為1210
試驗(yàn)一:
table_cache=512或1024
innodb_additional_mem_pool_size=2M
innodb_flush_log_at_trx_commit=0
innodb_log_buffer_size=1M
innodb_thread_concurrency=8 你的服務(wù)器CPU有幾個(gè)就設(shè)置為幾,默認(rèn)為8
key_buffer_size=128M
tmp_table_size=128M
read_buffer_size=64K或128K
read_rnd_buffer_size=256K
sort_buffer_size=512K
max_connections=1024
試驗(yàn)二:
table_cache=512或1024
innodb_additional_mem_pool_size=8M
innodb_flush_log_at_trx_commit=0
innodb_log_buffer_size=4M
innodb_thread_concurrency=8
key_buffer_size=128M
tmp_table_size=128M
read_buffer_size=4M
read_rnd_buffer_size=16M
sort_buffer_size=32M
max_connections=1024
一般:
table_cache=512
innodb_additional_mem_pool_size=8M
innodb_flush_log_at_trx_commit=0
innodb_log_buffer_size=4M
innodb_thread_concurrency=8
key_buffer_size=128M
tmp_table_size=128M
read_buffer_size=4M
read_rnd_buffer_size=16M
sort_buffer_size=32M
max_connections=1024
經(jīng)過(guò)測(cè)試.沒(méi)有特殊情況,最好還是用默認(rèn)的.
2G內(nèi)存,針對(duì)站多,抗壓型的設(shè)置,最佳:
table_cache=1024 物理內(nèi)存越大,設(shè)置就越大.默認(rèn)為2402,調(diào)到512-1024最佳
innodb_additional_mem_pool_size=4M 默認(rèn)為2M
innodb_flush_log_at_trx_commit=1
(設(shè)置為0就是等到innodb_log_buffer_size列隊(duì)滿(mǎn)后再統(tǒng)一儲(chǔ)存,默認(rèn)為1)
innodb_log_buffer_size=2M 默認(rèn)為1M
innodb_thread_concurrency=8 你的服務(wù)器CPU有幾個(gè)就設(shè)置為幾,建議用默認(rèn)一般為8
key_buffer_size=256M 默認(rèn)為218 調(diào)到128最佳
tmp_table_size=64M 默認(rèn)為16M 調(diào)到64-256最掛
read_buffer_size=4M 默認(rèn)為64K
read_rnd_buffer_size=16M 默認(rèn)為256K
sort_buffer_size=32M 默認(rèn)為256K
max_connections=1024 默認(rèn)為1210
thread_cache_size=120 默認(rèn)為60
query_cache_size=64M
優(yōu)化mysql數(shù)據(jù)庫(kù)性能的十個(gè)參數(shù)
(1)、max_connections:
允許的同時(shí)客戶(hù)的數(shù)量。增加該值增加 mysqld 要求的文件描述符的數(shù)量。這個(gè)數(shù)字應(yīng)該增加,否則,你將經(jīng)常看到 too many connections 錯(cuò)誤。 默認(rèn)數(shù)值是100,我把它改為1024 。
(2)、record_buffer:
每個(gè)進(jìn)行一個(gè)順序掃描的線(xiàn)程為其掃描的每張表分配這個(gè)大小的一個(gè)緩沖區(qū)。如果你做很多順序掃描,你可能想要增加該值。默認(rèn)數(shù)值是131072(128k),我把它改為16773120 (16m)
(3)、key_buffer_size:
索引塊是緩沖的并且被所有的線(xiàn)程共享。key_buffer_size是用于索引塊的緩沖區(qū)大小,增加它可得到更好處理的索引(對(duì)所有讀和多重寫(xiě)),到你能負(fù)擔(dān)得起那樣多。如果你使它太大,系統(tǒng)將開(kāi)始換頁(yè)并且真的變慢了。默認(rèn)數(shù)值是8388600(8m),我的mysql主機(jī)有2gb內(nèi)存,所以我把它改為 402649088(400mb)。
4)、back_log:
要求 mysql 能有的連接數(shù)量。當(dāng)主要mysql線(xiàn)程在一個(gè)很短時(shí)間內(nèi)得到非常多的連接請(qǐng)求,這就起作用,然后主線(xiàn)程花些時(shí)間(盡管很短)檢查連接并且啟動(dòng)一個(gè)新線(xiàn)程。
back_log 值指出在mysql暫時(shí)停止回答新請(qǐng)求之前的短時(shí)間內(nèi)多少個(gè)請(qǐng)求可以被存在堆棧中。只有如果期望在一個(gè)短時(shí)間內(nèi)有很多連接,你需要增加它,換句話(huà)說(shuō),這值對(duì)到來(lái)的tcp/ip連接的偵聽(tīng)隊(duì)列的大小。你的操作系統(tǒng)在這個(gè)隊(duì)列大小上有它自己的限制。試圖設(shè)定back_log高于你的操作系統(tǒng)的限制將是無(wú)效的。
當(dāng)你觀察你的主機(jī)進(jìn)程列表,發(fā)現(xiàn)大量 264084 | unauthenticated user | xxx.xxx.xxx.xxx | null | connect | null | login | null 的待連接進(jìn)程時(shí),就要加大 back_log 的值了。默認(rèn)數(shù)值是50,我把它改為500。
(5)、interactive_timeout:
服務(wù)器在關(guān)閉它前在一個(gè)交互連接上等待行動(dòng)的秒數(shù)。一個(gè)交互的客戶(hù)被定義為對(duì) mysql_real_connect()使用 client_interactive 選項(xiàng)的客戶(hù)。 默認(rèn)數(shù)值是28800,我把它改為7200。
(6)、sort_buffer:
每個(gè)需要進(jìn)行排序的線(xiàn)程分配該大小的一個(gè)緩沖區(qū)。增加這值加速order by或group by操作。默認(rèn)數(shù)值是2097144(2m),我把它改為 16777208 (16m)。
(7)、table_cache:
為所有線(xiàn)程打開(kāi)表的數(shù)量。增加該值能增加mysqld要求的文件描述符的數(shù)量。mysql對(duì)每個(gè)唯一打開(kāi)的表需要2個(gè)文件描述符。默認(rèn)數(shù)值是64,我把它改為512。
(8)、thread_cache_size:
可以復(fù)用的保存在中的線(xiàn)程的數(shù)量。如果有,新的線(xiàn)程從緩存中取得,當(dāng)斷開(kāi)連接的時(shí)候如果有空間,客戶(hù)的線(xiàn)置在緩存中。如果有很多新的線(xiàn)程,為了提高性能可以這個(gè)變量值。通過(guò)比較 connections 和 threads_created 狀態(tài)的變量,可以看到這個(gè)變量的作用。我把它設(shè)置為 80。
(9)mysql的搜索功能
用mysql進(jìn)行搜索,目的是能不分大小寫(xiě),又能用中文進(jìn)行搜索
只需起動(dòng)mysqld時(shí)指定 --default-character-set=gb2312
(10)、wait_timeout:
服務(wù)器在關(guān)閉它之前在一個(gè)連接上等待行動(dòng)的秒數(shù)。 默認(rèn)數(shù)值是28800,我把它改為7200。
注:參數(shù)的調(diào)整可以通過(guò)修改 /etc/my.cnf 文件并重啟 mysql 實(shí)現(xiàn)。這是一個(gè)比較謹(jǐn)慎的工作,上面的結(jié)果也僅僅是我的一些看法,你可以根據(jù)你自己主機(jī)的硬件情況(特別是內(nèi)存大小)進(jìn)一步修改。
navicat premium 12調(diào)節(jié)命令列界面字的大?。捍蜷_(kāi)navicat在工具欄找到工具——選項(xiàng)——字體,就可以修改字體的大小顏色,語(yǔ)言等選項(xiàng)了。不過(guò)要重新打開(kāi)才能看到你修改后的效果。
在彈出的‘選項(xiàng)’框中,在‘常規(guī)’-‘??俊锕催x‘使用停靠’,然后有個(gè)‘??看蜷_(kāi)的窗口’有兩種值:‘到主窗口’和‘到停靠窗口’。
介紹:
將此工具連接數(shù)據(jù)庫(kù),你可以從中看到各種數(shù)據(jù)庫(kù)的詳細(xì)信息。包括報(bào)錯(cuò),等等。當(dāng)然,你也可以通過(guò)他,登陸數(shù)據(jù)庫(kù),進(jìn)行各種操作。
Navicat Premium是一個(gè)可多重連線(xiàn)資料庫(kù)的管理工具,它可以讓你以單一程式同時(shí)連線(xiàn)到 MySQL、SQLite、Oracle 及 PostgreSQL 資料庫(kù),讓管理不同類(lèi)型的資料庫(kù)更加的方便。
Navicat Premium結(jié)合了其他Navicat成員的功能。有了這種連線(xiàn)到不同資料庫(kù)類(lèi)型的能力,Navicat Premium支持在 MySQL、SQLite、Oracle 及 PostgreSQL 之間傳輸資料。