這是歷史版本頁面 — 看 MySQL (32-bit) 最新版本

裝了 MySQL 之後不知道怎麼開始?它能做什麼、該不該用

MySQL (32-bit) 軟體圖示 MySQL (32-bit) 5.6.16 (32-bit) 資料更新 2014-02-04 閱讀約 6 分鐘

你剛把 MySQL 裝好,打開黑色的命令提示字元視窗,輸入指令後卻不確定下一步要做什麼。或者你正在架一個網站、寫一支小程式,需要一個地方存放資料,聽別人說「用 MySQL 就好」,但你真的打開它之後,才發現跟想像中完全不一樣——沒有漂亮的視窗介面,只有一行一行的文字指令,你甚至不知道該從哪個指令開始。

一般人遇到這種狀況,直覺是去裝一個圖形介面工具,或是上網找教學影片。但問題往往不是「不會操作」,而是「不確定 MySQL 到底能幫你做到什麼程度」。它不像一般應用程式打開就能用,它是一套資料庫伺服器,需要你先理解「資料庫」的概念,才知道怎麼讓它為你工作。這類工具的核心切入點,是讓你把資料有結構地存起來、隨時查得回來,而不是像 Excel 那樣手動管理。

01MySQL 到底是做什麼用的?

它是一套關聯式資料庫管理系統,用來存放、管理、查詢資料。你可以把它想成一個「有結構的倉庫」——先把資料依照表格、欄位、關聯的方式規劃好,之後用 SQL 指令把資料寫進去或讀出來。網站會員資料、訂單紀錄、文章內容,這類需要頻繁讀寫的資料,都適合交給它處理。

02這套軟體一定要用指令操作嗎?

它本身主要透過命令提示字元操作,沒有內建圖形介面。但官方文件提到,可以搭配 phpMyAdmin、MySQL Workbench、Navicat 這些第三方工具,用滑鼠點一點就能建立表格、執行查詢、看效能狀態。如果你不習慣打指令,裝一個圖形工具會比較好上手。

03我原本用別的資料庫,可以把資料搬過來嗎?

官方說明指出,它提供工具和公用程式,可以從 Oracle、SQL Server、PostgreSQL 這些其他資料庫系統遷移過來。不過實際遷移的過程會牽涉到資料型別轉換、編碼設定等細節,建議先找官方文件確認支援的版本和步驟,再動手轉移。

04它支援寫入複雜的邏輯嗎?例如自動計算或觸發事件?

支援。官方文件明確列出它支援預存程序、觸發器和函數,意思是你可以把一段常用的 SQL 邏輯存起來重複呼叫,也可以在特定事件發生時自動執行某段程式。這對需要自動化處理資料的應用程式來說,是很常用的功能。

05資料放進去之後,要怎麼防止別人亂看?

它提供使用者認證、存取控制和加密機制。你可以建立不同的使用者帳號,分別設定他們能看哪些資料庫、能執行哪些操作,也可以啟用加密來保護傳輸中的資料。不過這些都需要你自己去設定,預設狀態下並不會自動幫你做好完整的權限控管。

06我完全沒寫過程式,適合用這套軟體嗎?

官方文件提到,要有效使用 MySQL,需要具備 SQL 語言的基本概念。如果你完全沒有接觸過資料庫,直接從指令開始會比較吃力。建議先學一點 SQL 語法,或從圖形介面工具開始操作,理解「表格、欄位、查詢」這些基本概念之後,再回來用指令會順很多。

07我只是做一個簡單的小專案,用這套會不會太重?

官方說明指出,它適合從小型應用到大規模企業系統。但如果你只是要存少量資料、不想管伺服器設定,官方文件也提到 SQLite 這類「免伺服器」的資料庫,特色是簡單、可攜、零設定。如果你的專案不需要多人同時連線、不需要複雜查詢,SQLite 可能更省事。

08這套軟體是免費的嗎?有沒有什麼限制?

它分為 Community Edition(免費、開放原始碼)和 Enterprise Edition(付費訂閱)。免費版功能已經很完整,但官方文件提到,進階功能像是即時分析、企業級技術支援,只有在付費的 Enterprise Edition 才有。如果你需要的是基本儲存和查詢,免費版通常夠用。

09我習慣用圖形介面,這套軟體有中文介面嗎?

