bitsCN.com
是时候用PerconaDB替换MySQL了
作者:chszs,转载需注明。博客主页:http://blog.csdn.net/chszs
Percona数据库服务器是MySQL的增强版,替代MySQL并不复杂。
一、PerconaDB的特性
1)查询速度更快,数据的一致性更好
2)服务器运行及其稳定
3)可以延迟分片,或者避免分片
4)需要支付的费用比MySQL低
5)在优化和管理方面花费的时间更少
6)更高的正常运行时间
7)不排除猜测
还有一些特性:
1)数量更多的INFORMATION_SCHEMA表
2)数量更多的全局性能参数(Global Performance)和状态计数器(Status Counters)
3)每个索引性能计数器
4)每个用户性能计数器
5)每个客户端性能计数器
6)高精度进程列表时序
7)快速校验算法
8)缓冲池预加载
9)支持闪存缓冲
10)可从不同的服务器导入表
二、用PerconaDB代替MySQL
1)确保当前的数据得到了备份
# cp -Rf /var/lib/mysql /var/lib/mysql-orig # mv /etc/my.cnf /etc/my.cnf.orig
2)禁用目标,让cPanel不处理MySQL更新
# /scripts/update_local_rpm_versions --edit target_settings.MySQL50 uninstalled # /scripts/update_local_rpm_versions --edit target_settings.MySQL51 uninstalled # /scripts/update_local_rpm_versions --edit target_settings.MySQL55 uninstalled
3)从服务器移除所有的MySQL RPM包
# /scripts/check_cpanel_rpms --fix --targets=MySQL50,MySQL51,MySQL55
上面的命令会从服务器卸载MySQL RPM安装
4)创建数据库配置文件PerconaDB.repo
# vi /etc/yum.repos.d/PerconaDB.repo
添加下面的内容:
[percona] name = CentOS $releasever - Percona baseurl=http://repo.percona.com/centos/$releasever/os/$basearch/ enabled = 1 gpgkey = http://www.percona.com/redir/downloads/percona-release/RPM-GPG-KEY-percona gpgcheck = 1
5)在/etc/yum.conf文件内的“exclude”列表中移除php
6)安装PerconaDB-server、PerconaDB-client和PerconaDB-devel
# yum install Percona-Server-client-55 Percona-Server-server-55 Percona-Server-devel-55
7)启动Percona MySQL
# /etc/init.d/mysql start
8)然后运行Percona MySQL升级
# mysql_upgrade
# /etc/init.d/mysql restart
10)把php添加回/etc/yum.conf文件内的“exclude”列表中
11)用PHP重编译Apache
# /scripts/easyapache --build /etc/init.d/mysql status SUCCESS! MySQL (Percona Server) running (9425)
OK!
bitsCN.com
Mastering the method of adding MySQL users is crucial for database administrators and developers because it ensures the security and access control of the database. 1) Create a new user using the CREATEUSER command, 2) Assign permissions through the GRANT command, 3) Use FLUSHPRIVILEGES to ensure permissions take effect, 4) Regularly audit and clean user accounts to maintain performance and security.

ChooseCHARforfixed-lengthdata,VARCHARforvariable-lengthdata,andTEXTforlargetextfields.1)CHARisefficientforconsistent-lengthdatalikecodes.2)VARCHARsuitsvariable-lengthdatalikenames,balancingflexibilityandperformance.3)TEXTisidealforlargetextslikeartic

Best practices for handling string data types and indexes in MySQL include: 1) Selecting the appropriate string type, such as CHAR for fixed length, VARCHAR for variable length, and TEXT for large text; 2) Be cautious in indexing, avoid over-indexing, and create indexes for common queries; 3) Use prefix indexes and full-text indexes to optimize long string searches; 4) Regularly monitor and optimize indexes to keep indexes small and efficient. Through these methods, we can balance read and write performance and improve database efficiency.

ToaddauserremotelytoMySQL,followthesesteps:1)ConnecttoMySQLasroot,2)Createanewuserwithremoteaccess,3)Grantnecessaryprivileges,and4)Flushprivileges.BecautiousofsecurityrisksbylimitingprivilegesandaccesstospecificIPs,ensuringstrongpasswords,andmonitori

TostorestringsefficientlyinMySQL,choosetherightdatatypebasedonyourneeds:1)UseCHARforfixed-lengthstringslikecountrycodes.2)UseVARCHARforvariable-lengthstringslikenames.3)UseTEXTforlong-formtextcontent.4)UseBLOBforbinarydatalikeimages.Considerstorageov

When selecting MySQL's BLOB and TEXT data types, BLOB is suitable for storing binary data, and TEXT is suitable for storing text data. 1) BLOB is suitable for binary data such as pictures and audio, 2) TEXT is suitable for text data such as articles and comments. When choosing, data properties and performance optimization must be considered.

No,youshouldnotusetherootuserinMySQLforyourproduct.Instead,createspecificuserswithlimitedprivilegestoenhancesecurityandperformance:1)Createanewuserwithastrongpassword,2)Grantonlynecessarypermissionstothisuser,3)Regularlyreviewandupdateuserpermissions

MySQLstringdatatypesshouldbechosenbasedondatacharacteristicsandusecases:1)UseCHARforfixed-lengthstringslikecountrycodes.2)UseVARCHARforvariable-lengthstringslikenames.3)UseBINARYorVARBINARYforbinarydatalikecryptographickeys.4)UseBLOBorTEXTforlargeuns


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
