在启动mysql时报下列错误
[root@mysqld2 ~]# service mysql.server start
Starting MySQL......................................The server quit without updating PID file (/var/lib/mysql/mysqld2.clvn.com.cn.pid). [失败]
解决方法
查看日志文件
[root@mysqld1 mysql]# tail /var/log/mysqld.log
2014-05-09 22:08:10 3483 [Note] NDB: Changed global value of binlog_format from STATEMENT to MIXED
2014-05-09 22:08:46 3483 [Warning] NDB: server id set to zero - changes logged to bin log with server id zero will be logged with another server id by slave mysqlds
2014-05-09 22:08:46 3483 [Note] Starting Cluster Binlog Thread
2014-05-09 22:08:46 3483 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 6f59371c-d783-11e3-ac36-000c2971b28f.
2014-05-09 22:08:46 3483 [Note] Server hostname (bind-address): '*'; port: 3306
2014-05-09 22:08:46 3483 [Note] IPv6 is available.
2014-05-09 22:08:46 3483 [Note] - '::' resolves to '::';
2014-05-09 22:08:46 3483 [Note] Server socket created on IP: '::'.
2014-05-09 22:08:46 3483 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
140509 22:08:46 mysqld_safe mysqld from pid file /var/lib/mysql/mysqld1.clvn.com.cn.pid ended
解决方法
[root@mysqld1 mysql]# scripts/mysql_install_db --user=mysql
Installing MySQL system tables...2014-05-09 22:51:12 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-05-09 22:51:12 3564 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-05-09 22:51:12 3564 [Note] InnoDB: The InnoDB memory heap is disabled
2014-05-09 22:51:12 3564 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-05-09 22:51:12 3564 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-05-09 22:51:12 3564 [Note] InnoDB: Using Linux native AIO
2014-05-09 22:51:12 3564 [Note] InnoDB: Using CPU crc32 instructions
2014-05-09 22:51:12 3564 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-05-09 22:51:12 3564 [Note] InnoDB: Completed initialization of buffer pool
2014-05-09 22:51:12 3564 [Note] InnoDB: Highest supported file format is Barracuda.
2014-05-09 22:51:12 3564 [Note] InnoDB: 128 rollback segment(s) are active.
2014-05-09 22:51:12 3564 [Note] InnoDB: Waiting for purge to start
2014-05-09 22:51:13 3564 [Note] InnoDB: 5.6.17 started; log sequence number 1626007
2014-05-09 22:51:13 3564 [Note] Binlog end
2014-05-09 22:51:13 3564 [Note] InnoDB: FTS optimize thread exiting.
2014-05-09 22:51:13 3564 [Note] InnoDB: Starting shutdown...
2014-05-09 22:51:14 3564 [Note] InnoDB: Shutdown completed; log sequence number 1626017
OK
Filling help tables...2014-05-09 22:51:14 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-05-09 22:51:14 3588 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-05-09 22:51:14 3588 [Note] InnoDB: The InnoDB memory heap is disabled
2014-05-09 22:51:14 3588 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-05-09 22:51:14 3588 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-05-09 22:51:14 3588 [Note] InnoDB: Using Linux native AIO
2014-05-09 22:51:14 3588 [Note] InnoDB: Using CPU crc32 instructions
2014-05-09 22:51:14 3588 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-05-09 22:51:14 3588 [Note] InnoDB: Completed initialization of buffer pool
2014-05-09 22:51:14 3588 [Note] InnoDB: Highest supported file format is Barracuda.
2014-05-09 22:51:14 3588 [Note] InnoDB: 128 rollback segment(s) are active.
2014-05-09 22:51:15 3588 [Note] InnoDB: Waiting for purge to start
2014-05-09 22:51:15 3588 [Note] InnoDB: 5.6.17 started; log sequence number 1626017
2014-05-09 22:51:15 3588 [Note] Binlog end
2014-05-09 22:51:15 3588 [Note] InnoDB: FTS optimize thread exiting.
2014-05-09 22:51:15 3588 [Note] InnoDB: Starting shutdown...
2014-05-09 22:51:16 3588 [Note] InnoDB: Shutdown completed; log sequence number 1626027
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h mysqld1.clvn.com.cn password 'new-password'
Alternatively you can run:
./bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
WARNING: Found existing config file ./my.cnf on the system.
Because this file might be in use, it was not replaced,
but was used in bootstrap (unless you used --defaults-file)
and when you later start the server.
The new default config file was created as ./my-new.cnf,
please compare it with your file and take the changes you need.
[root@mysqld1 mysql]# ./bin/mysqld_safe &
[1] 3612
[root@mysqld1 mysql]# 140509 22:51:29 mysqld_safe Logging to '/usr/local/mysql/data/mysqld1.clvn.com.cn.err'.
140509 22:51:29 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
查看mysql.server的状态信息
[root@mysqld1 ~]# service mysql.server start
Starting MySQL. [确定]
问题解决