它的介面語言是英文,而且主要操作介面是命令列。官方文件提到的第三方工具,像是 phpMyAdmin、MySQL Workbench,是否有中文介面需要另外確認。如果你很依賴中文介面,可能要考慮其他有提供在地化語言的資料庫工具,或先試用看看英文介面能不能接受。

10這套軟體在 Windows 上跑得順嗎?

官方說明指出,它支援 Windows、macOS 和 Linux,安裝過程通常是執行安裝程式、按幾個下一步。但官方文件也提醒,系統需求會依作業系統和版本而異,需要足夠的磁碟空間、記憶體和處理器效能。如果你的電腦規格比較舊,建議先確認官方列出的需求再安裝。

11我聽說 MySQL 很容易被駭,是真的嗎?

官方文件強調它提供多種驗證機制和加密選項來保護資料,但安全性很大程度取決於你怎麼設定。預設安裝完成後,如果你沒有修改預設帳號密碼、沒有設定防火牆規則,確實會有風險。建議安裝後第一件事就是設定強密碼、建立專用帳號,並關閉不需要的網路連線。

12這套軟體和 SQL Server Express 比起來,哪個比較適合我?

兩者都是免費的資料庫,但取向不同。SQL Server Express 是微軟的產品,和 Windows 環境、微軟開發工具整合較好;MySQL 則強調跨平台、支援多種程式語言。官方文件也提到,SQL Server 是 MySQL 的替代方案之一。如果你主要用微軟生態系,SQL Server Express 可能比較順;如果你需要跨平台或搭配開源技術,MySQL 會是常見選擇。

下載與官方連結

前往官方網站 下載 MySQL (32-bit)

mysql-5.6.16-win32.msi · 38.54 MB · 連結指向軟體原廠

版本紀錄

再看 5 筆

看完整版本清單

這一版改了什麼

What's new in this version:

Functionality Added or Changed:
- Previously, ALTER TABLE in MySQL 5.6 could alter a table such that the result had temporal columns in both 5.5 and 5.6 format. Now ALTER TABLE upgrades old temporal columns to 5.6 format for ADD COLUMN, CHANGE COLUMN, MODIFY COLUMN, ADD INDEX, and FORCE operations. This conversion cannot be done using the INPLACE algorithm, so specifying ALGORITHM=INPLACE in these cases results in an error. (Bug #17246318)
- CMake now supports a -DTMPDIR=dir_name option to specify the default tmpdir value. If unspecified, the value defaults to P_tmpdir in . Thanks to Honza Horak for the patch. (Bug #68338, Bug #16316074) Bugs Fixed:
- InnoDB; Replication: Using the InnoDB memcached plugin (see InnoDB Integration with memcached) with innodb_api_enable_binlog set to 1 caused the server to leak memory. (Bug #70757, Bug #17675622)
- InnoDB: A boolean mode full-text search query would result in a memory access violation during parsing. (Bug #17978763)
- InnoDB: When new indexes are added by an ALTER TABLE operation, instead of only saving table-level statistics and statistics for the new indexes, InnoDB would save statistics for the entire table, including the table's other indexes. This behavior slowed ALTER TABLE performance. (Bug #17848838, Bug #16511145)
- InnoDB: Due to a parser error, full-text search queries that include a sub-expression could return the wrong result. (Bug #17840768)
- InnoDB: The innochecksum tool did not use a Windows-specific API to retrieve file size information, which resulted in an incorrect error message (Error: ibdata1 cannot be found) when the MySQL 5.6 innochecksum 2GB file size limit was exceeded. innochecksum now provides support for files larger than 2GB in both MySQL 5.6 and MySQL 5.7. (Bug #17810862, Bug #70936)
- InnoDB: Due to a regression introduced by the fix for Bug#17371537, memory was not allocated for the default memcached engine when using the default memcached engine as the backstore for data instead of InnoDB. (Bug #17800829)
- InnoDB: InnoDB would report an incorrect operating system error code after failing to initialize. (Bug #17788055, Bug #70867)
- InnoDB: Manipulating a table after discarding its tablespace using ALTER TABLE ... DISCARD TABLESPACE could result in a serious error. (Bug #17700280)
- InnoDB: Persistent optimizer statistics would cause stalls due to latch contention. (Bug #17699331, Bug #70768)
- InnoDB: MATCH() ... AGAINST queries that use a long string as an argument for AGAINST() could result in an error when run on an InnoDB table with a full-text search index. (Bug #17640261)
- InnoDB: An InnoDB full-text search failure would occur due to an “unended” token. The string and string length should be passed for string comparison. (Bug #17659310)
- InnoDB: In debug builds, a merge insert buffer during a page read would cause a memory access violation. (Bug #17561188)
- InnoDB: Truncating a memcached InnoDB table while memcached is performing DML operations would result in a serious error. (Bug #17468031)
- InnoDB: In sync0rw.ic, rw_lock_x_lock_func_nowait would needlessly call os_thread_get_curr_id. (Bug #17509710, Bug #70417)
- InnoDB: Attempting to rename a table to a missing database would result in a serious error. (Bug #17447500)
- InnoDB: If a tablespace data file path is updated in a .isl file and then a crash recovery is performed, the updated tablespace data file path is read from the .isl file but the SYS_DATAFILES table would not be not updated. The SYS_DATAFILES table is now updated with the new data file path after crash recovery. (Bug #17448389)
- InnoDB: If the first page (page 0) of file-per-table tablespace data file was corrupt, recovery would be halted even though the doublewrite buffer contained a clean copy of the page. (Bug #17335427, Bug #70087)
- InnoDB: The InnoDB memcached Readme file (README-innodb_memcached) incorrectly stated that libevent 1.6.0 is linked statically into daemon memcached. The bundled version of libevent is 1.4.12, not 1.6.0. (Bug #17324419, Bug #70034)
- InnoDB: Attempting to reset a replication slave while innodb_force_recovery is greater than 0 would return a cryptic error message: ERROR(1030) HY000: Got error -1 from storage engine. The error message has been changed to: ERROR HY000: Operation not allowed when innodb_force_recovery > 0. Replication options such as --relay-log-info-repository=TABLE and --master-info-repository=TABLE store information in tables in InnoDB. When innodb_force_recovery is greater than 0, replication tables cannot be updated which may cause replication administration commands to fail. (Bug #17287443, Bug #69907)
- InnoDB: The ALTER TABLE INPLACE algorithm would fail to decrease the auto-increment value. (Bug #17250787, Bug #69882)
- InnoDB: Comments in btr0cur.cc incorrectly stated that btr_cur_pessimistic_update() and btr_cur_optimistic_update() would accept a NULL value. (Bug #17231743, Bug #69847)
- InnoDB: dict_table_schema_check would call dtype_sql_name needlessly. (Bug #17193801, Bug #69802)
- InnoDB: The function os_file_get_status would not work with raw devices. (Bug #17023438, Bug #69424)
- InnoDB: During crash recovery, an incorrect transaction active time would result in rolling back an uncommitted transaction. (Bug #16936961, Bug #69438)
- InnoDB: Heap block debugging information (file_name, lineno), used for logging diagnostics, would appear in release builds. This information should only appear in debug builds. (Bug #16924719, Bug #69422)
- InnoDB: Renaming a column while also adding or dropping columns in the same ALTER TABLE operation would cause an error. (Bug #16864981)
- InnoDB: An online ALTER TABLE operation would consume more memory than expected. During an online ALTER TABLE operation, an online log buffer containing a head and tail buffer is created for each index that is created or rebuilt. The tail buffer is the writer context and is only required for concurrent write operations on an index while the ALTER TABLE operation is in progress. The head buffer is the reader context and is only required during the log apply phase. To reduce memory consumption, the tail buffer is now allocated when the first DML statement is run on the index, and the head buffer is only allocated in the log apply phase and freed afterwards. (Bug #16868967, Bug #69325, Bug #17911720)
InnoDB: On Windows, the full-text search (FTS) object ID was not in the expected hexadecimal format. (Bug #16559254)
References: See also Bug #16559119.
InnoDB: Fetching and releasing pages from the buffer pool and tracking the page state are expensive and complex operations. Prior to the bug fix, these operations were performed using a page mutex. Using a page mutex to track several things is expensive and does not scale well. The bug fix separates fetch and release tracking (in-use state) of a page from page I/O state tracking. Fetch and release is now tracked using atomics where available.
For portability, a new CMake build option, INNODB_PAGE_ATOMIC_REF_COUNT (default ON), can be used to disable atomic page reference counting on platforms where atomics support is not available. When atomic page reference counting is enabled (default), “[Note] InnoDB: Using atomics to ref count buffer pool pages” is printed to the error log at server startup. If atomic page reference counting is disabled, “[Note] InnoDB: Using mutexes to ref count buffer pool pages” is printed instead. (Bug #16249481, Bug #68079)
- InnoDB: Table renaming errors would appear in the LATEST FOREIGN KEY ERROR section of the SHOW ENGINE INNODB STATUS output. (Bug #12762390, Bug #61746)
- InnoDB: UNIV_SYNC_DEBUG, which was disabled in univ.i with the fix for Bug#16720368, is now enabled. (Bug #69617, Bug #17033591)
- Partitioning: Queries using the index_merge optimization (see Index Merge Optimization) could return invalid results when run against tables that were partitioned by HASH. (Bug #17588348, Bug #70588)
- Partitioning: When no partition had returned a row since the last HA_ERR_KEY_NOT_FOUND error, the use of uninitialized memory in the priority queue used for returning rows in sorted order could lead to a crash of the server. (Bug #17401628)
- Replication: When the binary log I/O cache grew to exactly 32768 bytes and the current transaction was preceded by a transaction whose size was greater than 32768 bytes, events could be corrupted when written into the binary log. (Bug #17842137)
- Replication: Creating and dropping large numbers of temporary tables could lead to increased memory consumption. (Bug #17806014)
- Replication: mysqlbinlog --verbose failed when it encountered a corrupt row event in the binary log. Such a row event could also cause the slave to fail. (Bug #17632978)
- References: See also Bug #16960133.
- Replication: When log_warnings is greater than 1, the master prints binary log dump thread information—containing the slave server ID, binary log file name, and binary log position—in mysqld.1.err. A slave server ID greater than 2 billion was printed with a negative value in such cases. (Bug #17641586, Bug #70685)
- Replication: mysqlbinlog did not properly decode DECIMAL values in a row-based binary log. This could cause invalid values to be printed out for DECIMAL columns. (Bug #17544169)
- References: See also Bug #14309019.
- Replication: Seconds_Behind_Master in the output of SHOW SLAVE STATUS could under some conditions be reported as 0 when it should have had a value greater than zero. (Bug #17233214)
- References: See also Bug #16579028.
- Replication: The semisynchronous replication plugin was called twice for a DDL statement, incrementing Rpl_semi_sync_master_yes_tx by 2 instead of 1 each time such a statement was executed. (Bug #70410, Bug #17509011)
- Compilation errors occurred on Solaris 10; resolved by including my_config.h before system header files. (Bug #18046811)
- FORCE INDEX [FOR ORDER BY] (index_name) did not work for joins.
- The fix for this bug also also changes the warning created for EXPLAIN. Instead of printing only {IGNORE|USE|FORCE} INDEX it now also prints FOR {GROUP BY|ORDER BY|JOIN} if that was specified in the query. (Bug #17889511)
- With the compressed client/server protocol enabled, Performance Schema statement instrumentation could raise an assertion. (Bug #17794846)
- In some cases, UNIX_TIMESTAMP() could return NULL when it should return 0. (Bug #17728371)
- An assertion could be raised if a filesort failed to resize its main buffer when record properties changed. (Bug #17757914)
- The cache used for the Index Merge access method was freed only after successful retrieval of all rows. Interruption or failure of the operation led to a file descriptor leak. (Bug #17708621)
- Using the mysqldump --set-gtid-purged option with no value caused mysqldump to crash. (Bug #17650245)
- A race condition between Performance Schema statement event threads led to a server exit. (Bug #17637970)
- In a view definition requireing resolution of aggregrate expressions within a subquery to an outer query, selecting from the view could cause a server exit. (Bug #17547804)
- References: This bug is a regression of Bug #16436383.
- An addressing error in accessing the join buffer could produce invalid results or a server exit. (Bug #17513341)
- mysql_config incorrectly included some flags to generate compiler warning output. (Bug #17400967)
- With semi-join optimization enabled, queries with nested subqueries could cause a server exit due to incorrect resolution of references to columns in the middle query block. (Bug #17398972)
- In some cases, the optimizer wrote fixed-length temporary MyISAM tables to disk rather than variable-length temporary tables. (Bug #17231940)
- Enabling the validate_password plugin could result in incorrect password hashes being stored in the mysql.user table. (Bug #17065383)
- For accounts authenticated using the sha256_password plugin, setting the password after the password had been expired did not clear the password-expired flag. (Bug #16872181)
- On Mac OS X 10.7, a race condition involving vio_shutdown() and the select-based implementation of vio_io_wait() could cause a server exit. (Bug #16354789, Bug #17733393)
- Host names in example URLs used within the source code were replaced by names in the example.com domain, the domain intended by IANA for this purpose. (Bug #15890092)
- For utf8 and utf8mb4 strings, handler functions unnecessarily called a Unicode conversion function. (Bug #14057034)
- Several -W warning flags were turned off for compilation in maintainer mode if MySQL was configured with -DWITH_INNODB_MEMCACHED=1. (Bug #13898319)
- Calling the ExtractValue() function with an invalid XPath expression could in some cases lead to a failure of the server. (Bug #12428404, Bug #61065)
- Use of a nonmulti-byte algorithm for skipping leading spaces in multi-byte strings could cause a server exit. (Bug #12368495)
- With ONLY_FULL_GROUP_BY SQL mode enabled, a query that uses GROUP BY on a column derived from a subquery in the FROM clause failed with a column isn't in GROUP BY error, if the query was in a view. (Bug #11923239)
- For the utf8_bin collation, ORDER BY LOWER(col_name) could produce incorrect ordering. (Bug #69005, Bug #16691598)
- Several issues identified by the Coverity static analysis tool were fixed. Thanks to Honza Horak for the patch. (Bug #70830, Bug #17760511)
- On Windows, the --local-service server option did not work, and was not displayed in the --help message. (Bug #69637, Bug #17049656)
- It was not possible to query a view with an ORDER BY clause that referenced an alias in the SELECT clause of the view definition, unless all columns in the view were named in the select list.
- To handle this problem, the server now writes a view differently into the .frm file that stores the view definition. If you experience view-evaluation errors such as just described, drop and recreate the view so that the .frm file contains the updated view representation. (Bug #69678, Bug #17077305)
- The prototype of the Performance Schema instrumentation API mysql_cond_timedwait() call was fixed to be drop-in compatible with pthread_cond_timedwait(). This fix affects only implementers of third-party plugins. (Bug #70628, Bug #17702677)
- The make_atomic_cas_body64 implementation on IA32 with gcc but without gcc builtins could be miscompiled due to an incorrect constraint. The patch also causes MySQL to use builtin atomics when compiled using Clang. (Bug #63451, Bug #17242996)
- Complex updates of Performance Schema tables involving joins or subqueries failed to update every row. (Bug #70025, Bug #17309657)
For the path specified with the --basedir option, mysql_plugin attempted to unlink the path rather than free the memory in which the path was stored. (Bug #69752, Bug #17168602)
- COUNT(DISTINCT) sometimes produced an incorrect result when the last read row contained a NULL value. (Bug #68749, Bug #16539979, Bug #71028, Bug #17867117)
- sql_resolver.cc referred to partitioning code that should have been protected by an #ifdef, even when MySQL was configured with -DWITH_PARTITION_STORAGE_ENGINE=OFF. (Bug #71010, Bug #17876794)
- In incorrect result could be returned for a query with an IF() predicate in the WHERE clause combined with OUTER JOIN in a subquery that is transformed to a semi-join. (A workaround is to disable semi-join using SET optimizer_switch='semijoin=off';) (Bug #70608, Bug #17600176)
- A full-text search combined with derived tables (subqueries in the FROM clause) caused a server exit.
- Now if a full-text operation depends on a derived table, the server produces an error indicating that a full-text search cannot be done on a materialized table. (Bug #68751, Bug #16539903)
- Some scripts displayed out-of-date information regarding where to report bugs. (Bug #68742, Bug #16530527)
- Some files in the Performance Schema file_instances table were not being removed because the file-removal operation was not instrumented. (Bug #69782, Bug #17209750)
- mysqldump --single-transaction acquired metadata locks for each dumped table but did not release them until the dump operation finished. Consequently, other DDL operations on a dumped table blocked even after the table itself had been dumped. mysqldump now attempts to release metadata locks earlier. (Bug #71017, Bug #17862905)
- Updating a FEDERATED table with UPDATE... JOIN caused a server exit when the local table contained a single row and that row could be joined to a row in the FEDERATED table. (Bug #68354, Bug #16324629)
- mysql_install_db referred to the obsolete mysqlbug script for reporting problems. It now refers to http://bugs.mysql.com/ instead. (Bug #29716, Bug #11746921)