MySQL索引基数对查询性能有显著影响:1.高基数索引能更有效地缩小数据范围,提高查询效率;2.低基数索引可能导致全表扫描,降低查询性能;3.在联合索引中,应将高基数列放在前面以优化查询。

MySQL學習路徑包括基礎知識、核心概念、使用示例和優化技巧。 1)了解表、行、列、SQL查詢等基礎概念。 2)學習MySQL的定義、工作原理和優勢。 3)掌握基本CRUD操作和高級用法,如索引和存儲過程。 4)熟悉常見錯誤調試和性能優化建議,如合理使用索引和優化查詢。通過這些步驟,你將全面掌握MySQL的使用和優化。

MySQL在現實世界的應用包括基礎數據庫設計和復雜查詢優化。 1)基本用法:用於存儲和管理用戶數據,如插入、查詢、更新和刪除用戶信息。 2)高級用法:處理複雜業務邏輯,如電子商務平台的訂單和庫存管理。 3)性能優化:通過合理使用索引、分區表和查詢緩存來提升性能。

MySQL中的SQL命令可以分為DDL、DML、DQL、DCL等類別,用於創建、修改、刪除數據庫和表,插入、更新、刪除數據,以及執行複雜的查詢操作。 1.基本用法包括CREATETABLE創建表、INSERTINTO插入數據和SELECT查詢數據。 2.高級用法涉及JOIN進行表聯接、子查詢和GROUPBY進行數據聚合。 3.常見錯誤如語法錯誤、數據類型不匹配和權限問題可以通過語法檢查、數據類型轉換和權限管理來調試。 4.性能優化建議包括使用索引、避免全表掃描、優化JOIN操作和使用事務來保證數據一致性

InnoDB通過undolog實現原子性,通過鎖機制和MVCC實現一致性和隔離性,通過redolog實現持久性。 1)原子性:使用undolog記錄原始數據,確保事務可回滾。 2)一致性:通過行級鎖和MVCC確保數據一致。 3)隔離性:支持多種隔離級別,默認使用REPEATABLEREAD。 4)持久性:使用redolog記錄修改,確保數據持久保存。

MySQL在數據庫和編程中的地位非常重要,它是一個開源的關係型數據庫管理系統,廣泛應用於各種應用場景。 1)MySQL提供高效的數據存儲、組織和檢索功能,支持Web、移動和企業級系統。 2)它使用客戶端-服務器架構,支持多種存儲引擎和索引優化。 3)基本用法包括創建表和插入數據,高級用法涉及多表JOIN和復雜查詢。 4)常見問題如SQL語法錯誤和性能問題可以通過EXPLAIN命令和慢查詢日誌調試。 5)性能優化方法包括合理使用索引、優化查詢和使用緩存,最佳實踐包括使用事務和PreparedStatemen

MySQL適合小型和大型企業。 1)小型企業可使用MySQL進行基本數據管理,如存儲客戶信息。 2)大型企業可利用MySQL處理海量數據和復雜業務邏輯,優化查詢性能和事務處理。

InnoDB通過Next-KeyLocking機制有效防止幻讀。 1)Next-KeyLocking結合行鎖和間隙鎖,鎖定記錄及其間隙,防止新記錄插入。 2)在實際應用中,通過優化查詢和調整隔離級別,可以減少鎖競爭,提高並發性能。


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

SAP NetWeaver Server Adapter for Eclipse
將Eclipse與SAP NetWeaver應用伺服器整合。

Atom編輯器mac版下載
最受歡迎的的開源編輯器

ZendStudio 13.5.1 Mac
強大的PHP整合開發環境

VSCode Windows 64位元 下載
微軟推出的免費、功能強大的一款IDE編輯器

禪工作室 13.0.1
強大的PHP整合開發環境