SlideShare a Scribd company logo
‫تعالی‬ ‫بسمه‬
‫مرجع‬
‫دخت‬ ‫اسمعیل‬ ‫یاشار‬ : ‫نوشته‬
‫نسخه‬
۰.۱
whoami : yashar esmaildokht
I am Gnu/Linux Sys/net/sec engineer|
Administrator & Oracle Dba |devops
my tel : 09141100257
my resume (fa) :goo.gl/oUQopW
Linkedin: goo.gl/Ljb9SF
website :
http://unixmen.ir
http://oraclegeek.ir
my nick name : royaflash
: ‫به‬ ‫تقدیم‬
‫خدا‬
‫شتافت‬ ‫یاریم‬ ‫به‬ ‫که‬ ‫بود‬ ‫او‬ ‫تنها‬ ‫هایم‬ ‫سختی‬ ‫در‬ ‫که‬ ‫چرا‬
‫مادرم‬
‫اویم‬ ‫مدیون‬ ‫که‬ ‫را‬ ‫حبت‬ َ‫م‬ ‫و‬ ‫انسانیت‬ ‫داد‬ ‫یاد‬ ‫و‬ . ‫کرد‬ ‫تقدیم‬ ‫زندگی‬ ‫به‬ ‫مرا‬ ‫که‬ ‫چرا‬
‫پدرم‬
‫اویم‬ ‫مدیون‬ ‫و‬ ‫بود‬ ‫من‬ ‫حامی‬ ‫همیشه‬ ‫روحش‬ ‫که‬
‫عشقم‬
‫هست‬ ‫و‬ ‫بود‬ ‫مشوقم‬ ‫که‬
‫سورس‬ ‫اپن‬ ‫جامعه‬
‫بشریت‬
‫را‬ ‫هایش‬ ‫دانسته‬ ‫میکند‬ ‫منتشر‬ ‫و‬ ‫میخواند‬ ‫که‬ ‫او‬ ‫و‬
): ‫هیچ‬ ‫دیگر‬ ‫و‬ ‫جهانی‬ ‫صلح‬ ‫امید‬ ‫به‬ ‫و‬
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
‫؟‬ ‫کنیم‬ ‫استفاده‬ ‫لینوکس‬/‫گنو‬ ‫از‬ ‫چرا‬
‫یک‬ ‫دنبال‬ ‫به‬ ‫باید‬ ،‫نیست‬ ‫‌تان‬
‫ی‬‫نیازها‬ ‫رفع‬ ‫برای‬ ‫مناسبی‬ ‫‌عامل‬
‫م‬‫سیست‬ ‫ویندوز‬ ‫که‬ ‫رسیدید‬ ‫نتیجه‬ ‫این‬ ‫به‬ ‫اگر‬
‫باشید‬ ‫آن‬ ‫برای‬ ‫جایگزین‬
.
‫ندارد‬ ‫وجود‬ ‫فراوانی‬ ‫‌های‬
‫ب‬‫انتخا‬
.
‫سایر‬ ‫میان‬ ‫از‬ ‫ما‬ ‫‌های‬
‫ب‬‫انتخا‬ ‫بهترین‬ ‫شاید‬
‫گنو‬ ‫و‬ ‫مک‬ ‫به‬ ‫تنها‬ ‫بتواند‬ ‫‌ها‬
‫ل‬‫‌عام‬
‫م‬‫سیست‬
/
‫شود‬ ‫منتهی‬ ‫لینوکس‬
.
‫‌ی‬
‫ه‬‫انحصارطلبان‬ ‫‌های‬
‫ت‬‫سیاس‬ ‫علت‬ ‫به‬ ‫مک‬
‫نصب‬ ‫‌افزارها‬
‫ت‬‫سخ‬ ‫سایر‬ ‫روی‬ ‫سختی‬ ‫به‬ ‫و‬ ‫است‬ ‫شرکت‬ ‫همان‬ ‫اختصاصی‬ ‫‌افزارهای‬
‫ت‬‫سخ‬ ‫به‬ ‫محصور‬ ‫اپل‬ ‫شرکت‬
‫ندارد‬ ‫مناسبی‬ ‫و‬ ‫کامل‬ ‫کارکرد‬ ‫نیز‬ ‫نصب‬ ‫صورت‬ ‫در‬ ‫و‬ ‫‌شود‬
‫ی‬‫م‬
.
‫گنو‬ ‫‌عامل‬
‫م‬‫سیست‬
/
‫بزرگترین‬ ‫از‬ ‫یکی‬ ‫لینوکس‬
‫دارد‬ ‫جالبی‬ ‫بسیار‬ ‌
‫ه‬‫تاریخچ‬ ‫که‬ ‫است‬ ‫رایانه‬ ‫تاریخ‬ ‫‌های‬
‫ه‬‫پروژ‬
.
‫یک‬ ‫توسط‬ ‫آن‬ ‫مونولیتیک‬ ‫‌ی‬
‫ه‬‫هست‬ ‫که‬ ‫‌عاملی‬
‫م‬‫سیست‬
‫انتشار‬ ‫مجوز‬ ‫انتخاب‬ ‫علت‬ ‫به‬ ‫بعدها‬ ‫اما‬ ‫شد‬ ‫ایجاد‬ ‫سرگرمی‬ ‫جهت‬ ‫تنها‬ ‫فنالندی‬ ‫دانشجوی‬
GPL
‫پیشرفت‬ ‫مسیر‬
‫در‬ ‫اکنون‬ ‫و‬ ‫پیمود‬ ‫جهشی‬ ‫را‬
۲۲
‫‌است‬
‫ه‬‌
‫د‬‫کر‬ ‫نفوذ‬ ‫‌ها‬
‫ن‬‫انسا‬ ‫اکثر‬ ‫زندگی‬ ‫در‬ ‫‌اش‬
‫ی‬‫سالگ‬
.
‫از‬ ‫بسیاری‬ ‫روزها‬ ‫این‬
‫پسوند‬ ‫که‬ ‫وسایلی‬
«
‫هوشمند‬
»
‫استفاده‬ ‫خود‬ ‫‌عامل‬
‫م‬‫سیست‬ ‫قلب‬ ‫عنوان‬ ‫به‬ ‫لینوکس‬ ‫از‬ ‫‌کشند‬
‫ی‬‫م‬ ‫خود‬ ‫دنبال‬ ‫به‬ ‫را‬
‫‌کنند‬
‫ی‬‫م‬
.
‫تلویزیون‬ ،‫یخچال‬ ‫مثل‬ ‫خانگی‬ ‫وسایل‬ ‫تا‬ ‫گرفته‬ ‫موتورسیکلت‬ ‫و‬ ‫ماشین‬ ‫مثل‬ ‫مختلف‬ ‫‌ی‬
‫ه‬‫نقلی‬ ‫وسایل‬ ‫از‬
‫دارند‬ ‫را‬ ‫خود‬ ‫جای‬ ‫نیز‬ ‫‌ها‬
‫ت‬‫تبل‬ ‫و‬ ‫موبایل‬ ‫‌های‬
‫ی‬‫گوش‬ ‫البته‬ ‫و‬ …‫و‬
.
‫گنو‬ ‫روی‬ ‫‌توان‬
‫ی‬‫م‬ ‫هم‬ ‫دسکتاپ‬ ‫‌ی‬
‫ه‬‫زمین‬ ‫در‬ ‫آیا‬ ‫‌گیرد؟‬
‫ی‬‫م‬ ‫چشمه‬ ‫سر‬ ‫کجا‬ ‫از‬ ‫موفقیت‬ ‫همه‬ ‫این‬ ‫اما‬
/
‫لینوکس‬
‫کرد؟‬ ‫باز‬ ‫حساب‬
‫گنو‬ ‫‌ی‬
‫ه‬‫رایان‬ ‫به‬ ‫نفوذ‬ ‫احتمال‬ ;
/
; ‫است‬ ‫کم‬ ‫لینوکسی‬
‫دنیاست‬ ‫‌های‬
‫ل‬‫‌عام‬
‫م‬‫سیست‬ ‫‌ترین‬
‫ن‬‫ام‬ ‫از‬ ‫یکی‬ ‫لینوکس‬ ‫مسلما‬
.
‫است‬ ‫‌ای‬
‫ه‬‫فلسف‬ ‫ویژگی‬ ‫این‬ ‫آمدن‬ ‫وجود‬ ‫به‬ ‫دلیل‬
‫گنو‬ ‫‌عامل‬
‫م‬‫سیست‬ ‫پشت‬ ‫که‬
/
‫دارد‬ ‫وجود‬ ‫آزاد‬ ‫‌افزارهای‬
‫م‬‫نر‬ ‫و‬ ‫لینوکس‬
.
‫الیسنیس‬ ‫طبق‬
GPL
‫انتشار‬ ‫مجوز‬ ‫که‬
‫ویرایش‬ ‫آزادانه‬ ،‫ببینید‬ ‫آزادانه‬ ‫را‬ ‫آنها‬ ،‫کنید‬ ‫دریافت‬ ‫آزادانه‬ ‫را‬ ‫برنامه‬ ‫یک‬ ‫کدهای‬ ‫‌توانید‬
‫ی‬‫م‬ ‫شما‬ ‫است‬ ‫لینوکس‬
‫کنید‬ ‫منتشر‬ ‫الیسنس‬ ‫همان‬ ‫تحت‬ ‫اما‬ ‫آزادانه‬ ‫نهایت‬ ‫در‬ ‫و‬ ‫کنید‬
.
‫‌دهنگان‬
‫ه‬‫توسع‬ ‫تا‬ ‫شده‬ ‫باعث‬ ‫ویژگی‬ ‫این‬
‫‌های‬
‫ه‬‫حفر‬ ‫و‬ ‫برده‬ ‫باال‬ ‫بسیار‬ ‫را‬ ‫‌عامل‬
‫م‬‫سیست‬ ‫پایداری‬ ‫امر‬ ‫همین‬ ‫و‬ ‫برسند‬ ‫نفر‬ ‫هزار‬ ‫صدها‬ ‫به‬ ‫لینوکس‬ ‫‌ی‬
‫ه‬‫هست‬
‫‌است‬
‫ه‬‫کرد‬ ‫کم‬ ‫بسیار‬ ‫را‬ ‫امنیتی‬
.
‫است‬ ‫حقیقت‬ ‫یک‬ ‫نگرفتن‬ ‫ویروس‬
‫‌گیرد‬
‫ی‬‫نم‬ ‫ویروس‬ ‫لینوکس‬ ‫که‬ ‫‌باشید‬
‫ه‬‫شنید‬ ‫هم‬ ‫شما‬ ‫شاید‬
.
‫‌عامل‬
‫م‬‫سیست‬ ‫این‬ ‫کم‬ ‫کاربرد‬ ‫با‬ ‫را‬ ‫اتفاق‬ ‫‌این‬‫‌ها‬
‫ی‬‫خیل‬
‫از‬ ‫بیش‬ ‫که‬ ‫بدانید‬ ‫است‬ ‫بهتر‬ ‫اما‬ ‫‌کنند‬
‫ی‬‫م‬ ‫توجیه‬
۴۰۰
‫از‬ ‌
‫ه‬‫ابررایان‬
۵۰۰
‫استفاده‬ ‫لینوکس‬ ‫از‬ ‫دنیا‬ ‫برتر‬ ‫‌ی‬
‫ه‬‫ابررایان‬
‫از‬ ‫بیش‬ ‫همچنین‬ ‫‌کنندو‬
‫ی‬‫م‬
۷۰
‫‌های‬
‫ه‬‫دهند‬ ‫سرویس‬ ‫درصد‬
(
servers
)
‫انتخاب‬ ‫را‬ ‫‌عامل‬
‫م‬‫سیست‬ ‫این‬ ‫نیز‬ ‫جهان‬
‫‌اند‬
‫ه‬‫کرد‬
.
‫از‬ ‫دسکتاپ‬ ‫کاربران‬ ‫تعداد‬ ‫همچنان‬ ‫خاصی‬ ‫دالیل‬ ‫به‬ ‫البته‬
۳
‫‌است‬
‫ه‬‫نکرد‬ ‫تجاوز‬ ‫درصد‬
.
‫حساب‬ ‫این‬ ‫با‬
‫و‬ ‫‌ها‬
‫ه‬‫رایان‬ ‫ابر‬ ‫بخش‬ ‫در‬ ‫حیاتی‬ ‫‌های‬
‫ت‬‫مسئولی‬ ‫و‬ ‫زیاد‬ ‫بسیار‬ ‫کاربران‬ ‫علت‬ ‫به‬ ‫لینوکس‬ ‫‌عامل‬
‫م‬‫سیست‬ ‫مسلما‬
‫پایداری‬ ‫که‬ ‫‌کنیم‬
‫ی‬‫م‬ ‫مشاهده‬ ‫عمل‬ ‫در‬ ‫اما‬ ‫دارد‬ ‫نفوذ‬ ‫و‬ ‫خرابکاری‬ ‫برای‬ ‫ویندوز‬ ‫به‬ ‫نسبت‬ ‫بیشتری‬ ‫پتانسیل‬ ‫سرورها‬
‫دارد‬ ‫ویندوز‬ ‫به‬ ‫نسبت‬ ‫بیشتری‬ ‫امنیت‬ ‫و‬
.
‫‌گیرد؟‬
‫ی‬‫نم‬ ‫ویروس‬ ‫لینوکس‬ ‫چرا‬ ‫اما‬
‫وجود‬ ‫امر‬ ‫این‬ ‫دلیل‬
‌
‫ی‬‫دسترس‬ ‫مجوزهای‬
‫است‬ ‫متفاوت‬ ‫‌ها‬
‫ل‬‫فای‬ ‫به‬ ‫لینوکس‬ ‫دید‬ ‫یعنی‬ ‫است‬
.
‫اجرایی‬ ‫‌ی‬
‫ه‬‫برنام‬ ‫هر‬
‫‌کنند‬
‫ی‬‫م‬ ‫طی‬ ‫شدن‬ ‫اجرا‬ ‫برای‬ ‫را‬ ‫خاصی‬ ‫مراحل‬ ‫‌ها‬
‫س‬‫ویرو‬ ‫مثل‬
:
۱
.
‫‌کند‬
‫ی‬‫م‬ ‫بررسی‬ ‫بودن‬ ‫اجرایی‬ ‫نظر‬ ‫از‬ ‫را‬ ‫فایل‬ ‫نوع‬ ‫ابتدا‬ ‫‌عامل‬
‫م‬‫سیست‬
.
۲
.
‫‌شود‬
‫ی‬‫م‬ ‫بررسی‬ ‫اجرا‬ ‫برای‬ ‫کاربر‬ ‫مجوزهای‬
.
۳
.
‫‌گیرد‬
‫ی‬‫م‬ ‫قرار‬ ‫برنامه‬ ‫فایل‬ ‫اختیار‬ ‫در‬ ‫‌افزاری‬
‫ت‬‫سخ‬ ‫منابع‬ ‫و‬ ‫‌شود‬
‫ی‬‫م‬ ‫اجرا‬ ‫فایل‬ ‫باال‬ ‫مورد‬ ‫دو‬ ‫تایید‬ ‫صورت‬ ‫در‬
.
‫‌شوند‬
‫ی‬‫م‬ ‫طی‬ ‫چگونه‬ ‫ویندوز‬ ‫و‬ ‫لینوکس‬ ‫‌عامل‬
‫م‬‫سیست‬ ‫دو‬ ‫در‬ ‫مراحل‬ ‫این‬ ‫ببینیم‬ ‫حال‬
.
۱
.
‫‌شود‬
‫ی‬‫م‬ ‫شناخته‬ ‫آن‬ ‫پسوند‬ ‫از‬ ‫فایل‬ ‫نوع‬ ‫ویندوز‬ ‫در‬
.
‫پسوند‬ ‫فایل‬ ‫اگر‬ ‫یعنی‬
exe , com
‫یا‬
bat
‫مانند‬ ‫‌باشد‬
‫ه‬‫داشت‬
‫‌شود‬
‫ی‬‫م‬ ‫رفتار‬ ‫آن‬ ‫با‬ ‫اجرایی‬ ‫فایل‬
.
‫قابل‬ ‫که‬ ‫‌شوند‬
‫ی‬‫م‬ ‫شناخته‬ ‫آنها‬ ‫داخلی‬ ‫سرنام‬ ‫روی‬ ‫از‬ ‫‌ها‬
‫ل‬‫فای‬ ‫نوع‬ ‫لینوکس‬ ‫در‬ ‫اما‬
‫نیستند‬ ‫کاربر‬ ‫توسط‬ ‫تغییر‬
.
‫اجرایی‬ ‫فایل‬ ‫آن‬ ‫با‬ ‫لینوکس‬ ‫رفتار‬ ‫در‬ ‫تغییری‬ ‫هیچ‬ ‫پسوند‬ ‫نداشتن‬ ‫یا‬ ‫داشتن‬ ‫واقع‬ ‫در‬
‫آن‬ ‫پسوند‬ ‫اگر‬ ‫حتی‬ ‫است‬ ‫اجرایی‬ ‫حتما‬ ‫لینوکس‬ ‫در‬ ‫اجرایی‬ ‫فایل‬ ‫یک‬ ،‫‌کند‬
‫ی‬‫نم‬ ‫ایجاد‬
jpg
‫باشد‬
.
۲
.
‫دارند‬ ‫اجرا‬ ‫مجوز‬ ‫ویندوز‬ ‫در‬ ‫کاربران‬ ‫‌ی‬
‫ه‬‫هم‬ ‫برای‬ ‫‌ها‬
‫ل‬‫فای‬ ‫‌ی‬
‫ه‬‫هم‬ ‫‌فرض‬
‫ش‬‫پی‬ ‫حالت‬ ‫در‬
.
‫از‬ ‫که‬ ‫صورتی‬ ‫در‬ ‫البته‬
‫‌فایل‬
‫م‬‫سیست‬
Ntfs
‫کاری‬ ‫هر‬ ‫آزادند‬ ‫همه‬ ‫و‬ ‫داشت‬ ‫نخواهد‬ ‫وجود‬ ‫بررسی‬ ‫برای‬ ‫مجوزی‬ ‫اصال‬ ‫وگرنه‬ ‫کنید‬ ‫استفاده‬
‫دهند‬ ‫انجام‬
.
‫است‬ ‫فایل‬ ‫یک‬ ‫‌های‬
‫ش‬‫بخ‬ ‫مهمترین‬ ‫از‬ ‫کاربران‬ ‫برای‬ ‫اجرا‬ ‫مجوز‬ ‫لینوکس‬ ‫در‬
.
‫شناخته‬ ‫اجرایی‬ ‫اگر‬ ‫فایل‬ ‫یک‬ ‫یعنی‬
‫باشد‬ ‫داشته‬ ‫شدن‬ ‫اجرا‬ ‫مجوز‬ ‫باید‬ ‫اجرا‬ ‫برای‬ ‫شود‬
.
‫‌ی‬
‫ه‬‫کنند‬ ‫ایجاد‬ ‫کاربر‬ ‫برای‬ ‫فقط‬ ‫اجرا‬ ‫مجوز‬ ‫‌فرض‬
‫ش‬‫پی‬ ‫حالت‬ ‫در‬
‫‌رود‬
‫ی‬‫م‬ ‫بین‬ ‫از‬ ‫فایل‬ ‫شدن‬ ‫کپی‬ ‫صورت‬ ‫در‬ ‫هم‬ ‫مجوز‬ ‫این‬ ‫‌شود‬
‫ی‬‫م‬ ‫داده‬ ‫خاص‬ ‫شرایط‬ ‫در‬ ‫و‬ ‫فایل‬
.
‫شما‬ ‫اگر‬ ‫یعنی‬
‫اجرا‬ ‫مجوز‬ ‫آن‬ ‫به‬ ‫شما‬ ‫توسط‬ ‫تا‬ ‫شود‬ ‫دانلود‬ ‫اتوماتیک‬ ‫دالیلی‬ ‫به‬ ‫فایل‬ ‫این‬ ‫یا‬ ‫کنید‬ ‫دانلود‬ ‫اینترنت‬ ‫از‬ ‫را‬ ‫اجرایی‬ ‫فایل‬
‫‌گیرد‬
‫ی‬‫نم‬ ‫اختیار‬ ‫در‬ ‫را‬ ‫سیستم‬ ‫منابع‬ ‫نشود‬ ‫داده‬
.
‫پایین‬ ‫‌ی‬
‫ه‬‫هزین‬
‫انتشار‬ ‫مجوز‬ ‫از‬ ‫لینوکس‬ ‫‌ی‬
‫ه‬‫استفاد‬ ‫دلیل‬ ‫به‬ ‫هم‬ ‫باز‬
GPL
‫‌آید‬
‫ی‬‫م‬ ‫پایین‬ ‫بسیار‬ ‫‌عامل‬
‫م‬‫سیست‬ ‫نهایی‬ ‫‌ی‬
‫ه‬‫هزین‬
.
‫زیرا‬
‫‌است‬
‫ه‬‫شد‬ ‫نوشته‬ ‫دنیا‬ ‫سراسر‬ ‫مردم‬ ‫طرف‬ ‫از‬ ‫و‬ ‫داوطلبانه‬ ‫صورت‬ ‫به‬ ‫آن‬ ‫کدهای‬ ‫اکثر‬
.
‫دبیان‬ ‫‌دهندگان‬
‫ه‬‫توسع‬ ‫از‬ ‫یکی‬ ‫آنالیزهای‬ ‫طبق‬ ‫که‬ ‫بدانید‬ ‫است‬ ‫جالب‬
(
debian
)
‫نظر‬ ‫از‬ ‫لینوکس‬ ‫توزیع‬ ‫بزگترین‬ ‫که‬
‫تقریبا‬ ‫دبیان‬ ‫دوباره‬ ‫تولید‬ ،‫است‬ ‫برنامه‬ ‫شمار‬
۱۹.۱
‫دالر‬ ‫میلیارد‬
(
‫حدود‬ ‫چیزی‬ ‫یعنی‬
۲۴
‫و‬ ‫هزار‬
۷۰۰
‫تومان‬ ‫میلیارد‬
)
‫لینوکس‬ ‫‌ی‬
‫ه‬‫هست‬ ‫ارزش‬ ‫دیگری‬ ‫‌ای‬
‫ه‬‫محاسب‬ ‫در‬ ‫و‬ ‫دارد‬ ‫بر‬ ‫در‬ ‫هزینه‬
۳
‫‌است‬
‫ه‬‫شد‬ ‫زده‬ ‫تخمین‬ ‫دالر‬ ‫میلیارد‬
.
‫پذیری‬ ‫انعطاف‬
‫انتشار‬ ‫مجوز‬ ‫این‬ ‫آورد‬ ‫حساب‬ ‫به‬ ‫‌افزار‬
‫م‬‫نر‬ ‫صنعت‬ ‫برای‬ ‫انقالب‬ ‫یه‬ ‫را‬ ‫گنو‬ ‫‌توان‬
‫ی‬‫م‬ ‫حقیقتا‬
-
‫این‬ ‫آن‬ ‫از‬ ‫بهتر‬ ‫و‬
‫فلسفه‬
-
‫بود‬ ‫هم‬ ‫موفق‬ ‫حقیقتا‬ ‫و‬ ‫آمد‬ ‫وجود‬ ‫به‬ ‫‌افزارها‬
‫م‬‫نر‬ ‫پیشرفت‬ ‫سد‬ ‫برداشتن‬ ‫برای‬
.
‫انتشار‬ ‫مجوز‬ ‫لطف‬ ‫به‬ ‫هم‬ ‫پذیری‬ ‫انعطاف‬ ‫یعنی‬ ‫لینوکس‬ ‫ویژگی‬ ‫چهارمین‬
GPL
‫وجود‬ ‫به‬ ‫آزاد‬ ‫‌افزار‬
‫م‬‫نر‬ ‫تفکر‬ ‫و‬
‫آمده‬
.
‫سازی‬ ‫آماده‬ ‫خود‬ ‫نیازهای‬ ‫برای‬ ‫را‬ ‫آن‬ ‫و‬ ‫ویرایش‬ ‫آزادانه‬ ‫را‬ ‫‌عامل‬
‫م‬‫سیست‬ ‫این‬ ‫کدهای‬ ‫‌توان‬
‫ی‬‫م‬ ‫مجوز‬ ‫این‬ ‫طبق‬
‫کرد‬
.
‫ببینیم‬ ‫مختلف‬ ‫‌های‬
‫ه‬‫دستگا‬ ‫روی‬ ‫را‬ ‫‌عامل‬
‫م‬‫سیست‬ ‫این‬ ‫تا‬ ‫شده‬ ‫باعث‬ ‫ویژگی‬ ‫این‬
.
‫سیکلت‬ ‫موتور‬ ‫مثال‬
TTX02
‫شرکت‬ ‫محصول‬
Mavizen
‫‌ی‬
‫ه‬‫رایان‬ ‫با‬ ‫الکترونیک‬ ‫‌ای‬
‫ه‬‫مسابق‬ ‫موتورسیکلت‬ ‫نخستین‬
‫است‬ ‫داخلی‬
.
‫‌شود‬
‫ی‬‫م‬ ‫هدایت‬ ‫لینوکس‬ ‫طرق‬ ‫از‬ ‫کامال‬ ‫سیکلت‬ ‫موتور‬ ‫این‬
.
‫شرکت‬ ‫شیردوشی‬ ‫‌های‬
‫ه‬‫دستگا‬ ‫یا‬
DeLavel
‫‌کند‬
‫ی‬‫م‬ ‫استفاده‬ ‫دور‬ ‫راه‬ ‫از‬ ‫کنترل‬ ‫و‬ ‫مدیریت‬ ‫برای‬ ‫لینوکس‬ ‫‌عامل‬
‫م‬‫سیست‬ ‫از‬
.
‫پست‬ ‫سرویس‬ ‫همچنین‬
‫‌تپد‬
‫ی‬‫م‬ ‫لینوکسی‬ ‫‌عامل‬
‫م‬‫سیست‬ ‫یک‬ ‫آن‬ ‫قلب‬ ‫در‬ ‫که‬ ‫بوده‬ ‫متکی‬ ‫مراسالتی‬ ‫سازی‬ ‫مرتب‬ ‫سیستم‬ ‫بر‬ ‫متحده‬ ‫ایاالت‬
.
‫ایزامو‬
(
Isamu
)
‫سال‬ ‫حوالی‬ ‫در‬ ‫که‬
۲۰۰۱
‫لینوکس‬ ‫‌بر‬‫مبتنی‬ ‫‌نمای‬
‫ن‬‫انسا‬ ‫روبات‬ ‫نخستین‬ ‫عنوان‬ ‫به‬ ،‫شد‬ ‫عرضه‬
‫‌شود‬
‫ی‬‫م‬ ‫شناخته‬
.
‫است‬ ‫شده‬ ‫تبدیل‬ ‫‌ها‬
‫ت‬‫روبا‬ ‫انواع‬ ‫تمام‬ ‫معمول‬ ‫بنیان‬ ‫به‬ ‫لینوکس‬ ،‫‌کنون‬
‫ا‬‫ت‬ ‫زمان‬ ‫آن‬ ‫از‬ ‫اما‬
.
‫از‬
‫پلئو‬ ‫به‬ ‫‌توان‬
‫ی‬‫م‬ ‫‌ها‬
‫ت‬‫روبا‬ ‫این‬ ‫جمله‬
(
Pleo
)
‫کاتانا‬ ‫روباتیک‬ ‫بازوی‬ ‫و‬ ‫‌متحرک‬
‫ی‬‫‌باز‬
‫ب‬‫اسبا‬ ‫دایناسور‬
(
Katana
Robotic Arm
)
‫نورونیکز‬ ‫توسط‬ ‫که‬
(
Neuronics
)
‫کرد‬ ‫اشاره‬ ،‫است‬ ‫شده‬ ‫ساخته‬ ‫صنعتی‬ ‫کاربردهای‬ ‫برای‬
.
‫دارد‬ ‫حضور‬ ‫هم‬ ‫راهنما‬ ‫‌های‬
‫غ‬‫چرا‬ ‫در‬ ‫حتی‬ ‫‌عامل‬
‫م‬‫سیست‬ ‫این‬ ‫نهایت‬ ‫در‬ ‫و‬
.
‫ترافیک‬ ‫پیک‬
(
Peek Traffic
)
‫نظیر‬ ‫‌هایی‬
‫ن‬‫مکا‬ ‫در‬ ‫را‬ ‫ترافیک‬ ‫کنترل‬ ‫که‬ ‫‌کند‬
‫ی‬‫م‬ ‫تولید‬ ‫را‬ ‫لینوکس‬ ‫بر‬ ‫مبتنی‬ ‫راهنمایی‬ ‫‌های‬
‫غ‬‫چرا‬ ‫از‬ ‫‌ای‬
‫ه‬‫مجموع‬
‫بزرگراه‬ ‫حتی‬ ‫و‬ ‫نیویورک‬ ،‫آیوا‬
۱۰۱
‫دارند‬ ‫عهده‬ ‫بر‬ ‫‌آنجلس‬
‫س‬‫ل‬ ‫در‬
.
‫‌عامل‬
‫م‬‫سیست‬ ‫کدهای‬ ‫از‬ ‫اطالع‬
‫دارید‬ ‫خبر‬ ‫خود‬ ‫‌عامل‬
‫م‬‫سیست‬ ‫رازهای‬ ‫و‬ ‫رمز‬ ‫تمام‬ ‫از‬ ‫شما‬ ‫که‬ ‫است‬ ‫این‬ ‫‌سورس‬
‫ن‬‫اپ‬ ‫‌افزارهای‬
‫م‬‫نر‬ ‫‌های‬
‫ی‬‫ویژگ‬ ‫از‬ ‫یکی‬
.
‫نام‬ ‫به‬ ‫‌ای‬
‫ه‬‫برنام‬ ‫شناسایی‬ ‫باعث‬ ‫ویژگی‬ ‫همین‬ ‫مثال‬
carrier IQ
‫‌های‬
‫ن‬‫تلف‬ ‫کاربران‬ ‫از‬ ‫زیادی‬ ‫اطالعات‬ ‫که‬ ‫شد‬
‫‌کرد‬
‫ی‬‫م‬ ‫ارسال‬ ‫معلومی‬ ‫نا‬ ‫جای‬ ‫به‬ ‫و‬ ‫ذخیره‬ ‫را‬ ‫همراه‬
.
‫کنیم‬ ‫بررسی‬ ‫را‬ ‫تر‬ ‫افتاده‬ ‫پا‬ ‫پیش‬ ‫‌های‬
‫ی‬‫ویژگ‬ ‫هم‬ ‫کمی‬ ‫‌توانیم‬
‫ی‬‫م‬ ‫بگذریم‬ ‫کلیدی‬ ‫و‬ ‫اصلی‬ ‫‌های‬
‫ی‬‫ویژگ‬ ‫این‬ ‫از‬ ‫اگر‬ ‫اما‬
‫‌آید‬
‫ی‬‫م‬ ‫چشم‬ ‫به‬ ‫بیشتر‬ ‫دسکتاپ‬ ‫‌ی‬
‫ه‬‫نسخ‬ ‫در‬ ‫که‬
.
‫نصب‬ ‫از‬ ‫بعد‬ ‫آماده‬ ‫‌ی‬
‫ه‬‫برنام‬ ‫صدها‬
‫شما‬ ‫نیاز‬ ‫که‬ ‫‌شوند‬
‫ی‬‫م‬ ‫نصب‬ ‫دیگر‬ ‫درشت‬ ‫و‬ ‫ریز‬ ‫‌ی‬
‫ه‬‫برنام‬ ‫هزاران‬ ‫با‬ ‫فرض‬ ‫پیش‬ ‫صورت‬ ‫به‬ ‫لینوکس‬ ‫‌های‬
‫ه‬‫نسخ‬ ‫اکثر‬
‫‌کنند‬
‫ی‬‫م‬ ‫برطرف‬ ً‫ال‬‫کام‬ ‫را‬
.
‫‌ای‬
‫ه‬‫مجموع‬ ‫خرید‬ ‫و‬ ‫یافتن‬ ‫نیست‬ ‫الزم‬ ‫دیگر‬ ‫توزیع‬ ‫هر‬ ‫نصب‬ ‫از‬ ‫بعد‬ ‫شما‬ ‫همین‬ ‫برای‬
‫بدهید‬ ‫خود‬ ‫به‬ ‫‌افزاری‬
‫م‬‫نر‬
.
‫است‬ ‫استفاده‬ ‫‌ی‬
‫ه‬‫آماد‬ ‫چیز‬ ‫همه‬ ‫یافتن‬ ‫برای‬
.
‫کلیک‬ ‫یک‬ ‫با‬ ‫نصب‬
‫خود‬ ‫‌ی‬
‫ه‬‫رایان‬ ‫پشت‬ ‫از‬ ‫نیست‬ ‫الزم‬ ‫حتی‬ ‫نیست‬ ‫نگرانی‬ ‫جای‬ ‫داشتید‬ ‫نیاز‬ ‫‌ای‬
‫ه‬‫برنام‬ ‫به‬ ‫هم‬ ‫باز‬ ‫نصب‬ ‫از‬ ‫بعد‬ ‫اگر‬ ‫حتی‬
‫بخورید‬ ‫تکان‬
.
‫و‬ ‫نصب‬ ‫کار‬ ‫دارند‬ ‫قرار‬ ‫لینوکس‬ ‫مختلف‬ ‫‌های‬
‫ع‬‫توزی‬ ‫در‬ ‫که‬ ‫‌هایی‬
‫ه‬‫بست‬ ‫مدیریت‬ ‫یا‬ ‫نصاب‬ ‫‌های‬
‫ه‬‫برنام‬
‫‌دهند‬
‫ی‬‫م‬ ‫انجام‬ ‫کاربر‬ ‫برای‬ ‫سادگی‬ ‫به‬ ‫را‬ ‫بروزرسانی‬
.
‫متفاوت‬ ‫و‬ ‫سریع‬ ‫رسانی‬ ‫روز‬ ‫به‬
‫‌ی‬
‫ه‬‫آماد‬ ‫آن‬ ‫‌ی‬
‫ه‬‫شد‬ ‫اصالح‬ ‫‌ی‬
‫ه‬‫نسخ‬ ‫بعد‬ ‫روز‬ ‫چند‬ ‫بشود‬ ‫کشف‬ ‫باگی‬ ‫که‬ ‫هنگامی‬ ‫لینوکس‬ ‫عامل‬ ‫سیستم‬ ‫در‬
‫است‬ ‫کاربران‬ ‫‌ی‬
‫ه‬‫استفاد‬
.
،‫آپدیت‬ ‫افزار‬ ‫نرم‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫که‬ ‫است‬ ‫یکپارچه‬ ‫طوری‬ ‫لینوکس‬ ‫سیستم‬ ‫اینکه‬ ‫ضمن‬
‫دارید‬ ‫را‬ ‫ها‬ ‫برنامه‬ ‫اکثر‬ ‫رسانی‬ ‫بروز‬ ‫قدرت‬ ‫شما‬
.
‫برنامه‬ ‫و‬ ‫عامل‬ ‫سیستم‬ ‫اشکاالت‬ ‫به‬ ‫محدود‬ ‫تنها‬ ‫ویندوز‬ ‫در‬ ‫این‬
‫آن‬ ‫به‬ ‫وابسته‬ ‫های‬
(
…‫و‬ ‫اکسپلورر‬ ،‫پلیر‬ ‫مدیا‬ ‫مثل‬
)
‫است‬
.
‫های‬ ‫ویژگی‬ ‫امنیتی‬ ‫های‬ ‫آپدیت‬ ‫بر‬ ‫عالوه‬ ‫لینوکس‬ ‫در‬
‫باشد‬ ‫گرفته‬ ‫قرار‬ ‫بروزرسانی‬ ‫یک‬ ‫در‬ ‫است‬ ‫ممکن‬ ‫نیز‬ ‫جدیدی‬
.
‫نیست‬ ‫پوشیده‬ ‫شما‬ ‫بر‬ ‫چیز‬ ‫هیچ‬ ‫لینوکس‬ ‫در‬
.
‫‌های‬
‫ه‬‫بست‬ ‫تمامی‬ ‫حجم‬ ‫و‬ ‫توضیحات‬ ،‫نام‬ ،‫رسانی‬ ‫روز‬ ‫به‬ ‫‌ی‬
‫ه‬‫برنام‬
‫ببینید‬ ‫را‬ ‫روزرسانی‬ ‫به‬ ‫فرآیند‬ ‫ذره‬ ‫ذره‬ ‫‌توانید‬
‫ی‬‫م‬ ‫شما‬ ‫و‬ ‫‌گذارد‬
‫ی‬‫م‬ ‫شما‬ ‫اختیار‬ ‫در‬ ‫را‬ ‫شده‬ ‫‌روز‬
‫ه‬‫ب‬
.
‫سریع‬ ‫پیشرفت‬
‫‌دهد‬
‫ی‬‫م‬ ‫روی‬ ‫آزاد‬ ‫دنیای‬ ‫در‬ ‫نویی‬ ‫اتفاق‬ ‫روز‬ ‫هر‬ ‫آزاد‬ ‫‌افزارهای‬
‫م‬‫نر‬ ‫‌ی‬
‫ه‬‫فلسف‬ ‫و‬ ‫استالمن‬ ‫ریچارد‬ ‫لطف‬ ‫به‬
.
‫همین‬ ‫به‬
‫هستند‬ ‫شدن‬ ‫کامل‬ ‫حال‬ ‫در‬ ‫روز‬ ‫هر‬ ‫سورس‬ ‫اپن‬ ‫‌های‬
‫ه‬‫برنام‬ ‫علت‬
.
‫سرعت‬ ‫لینوکسی‬ ‫نویسان‬ ‫برنامه‬ ‫تعدد‬ ‫طرفی‬ ‫از‬
‫‌است‬
‫ه‬‫کرد‬ ‫بیشتر‬ ‫را‬ ‫پیشرفت‬ ‫این‬
.
‫درایورها‬ ‫نصب‬
‫دهید‬ ‫انجام‬ ‫کاری‬ ‫هیچ‬ ‫نیست‬ ‫الزم‬ ‫درایورها‬ ‫اکثر‬ ‫نصب‬ ‫برای‬ ‫لینوکس‬ ‫در‬
.
‫معروف‬ ‫قطعات‬ ‫با‬ ‫رایانه‬ ‫یک‬ ‫از‬ ‫اگر‬
‫‌کند‬
‫ی‬‫م‬ ‫اندازی‬ ‫راه‬ ‫و‬ ‫کرده‬ ‫شناسایی‬ ‫را‬ ‫قطعات‬ ‫خودکار‬ ‫صورت‬ ‫به‬ ‫لینوکس‬ ‫‌ی‬
‫ه‬‫هست‬ ‫‌کنید‬
‫ی‬‫م‬ ‫استفاده‬
.
‫به‬ ‫احتیاج‬ ‫‌ها‬
‫ه‬‫رایان‬ ‫بعضی‬ ‫در‬ ‫است‬ ‫ممکن‬ ‫که‬ ‫هستند‬ ‫قطعاتی‬ ‫تنها‬ ‫گرافیک‬ ‫‌های‬
‫ت‬‫کار‬ ‫و‬ ‫وایرلس‬ ‫‌های‬
‫م‬‫مود‬
‫باشند‬ ‫داشته‬ ‫‌انداز‬
‫ه‬‫را‬
.
‫‌العاده‬
‫ق‬‫فو‬ ‫‌های‬
‫ت‬‫افک‬ ‫و‬ ‫زیبایی‬
‫گنو‬ ‫‌های‬
‫ع‬‫توزی‬ ‫اینکه‬ ‫در‬
/
‫نکنید‬ ‫شک‬ ‫است‬ ‫‌تر‬
‫ن‬‫‌ر‬
‫د‬‫م‬ ‫و‬ ‫زیباتر‬ ‫بسیار‬ ‫ماکروسافت‬ ‌
‫ل‬‫‌عام‬
‫م‬‫سیست‬ ‫از‬ ‫لینوکس‬
.
‫به‬
‫‌های‬
‌
‫ه‬‫پنجر‬ ‫مدیر‬ ‫‌ی‬
‫ه‬‫وسیل‬
compiz
‫یا‬
Kwin
‫بدهید‬ ‫خود‬ ‫دسکتاپ‬ ‫به‬ ‫مختلف‬ ‫افکت‬ ‫دهها‬ ‫‌توانید‬
‫ی‬‫م‬
.
‫همچنین‬
‫زیبایی‬
KDE
‫سادگی‬ ‫و‬
Gnome
‫است‬ ‫‌زد‬
‫ن‬‫زبا‬ ‫لینوکس‬ ‫دنیای‬ ‫در‬
.
‫سلیقه‬ ‫هر‬ ‫برای‬ ‫‌هایی‬
‫ع‬‫توزی‬
‫دارد‬ ‫وجود‬ ‫لینوکس‬ ‫قدرتمند‬ ‫‌عامل‬
‫م‬‫سیست‬ ‫از‬ ‫متفاوت‬ ‫توزیع‬ ‫هزاران‬ ‫امروزه‬
.
‫‌های‬
‫ع‬‫توزی‬ ‫به‬ ‫‌توان‬
‫ی‬‫م‬ ‫میان‬ ‫این‬ ‫از‬
،‫فیزیک‬ ،‫شیمی‬ ‫مثل‬ ‫دانشگاهی‬ ‫‌های‬
‫ه‬‫رشت‬ ‫مخصوص‬ ‫‌هایی‬
‫ع‬‫توزی‬ ‫و‬ ‫بازی‬ ‫مخصوص‬ ‫‌هایی‬
‫ع‬‫توزی‬ ‫تا‬ ‫‌شده‬
‫ی‬‫اسالم‬
‫کرد‬ ‫اشاره‬ ،‫‌اند‬
‫ه‬‫کرد‬ ‫‌آوری‬
‫ع‬‫جم‬ ‫خود‬ ‫در‬ ‫را‬ ‫رشته‬ ‫مخصوص‬ ‫کاربردی‬ ‫‌ی‬
‫ه‬‫برنام‬ ‫‌ها‬
‫ه‬‫د‬ ‫که‬ …‫و‬ ‫برق‬ ،‫ریاضی‬
.
‫فرمان‬ ‫خط‬ ‫توسط‬ ‫جادویی‬ ‫کنترل‬
‫ترمینال‬ ‫از‬ ‫کنند‬ ‫استفاده‬ ‫لینوکس‬ ‫‌عامل‬
‫م‬‫سیست‬ ‫از‬ ‫‌اند‬
‫ه‬‫گرفت‬ ‫تصمیم‬ ‫تازگی‬ ‫به‬ ‫که‬ ‫بسیاری‬
(
‫شبیه‬ ‫محیطی‬
command prompt
‫آن‬ ‫برابر‬ ‫چند‬ ‫قدرتی‬ ‫با‬ ‫ویندوز‬ ‫در‬
)
‫خود‬ ‫برای‬ ‫لینوکس‬ ‫ترمینال‬ ‫بدانید‬ ‫است‬ ‫بهتر‬ ‫اما‬ ،‫گریزانند‬
‫دارد‬ ‫جدا‬ ‫دنیایی‬
.
‫مشتتان‬ ‫در‬ ‫لینوکس‬ ‫حقیقت‬ ‫در‬ ‫و‬ ‫دهید‬ ‫انجام‬ ‫‌خواهید‬
‫ی‬‫م‬ ‫کاری‬ ‫هر‬ ‫ترمینال‬ ‫با‬ ‫‌توانید‬
‫ی‬‫م‬ ‫شما‬
‫است‬
.
‫‌ها‬
‫ت‬‫مد‬ ‫برای‬ ‫‌تواند‬
‫ی‬‫م‬ ‫‌آید‬
‫ی‬‫م‬ ‫دست‬ ‫به‬ ‫اینترنت‬ ‫در‬ ‫جستجو‬ ‫با‬ ‫مواقع‬ ‫اکثر‬ ‫که‬ ‫ترمینال‬ ‫دستورات‬ ‫فهمیدن‬
‫کند‬ ‫سرگرم‬ ‫را‬ ‫شما‬
.
‫از‬ ‫کامال‬ ‫امنیت‬ ‫بردن‬ ‫باال‬ ‫منظور‬ ‫به‬ ‫شبکه‬ ‫برای‬ ‫لینوکس‬ ‫از‬ ‫استفاده‬ ‫که‬ ‫بدانید‬ ‫نیست‬ ‫بد‬
‫‌گیرد‬
‫ی‬‫م‬ ‫صورت‬ ‫فرمان‬ ‫خط‬ ‫و‬ ‫ترمینال‬
.
‫رایگان‬ ‫دانلود‬
‫دانلود‬ ‫توزیع‬ ‫آن‬ ‫اینترنتی‬ ‫پایگاه‬ ‫از‬ ‫رایگان‬ ‫و‬ ‫راحتی‬ ‫به‬ ‫‌توانید‬
‫ی‬‫م‬ ‫را‬ ‫لینوکس‬ ‫‌های‬
‫ع‬‫توزی‬ ‫اکثر‬ ‫از‬ ‫جدیدی‬ ‫‌ی‬
‫ه‬‫نسخ‬ ‫هر‬
‫کنید‬
.
‫‌شود‬
‫ی‬‫م‬ ‫برداشته‬ ‫شما‬ ‫دوش‬ ‫از‬ ‫هم‬ ‫آن‬ ‫خرید‬ ‫زحمت‬ ‫پس‬
.
‫نیز‬ ‫آزاد‬ ‫‌های‬
‫ر‬‫‌افزا‬
‫م‬‫نر‬ ‫اکثر‬ ‫‌ی‬
‫ه‬‫دربار‬ ‫ویژگی‬ ‫این‬
‫‌کند‬
‫ی‬‫م‬ ‫صدق‬
.
‫برای‬ ‫‌باز‬
‫ن‬‫مت‬ ‫‌افزارهای‬
‫م‬‫نر‬ ‫دهنگان‬ ‫توسعه‬ ‫چون‬ ‫که‬ ‫نیست‬ ‫معنی‬ ‫این‬ ‫به‬ ‫بودن‬ ‫رایگان‬ ‫این‬ ‫البته‬
‫‌دهند‬
‫ی‬‫م‬ ‫ارائه‬ ‫را‬ ‫‌تری‬
‫ف‬‫ضعی‬ ‫محصول‬ ‫پس‬ ‫‌کنند‬
‫ی‬‫نم‬ ‫دریافت‬ ‫پولی‬ ‫کدهایشان‬
.
‫متن‬ ‫مدل‬ ‫در‬ ‫کسب‬ ‫شیوه‬ ‫اصوال‬
‫است‬ ‫متفاوت‬ ‫باز‬
.
‫‌آورند‬
‫ی‬‫م‬ ‫دست‬ ‫به‬ ‫زیر‬ ‫‌های‬
‫ه‬‫شیو‬ ‫به‬ ‫را‬ ‫خود‬ ‫‌های‬
‫ه‬‫سرمای‬ ‫معموال‬ ‫‌باز‬
‫ن‬‫مت‬ ‫‌افزارهای‬
‫م‬‫نر‬
.
•
‫پشتیبانی‬ ‫‌های‬
‫س‬‫سروی‬ ‫‌ی‬
‫ه‬‫ارائ‬
(
‫اوبونتو‬ ‫برای‬ ‫کانونیکال‬ ‫مانند‬
)
•
‫الیسنس‬ ‫دو‬ ‫با‬ ‫‌افزار‬
‫م‬‫نر‬ ‫انتشار‬
(
‫مانند‬
sun
‫‌کرد‬
‫ی‬‫م‬ ‫منتشر‬ ‫پولی‬ ‫را‬ ‫آفیس‬ ‫استار‬ ‫و‬ ‫رایگان‬ ‫را‬ ‫آفیس‬ ‫اپن‬ ‫که‬
)
•
‫اجرایی‬ ‫فایل‬ ‫پولی‬ ‫انتشار‬ ‫و‬ ‫برنامه‬ ‫کد‬ ‫رایگان‬ ‫انتشار‬
•
‫قبلی‬ ‫‌های‬
‫ه‬‫نسخ‬ ‫و‬ ‫برنامه‬ ‫اصل‬ ‫بودن‬ ‫‌باز‬
‫ن‬‫مت‬ ‫و‬ ‫برنامه‬ ‫‌ی‬
‫ه‬‫نسخ‬ ‫آخرین‬ ‫فروش‬
•
‫گوناگون‬ ‫‌های‬
‫د‬‫نها‬ ‫برای‬ ‫برنامه‬ ‫سازی‬ ‫شخصی‬ ‫و‬ ‫‌تر‬
‫ی‬‫اضاف‬ ‫امکانات‬ ‫بابت‬ ‫پول‬ ‫دریافت‬
•
‫داوطلبانه‬ ‫‌های‬
‫ک‬‫کم‬ ‫یا‬ ‫کردن‬ ‫دونیت‬ ‫طریق‬ ‫از‬
•
‫‌ها‬
‫ت‬‫شرک‬ ‫سایر‬ ‫با‬ ‫همکاری‬ ‫طریق‬ ‫از‬
(
‫‌های‬
‫ت‬‫شرک‬ ‫جستجوی‬ ‫موتورهای‬ ‫دادن‬ ‫قرار‬ ‫با‬ ‫که‬ ‫موزیال‬ ‫بنیاد‬ ‫مانند‬
‫فایرفاکس‬ ‫در‬ ‫دیگر‬
)
‫سازی‬ ‫بومی‬
‫شود‬ ‫همسان‬ ‫ملت‬ ‫یک‬ ‫فرهنگ‬ ‫با‬ ‫کامال‬ ‫‌تواند‬
‫ی‬‫م‬ ‫لینوکس‬
.
‫مختلف‬ ‫‌های‬
‫ن‬‫زبا‬ ‫برای‬ ‫‌عامل‬
‫م‬‫سیست‬ ‫این‬ ‫اهمیتی‬
‫در‬ ‫فارسی‬ ‫تقویم‬ ‫‌سازی‬
‫ه‬‫پیاد‬ ‫یا‬ ‫و‬ ‫‌فرض‬
‫ش‬‫پی‬ ‫صورت‬ ‫به‬ ‫فارسی‬ ‫استاندارد‬ ‫کیبورد‬ ‫از‬ ‫بشتیبانی‬ ‫مانند‬ ‫است‬ ‫قائل‬
KDE
‫مانند‬ ‫مهم‬ ‫‌افزارهای‬
‫م‬‫نر‬ ‫از‬ ‫بسیاری‬ ‫شدن‬ ‫ترجمه‬ ‫یا‬
libreoffice , gimp
‫و‬
..
‫مناسب‬ ‫بستر‬ ‫یک‬ ‫به‬ ‫را‬ ‫لینوکس‬
‫کشورها‬ ‫سایر‬ ‫برخالف‬ ‫ایران‬ ‫در‬ ‫متاسفانه‬ ‫که‬ ‫‌است‬
‫ه‬‫کرد‬ ‫تبدیل‬ ‫ملی‬ ‫عامل‬ ‫سیستم‬ ‫یک‬ ‫داشتن‬ ‫برای‬
(
‫حتی‬
‫آفریقایی‬ ‫کشورهای‬
)
‫‌است‬
‫ه‬‫شد‬ ‫داده‬ ‫اهمیت‬ ‫کمتر‬ ‫موضوع‬ ‫این‬ ‫به‬
.
‫لینوکس‬ ‫و‬ ‫گنو‬ ‫تاریخچه‬
‫گنو‬ .‫‌باشد‬
‫ی‬‫م‬ ‫سازگار‬ ‫یونیکس‬ ‫با‬ ‫‌ای‬
‫ه‬‫فزایند‬ ‫طــور‬ ‫به‬ ‫کــه‬ ‫بــوده‬ ‫آزاد‬ ‫کامال‬ ‫عامل‬ ‫سیــستم‬ ‫یک‬ ‫گنو‬ ‫عامل‬ ‫سیستم‬
“ ‫مخفف‬
GNU’s Not Unix
‫سپتامبر‬ ‫در‬ ‫را‬ ‫گنو‬ ‫پروژه‬ ‫اولیه‬ ‫اطالعیه‬ ‫استالمن‬ ‫ریچارد‬ .‫است‬ ”
۱۹۸۳
.‫کرد‬ ‫منتشر‬
‫سپتامبر‬ ‫در‬ ‫گنو‬ ‫اعالمیه‬ ‫نام‬ ‫به‬ ‫آن‬ ‫‌تر‬
‫ل‬‫کام‬ ‫نسخه‬
۱۹۸۵
.‫است‬ ‫شده‬ ‫ترجمه‬ ‫زبان‬ ‫چندین‬ ‫به‬ ‫که‬ ‫شد‬ ‫منتشر‬
‫مخفف‬ ‫یک‬ ،‫نخست‬ ‫‌کند؛‬
‫ی‬‫م‬ ‫بــرطــرف‬ ‫را‬ ‫نیــازها‬ ‫از‬ ‫تعدادی‬ ‫که‬ ‫است‬ ‫شده‬ ‫انتخاب‬ ‫علت‬ ‫این‬ ‫به‬ »‫«گنو‬ ‫نام‬
“ ‫برای‬ ‫بازگشتی‬
GNU’s Not Unix
‫جالب‬ ‫آن‬ )‫خواندن‬ ‫(یا‬ ‫گفتن‬ ‫آهنگ‬ ،‫سوم‬ ،‫است‬ ‫واقعی‬ ‫کلمه‬ ‫یک‬ ،‫دوم‬ ،‫است‬ ”
.‫است‬
‫ممکن‬ ‫آزاد‬ ‫‌افزار‬
‫م‬‫نر‬ ‫آوردن‬ ‫دست‬ ‫به‬ ‫برای‬ ‫شما‬ .‫قیمت‬ ‫نه‬ ،‫‌کند‬
‫ی‬‫م‬ ‫اشاره‬ ‫آزادی‬ ‫به‬ »‫آزاد‬ ‫‌افزار‬
‫م‬‫«نر‬ ‫در‬ »‫«آزاد‬ ‫کلمه‬
‫ویــژه‬ ‫آزادی‬ ‫ســه‬ ،‫باشید‬ ‫داشتــه‬ ‫اختیار‬ ‫در‬ ‫را‬ ‫‌افزار‬
‫م‬‫نر‬ ‫وقتـی‬ ،‫صورت‬ ‫هر‬ ‫در‬ .‫نپردازید‬ ‫یا‬ ‫بپردازید‬ ‫مبلغی‬ ‫است‬
‫و‬ ‫دوستان‬ ‫به‬ ‫آن‬ ‫دادن‬ ‫هدیه‬ ‫و‬ ‫برنامه‬ ‫از‬ ‫برداری‬ ‫نسخه‬ ‫برای‬ ‫آزادی‬ ،‫نخست‬ .‫داشت‬ ‫خواهید‬ ‫آن‬ ‫از‬ ‫استفاده‬ ‫برای‬
‫کدهای‬ ‫به‬ ‫کامل‬ ‫دسترسی‬ ‫داشتن‬ ‫با‬ ،‫دلخواه‬ ‫طور‬ ‫به‬ ‫برنامه‬ ‫در‬ ‫تغییرات‬ ‫اعمال‬ ‫بــرای‬ ‫آزادی‬ ،‫دوم‬ ‫همــکاران؛‬
‫را‬ ‫گنو‬ ‫‌افزار‬
‫م‬‫نر‬ ‫مجددا‬ ‫(اگر‬ .‫جامعه‬ ‫ساخت‬ ‫به‬ ‫کمک‬ ‫نهایت‬ ‫در‬ ‫و‬ ‫یافته‬ ‫بهبود‬ ‫نسخه‬ ‫توزیع‬ ‫برای‬ ‫آزادی‬ ،‫سوم‬ ‫منبع؛‬
‫رایگان‬ ‫طور‬ ‫به‬ ‫را‬ ‫آنها‬ ‫یا‬ ‫و‬ ‫کنید‬ ‫دریافت‬ ‫را‬ ‫مبلغی‬ ‫نسخه‬ ‫یک‬ ‫انتقال‬ ‫فیزیکی‬ ‫کار‬ ‫بــرای‬ ‫‌تــوانـید‬
‫ی‬‫م‬ ،‫نمایید‬ ‫توزیع‬
.)‫کنید‬ ‫هدیه‬
‫ســال‬ ‫در‬ .‫‌شود‬
‫ی‬‫م‬ ‫نامیده‬ «‫گنو‬ ‫»پروژه‬ ،‫گنو‬ ‫سیستم‬ ‫توسعه‬ ‫پروژه‬
۱۹۸۳
‫برای‬ ‫راهی‬ ‫عنوان‬ ‫به‬ ‫گنــو‬ ‫پــروژه‬
‫با‬ ‫تا‬ ‫شد‬ ‫ایجاد‬ ‫داشـت‬ ‫وجــود‬ ‫کامپیــوتر‬ ‫کاربران‬ ‫جامعه‬ ‫بین‬ ‫در‬ ‫نخست‬ ‫روزهای‬ ‫در‬ ‫که‬ ‫همکاری‬ ‫روح‬ ‫بازگرداندن‬
‫ممکن‬ ‫را‬ ‫همکاری‬ ‫دیگر‬ ‫بار‬ ‫یک‬ ،‫بودند‬ ‫شده‬ ‫تحمیل‬ ‫انحصاری‬ ‫‌افزارهای‬
‫م‬‫نر‬ ‫صاحبان‬ ‫توسط‬ ‫که‬ ‫موانع‬ ‫بردن‬ ‫بین‬ ‫از‬
.‫سازد‬
‫سال‬ ‫در‬
۱۹۷۱
‫دانشگاه‬ ‫در‬ ‫را‬ ‫خود‬ ‫کار‬ ‫استالمن‬ ‫ریچارد‬ ‫که‬ ‫هنگامی‬
MIT
‫از‬ ‫منحصرا‬ ‫کــه‬ ‫گــروهی‬ ‫در‬ ،‫کرد‬ ‫آغاز‬
‫توزیع‬ ‫آزاد‬ ‫‌افزار‬
‫م‬‫نر‬ ‫اغلب‬ ‫نیز‬ ‫کامپیوتری‬ ‫‌های‬
‫ت‬‫شرک‬ ‫حتی‬ .‫پرداخت‬ ‫کار‬ ‫به‬ ‫‌کردند‬
‫ی‬‫م‬ ‫استفاده‬ ‫آزاد‬ ‫‌افزار‬
‫م‬‫نر‬
.‫‌دادند‬
‫ی‬‫م‬ ‫انجام‬ ‫را‬ ‫کار‬ ‫همین‬ ‫نیز‬ ‫اغلب‬ ‫و‬ ‫بودند‬ ‫آزاد‬ ‫یکدیگر‬ ‫با‬ ‫همکاری‬ ‫در‬ ‫‌نویسان‬
‫ه‬‫بــرنام‬ .‫‌کــردند‬
‫ی‬‫م‬
‫دهه‬ ‫در‬
۱۹۸۰
‫همکاری‬ ‫آنها‬ ‫مالکان‬ ‫و‬ ‫داشتند‬ ‫مالک‬ ‫که‬ ‫معنی‬ ‫این‬ ‫بــه‬ ،‫بودند‬ ‫انحصاری‬ ‫‌افزارها‬
‫م‬‫نر‬ ‫تمام‬ ‫تقریبا‬
.‫‌کرد‬
‫ی‬‫م‬ ‫ایجاب‬ ‫را‬ ‫گنو‬ ‫پروژه‬ ‫ضرورت‬ ‫کار‬ ‫این‬ ‫که‬ ‫‌کردند‬
‫ی‬‫م‬ ‫منع‬ ‫را‬ ‫کاربزان‬ ‫توسط‬
،‫بــاشـد‬ ‫نـداشـته‬ ‫وجــود‬ ‫آزادی‬ ‫عامل‬ ‫سـیـستم‬ ‫اگــر‬ ‫دارند؛‬ ‫نیــاز‬ ‫عامل‬ ‫سیستم‬ ‫یــک‬ ‫به‬ ‫کامپیوتر‬ ‫کاربران‬ ‫تمام‬
‫اولیــن‬ ‫بنــابــراین‬ .‫کنید‬ ‫شروع‬ ‫را‬ ‫کامپیوتر‬ ‫با‬ ‫کار‬ ‫انحصاری‬ ‫‌افزارهای‬
‫م‬‫نر‬ ‫از‬ ‫استفاده‬ ‫بدون‬ ‫‌توانید‬
‫ی‬‫نم‬ ‫حتی‬ ‫شـما‬
.‫است‬ ‫آزاد‬ ‫عامل‬ ‫سیستم‬ ‫یک‬ ‫وجود‬ ،‫آزاد‬ ‫‌افزار‬
‫م‬‫نر‬ ‫در‬ ‫ضرورت‬
‫قبال‬ ‫آن‬ ‫کلی‬ ‫طــراحی‬ ‫زیرا‬ ‫بساند‬ ‫یونیکس‬ ‫با‬ ‫منطبق‬ ‫عاملی‬ ‫سیستم‬ ‫تا‬ ‫گرفتند‬ ‫تصمیم‬ ‫آزاد‬ ‫افزاری‬ ‫نرم‬ ‫جنبش‬
.‫‌کرد‬
‫ی‬‫م‬ ‫آسان‬ ‫را‬ ‫گنو‬ ‫به‬ ‫یونیکس‬ ‫کاربران‬ ‫حرکت‬ ‫سازگاری‬ ‫این‬ ‫همچنین‬ ‫و‬ ،‫بود‬ ‫انتقال‬ ‫قابل‬ ‫و‬ ‫خورده‬ ‫محک‬
،‫ویــرایشــگـرها‬ ،‫کامپــایـلرها‬ ‫شــامــل‬ ‫و‬ ‫اســت؛‬ ‫هسته‬ ‫یک‬ ‫از‬ ‫بیشتر‬ ‫خیلی‬ ‫یونیکس‬ ‫شبه‬ ‫عامل‬ ‫سیستم‬ ‫یک‬
‫سیستم‬ ‫یک‬ ‫نوشتن‬ ‫بنابرایـن‬ .‫‌باشد‬
‫ی‬‫م‬ ‫دیگر‬ ‫چیزهای‬ ‫خیلی‬ ‫و‬ ‫پستی‬ ‫‌افزارهای‬
‫م‬‫نر‬ ،‫متن‬ ‫‌بندی‬
‫ب‬‫قال‬ ‫‌های‬
‫ه‬‫برنام‬
‫ژانویه‬ ‫در‬ .‫است‬ ‫بزرگی‬ ‫بسیار‬ ‫کار‬ ‫کامل‬ ‫عامل‬
۱۹۸۴
‫آزاد‬ ‫‌افزار‬
‫م‬‫نر‬ ‫بنیاد‬ .‫انجامید‬ ‫طول‬ ‫به‬ ‫سالها‬ ‫کردند‬ ‫کار‬ ‫به‬ ‫شروع‬
‫اکتبر‬ ‫در‬
۱۹۸۵
.‫شد‬ ‫تاسیس‬ ‫گنو‬ ‫توسعه‬ ‫به‬ ‫کمک‬ ‫جهت‬ ‫سرمایه‬ ‫جذب‬ ‫برای‬ ‫بیشتر‬
‫سال‬ ‫تا‬
۱۹۹۰
‫هسته‬ ‫یک‬ ،‫لینوکس‬ ‫سپس‬ . ‫یافتند‬ ‫دست‬ ‫هسته‬ ‫جــز‬ ‫بــه‬ ،‫عامل‬ ‫سیستم‬ ‫اصلی‬ ‫اجزای‬ ‫تمامی‬ ‫به‬
‫سال‬ ‫در‬ ،‫یونیکس‬ ‫شبه‬
۱۹۹۱
‫ســال‬ ‫در‬ ‫و‬ ‫کرد‬ ‫پیدا‬ ‫توسعه‬ ‫تروالدز‬ ‫لینوس‬ ‫توسط‬
۱۹۹۲
.‫شد‬ ‫آزاد‬ ‫‌افـزار‬
‫م‬‫نــر‬ ‫یــک‬
.‫لینوکس‬/‫گنـو‬ ‫سیستم‬ :‫شد‬ ‫کــامل‬ ‫عامــل‬ ‫سیستم‬ ‫یک‬ ‫به‬ ‫منجر‬ ‫گنو‬ ‫کامل‬ ‫تقریبا‬ ‫سیستم‬ ‫با‬ ‫لینوکس‬ ‫ترکیب‬
،‫دبیــان‬ ،‫اسلکور‬ ‫شــامــل‬ ،‫لینوکس‬/‫گنو‬ ‫‌های‬
‫م‬‫سیست‬ ‫از‬ ‫نفر‬ ‫میلیون‬ ‫‌ها‬
‫ه‬‫د‬ ‫‌اکنون‬
‫م‬‫ه‬ ‫که‬ ‫‌شود‬
‫ی‬‫م‬ ‫زده‬ ‫تخمــین‬
.‫‌کنند‬
‫ی‬‫م‬ ‫استفاده‬ ‫غـیـره‬ ‫و‬ ‫ردهــت‬
‫یک‬ ‫تا‬ ‫دارد‬ ‫نظر‬ ‫در‬ ‫آزاد‬ ‫‌افزار‬
‫م‬‫نر‬ ‫بنیاد‬ .‫است‬ ‫نشده‬ ‫محدود‬ ‫عامل‬ ‫سیستم‬ ‫یک‬ ‫به‬ ‫فقط‬ ‫گنو‬ ‫پروژه‬ ،‫حال‬ ‫این‬ ‫با‬
‫ایــن‬ .‫باشند‬ ‫داشته‬ ‫‌خواهند‬
‫ی‬‫م‬ ‫کاربــران‬ ‫از‬ ‫بسیاری‬ ‫که‬ ‫آنچه‬ ‫هر‬ ، ‫کند‬ ‫ایجاد‬ ‫را‬ ‫‌افزارها‬
‫م‬‫نر‬ ‫از‬ ‫کامل‬ ‫مجموعه‬
.‫‌شود‬
‫ی‬‫م‬ ‫نیز‬ ‫کاربردی‬ ‫‌افزارهای‬
‫م‬‫نـر‬ ‫شــامــل‬ ‫مــوضــوع‬
‫به‬ ‫کنند‬ ‫تهیه‬ ‫‌افزار‬
‫م‬‫نر‬ ‫نیز‬ ‫ندارند‬ ‫مهارت‬ ‫کامپیـوتر‬ ‫زمینه‬ ‫در‬ ‫که‬ ‫کاربرانی‬ ‫برای‬ ‫دارد‬ ‫قصد‬ ‫همچنین‬ ‫آزاد‬ ‫‌افزار‬
‫م‬‫نر‬ ‫بنیاد‬
‫سیستم‬ ‫از‬ ‫استفاده‬ ‫در‬ ‫‌کار‬
‫ه‬‫تاز‬ ‫کاربران‬ ‫به‬ ‫کمک‬ ‫منظور‬ ‫به‬ ‫گرافیکی‬ ‫کار‬ ‫میز‬ ‫یک‬ ‫آزاد‬ ‫‌افزار‬
‫م‬‫نر‬ ‫بنیاد‬ ‫جهت‬ ‫همین‬
.‫کرد‬ ‫ایجاد‬ ،‫گنو‬
‫آزاد‬ ‫بازی‬ ‫تعدادی‬ .‫کند‬ ‫ایجاد‬ ‫نیز‬ ‫دیگــری‬ ‫تفریح‬ ‫ابزارهای‬ ‫و‬ ‫‌ها‬
‫ی‬‫باز‬ ‫‌خــواهد‬
‫ی‬‫م‬ ‫همچنین‬ ‫آزاد‬ ‫‌افزار‬
‫م‬‫نر‬ ‫بنیاد‬
‫جز‬ ‫بـه‬ ،‫نـدارد‬ ‫وجــود‬ ‫محدودیتی‬ ‫هیچ‬ ‫برود؟‬ ‫پیش‬ ‫‌تواند‬
‫ی‬‫م‬ ‫کجا‬ ‫تا‬ ‫آزاد‬ ‫‌افزار‬
‫م‬‫نر‬ .‫است‬ ‫دسترس‬ ‫در‬ ‫‌اکنون‬
‫م‬‫ه‬
‫کردن‬ ‫فراهم‬ ‫نــهـایی‬ ‫هــدف‬ .‫کننــد‬ ‫منع‬ ‫کامل‬ ‫طور‬ ‫به‬ ‫را‬ ‫گنو‬ ‫‌افزار‬
‫م‬‫نر‬ ،‫انحصاری‬ ‫سیستم‬ ‫مانند‬ ‫قوانینی‬ ‫که‬ ‫زمانی‬
‫کردن‬ ‫مطرود‬ ‫نتیجه‬ ‫در‬ ‫و‬ ‫دهند‬ ‫انجام‬ ‫‌خواهند‬
‫ی‬‫م‬ ‫کامپیوتر‬ ‫کاربران‬ ‫که‬ ‫کارهایی‬ ‫تمام‬ ‫انجام‬ ‫برای‬ ‫آزاد‬ ‫‌افزارهای‬
‫م‬‫نر‬
.‫‌باشد‬
‫ی‬‫م‬ ‫انحصاری‬ ‫‌افزارهای‬
‫م‬‫نر‬
‫باز‬ ‫متن‬ ‫افزار‬ ‫نرم‬
Open Source
Software
‫مقدمه‬
‫اکوسیستم‬ ‫در‬ ‫‌گذاران‬
‫ه‬‫سرمای‬ ‫اقتصادی‬ ‫رفتار‬ ‫بر‬ ‫که‬ ‫‌ای‬
‫ه‬‫مالحظ‬ ‫قابل‬ ‫تأثیر‬ ‫با‬ ‫‌باز‬
‫ن‬‫مت‬ ‫افزار‬ ‫نرم‬
‫سعی‬ ‫‌دهنگان‬
‫ه‬‫توسع‬ ‫تازه‬ ‫محیط‬ ‫این‬ ‫در‬ .‫است‬ ‫داده‬ ‫تغییر‬ ‫را‬ ‫بازی‬ ‫قواعد‬ ‫گذاشته‬ ‫‌افزار‬
‫م‬‫نر‬
‫و‬ ‫‌کنند‬
‫ی‬‫م‬ ‫حس‬ ‫را‬ ‫‌باز‬
‫ن‬‫مت‬ ‫محصوالت‬ ‫تولید‬ ‫فشار‬ ‫شرکتها‬ ،‫باشند‬ ‫کد‬ ‫کننده‬ ‫اعمال‬ ‫‌کنند‬
‫ی‬‫م‬
.‫‌کشند‬
‫ی‬‫م‬ ‫را‬ ‫سرشاری‬ ‫سود‬ ‫انتظار‬ ‫سیستم‬ ‫فروشندگان‬
۱
‫معرفی‬ .
‫اتفاق‬ ‫این‬ .‫است‬ ‫آورده‬ ‫بار‬ ‫به‬ ‫کاربران‬ ‫برای‬ ‫ارزانتر‬ ‫‌افزار‬
‫م‬‫نر‬ ‫از‬ ‫بیش‬ ‫چیزی‬ ‫‌باز‬
‫ن‬‫مت‬ ‫‌افزار‬
‫م‬‫نر‬ ‫ظهور‬
.‫است‬ ‫کرده‬ ‫ایجاد‬ ‫‌افزار‬
‫م‬‫نر‬ ‫حوزه‬ ‫بازیگران‬ ‫بین‬ ‫اقتصادی‬ ‫انفعال‬ ‫و‬ ‫فعل‬ ‫در‬ ‫عمده‬ ‫تغییراتی‬
‫زندگی‬ ‫از‬ ‫سبکی‬ ‫حتی‬ ‫یا‬ - ‫‌افزار‬
‫م‬‫نر‬ ‫توسعه‬ ‫به‬ ‫ویژه‬ ‫نگاهی‬ ‫تجسم‬ ‫‌باز‬
‫ن‬‫مت‬ ‫‌افزار‬
‫م‬‫نر‬ ‫‌ها‬
‫ی‬‫خیل‬ ‫برای‬
‫این‬ ‫گابریل‬ ‫ریچارد‬ ‫و‬ ‫گلدمن‬ ‫ران‬ ‫پیشنهاد‬ .‫هست‬ ‫هم‬ ‫تجاری‬ ‫تدبیر‬ ‫نوعی‬ ‫معنای‬ ‫به‬ ‫اما‬ ‫است‬ -
‫محیطی‬ ‫و‬ ‫کنند‬ ‫استفاده‬ ‫‌باز‬
‫ن‬‫مت‬ ‫‌افزار‬
‫م‬‫نر‬ ‫از‬ ‫کاربرانشان‬ ‫جامعه‬ ‫رشد‬ ‫برای‬ ‫باید‬ ‫شرکتها‬ ‫که‬ ‫است‬
.‫نمایند‬ ‫ایجاد‬ ‫خدماتشان‬ ‫و‬ ‫محصوالت‬ ‫اطراف‬ ‫زنده‬
‫احتیاجات‬ ‫با‬ ‫آن‬ ‫دادن‬ ‫تطبیق‬ ‫برای‬ ‫که‬ ‫را‬ ‫کد‬ ‫متن‬ ‫و‬ ‫است‬ ‫رایگان‬ ‫‌باز‬
‫ن‬‫مت‬ ‫‌افزار‬
‫م‬‫نر‬ ‫معمول‬ ‫بطور‬
‫‌افزار‬
‫م‬‫نر‬ ‫بازپخش‬ ‫اجازه‬ ‫کاربر‬ ‫به‬ ‫‌باز‬
‫ن‬‫مت‬ ‫‌های‬
‫ه‬‫پروان‬ ‫اغلب‬ .‫دارد‬ ‫همراه‬ ‫به‬ ‫است‬ ‫نیاز‬ ‫مورد‬ ‫کاربر‬
‫تغییرات‬ ‫که‬ ‫زمانی‬ ‫تا‬ ‫‌دهند‬
‫ی‬‫م‬ ‫بازپخش‬ ‫برای‬ ‫مبلغی‬ ‫دریافت‬ ‫ازای‬ ‫در‬ ‫را‬ ‫ممکن‬ ‫تغییرات‬ ‫بعالوه‬
( ‫باشد‬ ‫دسترس‬ ‫در‬ ‫عمومی‬ ‫بصورت‬ ‫کد‬ ‫متن‬
www.opensource.org
.)
.‫‌دهد‬
‫ی‬‫م‬ ‫توسعه‬ ‫جامعه‬ ‫که‬ ‫است‬ ‫‌افزاری‬
‫م‬‫نر‬ ‫جمعی‬ ‫‌باز‬
‫ن‬‫مت‬ .‫دارد‬ ‫وجود‬ ‫‌باز‬
‫ن‬‫مت‬ ‫‌افزار‬
‫م‬‫نر‬ ‫نوع‬ ‫دو‬
‫داوطلبان‬ ‫از‬ ‫برگزیده‬ ‫گروهی‬ ‫گاهی‬ ‫باشد‬ ‫‌افزار‬
‫م‬‫نر‬ ‫مالک‬ ‫حقوقی‬ ‫شخصیت‬ ‫یک‬ ‫اینکه‬ ‫بجای‬
‫پذیرفته‬ ‫اصلی‬ ‫کد‬ ‫متن‬ ‫به‬ ‫ورود‬ ‫برای‬ ‫شده‬ ‫اعمال‬ ‫همکاریهای‬ ‫از‬ ‫یک‬ ‫کدام‬ ‫که‬ ‫‌گیرند‬
‫ی‬‫م‬ ‫تصمیم‬
‫یک‬ ‫نه‬ ‫و‬ ‫کد‬ ‫کنندگان‬ ‫اعمال‬ ،‫شخصی‬ ‫‌دهندگان‬
‫ه‬‫توسع‬ .‫برود‬ ‫سو‬ ‫کدام‬ ‫به‬ ‫‌افزار‬
‫م‬‫نر‬ ‫و‬ ‫شوند‬
( ‫آپاچی‬ ‫وب‬ ‫سرور‬ ‫مورد‬ ‫مانند‬ ‫‌گیرند‬
‫ی‬‫م‬ ‫تصمیم‬ ‫‌افزار‬
‫م‬‫نر‬ ‫درباره‬ ‫بخصوص‬ ‫شرکت‬
httpd.apache.org
.)
.‫است‬ ‫آن‬ ‫‌دهنده‬
‫ه‬‫توسع‬ ‫و‬ ‫مالک‬ ،‫سود‬ ‫پی‬ ‫در‬ ‫شخصیتی‬ ‫که‬ ‫است‬ ‫‌افزاری‬
‫م‬‫نر‬ ‫تجاری‬ ‫‌باز‬
‫ن‬‫مت‬
‫اصلی‬ ‫کد‬ ‫متن‬ ‫به‬ ‫ورود‬ ‫برای‬ ‫را‬ ‫کد‬ ‫کدام‬ ‫که‬ ‫‌کند‬
‫ی‬‫م‬ ‫تعیین‬ ‫و‬ ‫دارد‬ ‫اختیار‬ ‫در‬ ‫را‬ ‫تالیف‬ ‫حق‬ ‫شرکت‬
‫مورد‬ ‫مانند‬ ‫دهد‬ ‫انجام‬ ‫کاری‬ ‫چه‬ ‫آینده‬ ‫در‬ ‫و‬ ‫بپذیرد‬
MySQL
‫داده‬ ‫پایگاه‬ ‫و‬
MySQL
(www.mysql.com)
.
‫بر‬ ‫اغلب‬ ‫جامعه‬ ‫بوسیله‬ ‫شده‬ ‫داده‬ ‫توسعه‬ ‫‌باز‬
‫ن‬‫مت‬ ‫‌افزار‬
‫م‬‫نر‬ ‫اقتصاد‬ ‫درباره‬ ‫پیشین‬ ‫مطالعات‬
‫‌افزار‬
‫م‬‫نر‬ ‫به‬ ‫‌آوری‬
‫ب‬‫تعج‬ ‫فراوان‬ ‫داوطلبانه‬ ‫کار‬ ‫میزان‬ ‫آن‬ ‫در‬ ‫که‬ ‫است‬ ‫متمرکز‬ ‫کار‬ ‫نیروی‬ ‫اقتصاد‬
‫شخصی‬ ‫لذت‬ ‫بخاطر‬ ‫‌دهندگان‬
‫ه‬‫توسع‬ ‫که‬ ‫‌کند‬
‫ی‬‫م‬ ‫اشاره‬ ‫ریموند‬ ‫اریک‬ .‫‌یابد‬
‫ی‬‫م‬ ‫تخصیص‬ ‫‌باز‬
‫ن‬‫مت‬
‫و‬ ‫هارووی‬ ‫ارنان‬ ‫‌کنند‬
‫ی‬‫م‬ ‫کمک‬ ‫‌باز‬
‫ن‬‫مت‬ ‫‌های‬
‫ه‬‫پروژ‬ ‫به‬ ‫همتایانشان‬ ‫بین‬ ‫اعتبار‬ ‫افزایش‬ ‫از‬ ‫ناشی‬
. ‫رسیدند‬ ‫مشابهی‬ ‫نتیجه‬ ‫به‬ ‫نیز‬ ‫خود‬ ‫تجربی‬ ‫مطالعه‬ ‫در‬ ‫همکارانش‬
‫تواناییهای‬ ‫کردن‬ ‫مستند‬ ‫برای‬ ‫‌دهندگان‬
‫ه‬‫توسع‬ ‫که‬ ‫‌کنند‬
‫ی‬‫م‬ ‫استدالل‬ ‫تیروله‬ ‫جین‬ ،‫لرنرو‬ ‫جاشوا‬
‫کریم‬ ‫و‬ ‫‌کنند‬
‫ی‬‫م‬ ‫کمک‬ ‫‌باز‬
‫ن‬‫مت‬ ‫‌های‬
‫ه‬‫پروژ‬ ‫به‬ ‫آتی‬ ‫کارفرمایان‬ ‫برای‬ ‫شغلی‬ ‫‌انداز‬
‫م‬‫چش‬ ‫بهبود‬ ‫و‬ ‫فنی‬
‫کمک‬ ‫برای‬ ‫مهمی‬ ‫ذاتی‬ ‫محرک‬ ‫کار‬ ‫از‬ ‫بردن‬ ‫لذت‬ ‫که‬ ‫‌کنند‬
‫ی‬‫م‬ ‫گزارش‬ ‫گلف‬ ‫رابرت‬ ‫الخانیو‬
‫‌های‬
‫ه‬‫انگیز‬ ‫که‬ ‫‌دهد‬
‫ی‬‫م‬ ‫نشان‬ ‫مطالعه‬ ‫این‬ ‫گرچه‬ ‫است‬ ‫‌باز‬
‫ن‬‫مت‬ ‫‌های‬
‫ه‬‫پروژ‬ ‫به‬ ‫‌دهندگان‬
‫ه‬‫توسع‬
.‫‌اند‬
‫م‬‫مه‬ ‫هم‬ ‫مالی‬
‫چرا‬ ‫که‬ ‫‌دهد‬
‫ی‬‫نم‬ ‫شرح‬ ‫را‬ ‫این‬ ‫اما‬ ‫است‬ ‫داوطلبانه‬ ‫کار‬ ‫برای‬ ‫توضیحات‬ ‫از‬ ‫‌ای‬
‫ه‬‫پار‬ ‫اینها‬ ‫که‬ ‫حالی‬ ‫در‬
‫‌باز‬
‫ن‬‫مت‬ ‫‌افزار‬
‫م‬‫نر‬ ‫‌های‬
‫ه‬‫پروژ‬ ‫به‬ ‫شرکت‬ ‫کاری‬ ‫زمان‬ ‫در‬ ‫که‬ ‫‌کنند‬
‫ی‬‫م‬ ‫استخدام‬ ‫را‬ ‫اشخاصی‬ ‫شرکتها‬
‫نرم‬ ‫بنیاد‬ ‫پروژه‬ ‫به‬ ‫که‬ ‫کسانی‬ ‫حقوق‬ ‫که‬ ‫دریافتند‬ ‫همکارانش‬ ‫و‬ ‫هان‬ ‫هورن‬ ‫ایل‬ .‫‌کنند‬
‫ی‬‫م‬ ‫کمک‬
‫محققین‬ ‫پس‬ .‫دارد‬ ‫آپاچی‬ ‫تشکیالت‬ ‫در‬ ‫آنها‬ ‫رتبه‬ ‫با‬ ‫مستقیمی‬ ‫رابطه‬ ‫‌کنند‬
‫ی‬‫م‬ ‫کمک‬ ‫آپاچی‬ ‫افزار‬
‫سنجش‬ ‫برای‬ ‫معیاری‬ ‫عنوان‬ ‫به‬ ‫را‬ ‫بنیاد‬ ‫در‬ ‫‌دهندگان‬
‫ه‬‫توسع‬ ‫رتبه‬ ‫کارفرمایان‬ ‫که‬ ‫گرفتند‬ ‫نتیجه‬
.‫‌گیرند‬
‫ی‬‫م‬ ‫بکار‬ ‫مولد‬ ‫‌های‬
‫ی‬‫توانای‬
‫‌ها‬
‫ه‬‫داد‬ ‫پایگاه‬
،)»‫«پایگاه‬ ،‫خالصه‬ ‫‌طور‬
‫ه‬‫(ب‬
‫اطالعاتی‬ ‫بانک‬
،
‫ِگان‬‫د‬‫دا‬
‫یا‬
‫یس‬ِ‫ب‬‫یتا‬ِ‫د‬
:‫انگلیسی‬ ‫(به‬
Database
‫به‬ )
.‫‌شود‬
‫ی‬‫م‬ ‫گفته‬ ‫‌مند‬
‫ن‬‫ساما‬ ‫و‬ ‫منظم‬ ‫ساختار‬ ‫با‬ ‫‌ها‬
‫ه‬‫داد‬ ‫از‬ ‫‌ای‬
‫ه‬‫مجموع‬
‫اجمالی‬ ‫بررسی‬ ‫و‬ ‫اصطالحات‬
‫به‬ ‫دسترسی‬ ‫که‬ ‫است‬ ‫سازمان‬ ‫یا‬ ‫ساختار‬ ‫و‬ ‫مرتبط‬ ‫‌های‬
‫ه‬‫داد‬ ‫از‬ ‫‌ای‬
‫ه‬‫مجموع‬ ‫به‬ ‫اشاره‬ »‫داده‬ ‫«پایگاه‬ ،‫دیگر‬ ‫بعبارت‬
( »‫داده‬ ‫پایگاه‬ ‫مدیریت‬ ‫«سیستم‬ ‫طریق‬ ‫از‬ ً‫ال‬‫معمو‬ ‫اطالعات‬ ‫این‬
DBMS
‫از‬ ‫یکپارچه‬ ‫مجموعه‬ ‫یک‬ ‫از‬ ‫متشکل‬ )
‫و‬ ‫‌ها‬
‫ه‬‫داد‬ ‫پایگاه‬ ‫چند‬ ‫یا‬ ‫یک‬ ‫با‬ ‫کردن‬ ‫برقرار‬ ‫ارتباط‬ ‫برای‬ ‫کاربران‬ ‫تا‬ ‫‌دهد‬
‫ی‬‫م‬ ‫اجازه‬ ‫که‬ ‫است‬ ‫کامپیوتری‬ ‫‌افزارهای‬
‫م‬‫نر‬
‫به‬ ‫محدود‬ ‫دسترسی‬ ‫که‬ ‫است‬ ‫ممکن‬ ‫محدودیت‬ ‫چه‬ ‫(اگر‬ ‫داده‬ ‫پایگاه‬ ‫در‬ ‫موجود‬ ‫اطالعات‬ ‫تمام‬ ‫به‬ ‫دسترسی‬
‫داده‬ ‫پایگاه‬ ،‫‌ای‬
‫ه‬‫حرف‬ ‫اطالعات‬ ‫فناوری‬ ‫دنیای‬ ‫از‬ ‫خارج‬ . .‫‌کند‬
‫ی‬‫م‬ ‫فراهم‬ ‫را‬ )‫باشد‬ ‫داشته‬ ‫وجود‬ ‫خاص‬ ‫اطالعات‬
‫شاخص‬ ‫یک‬ ‫یا‬ ‫گسترده‬ ‫صفحه‬ ‫یک‬ ‫(مانند‬ ‫مرتبط‬ ‫‌های‬
‫ه‬‫داد‬ ‫از‬ ‫‌ای‬
‫ه‬‫مجموع‬ ‫هر‬ ‫به‬ ‫اشاره‬ ‫برای‬ ‫اغلب‬ ‫که‬ ‫است‬ ‫مدتی‬
‫داده‬ ‫پایگاه‬ ‫یک‬ ‫مدیریت‬ ‫که‬ ‫‌دهد‬
‫ی‬‫م‬ ‫اجازه‬ ‫مختلف‬ ‫توابع‬ ‫به‬ ‫موجود‬ ‫اس‬ .‫اس‬.‫ام‬.‫بی‬.‫دی‬ .‫‌شود‬
‫ی‬‫م‬ ‫استفاده‬ )‫کارت‬
:‫کرد‬ ‫‌بندی‬
‫ه‬‫طبق‬ ‫اصلی‬ ‫گروه‬ ‫چهار‬ ‫به‬ ‫را‬ ‫آن‬ ‫‌توان‬
‫ی‬‫م‬ ‫که‬ ‫دهد‬ ‫انجام‬ ‫را‬ ‫خود‬ ‫‌های‬
‫ه‬‫داد‬ ‫و‬
1
.
.‫‌کنیم‬
‫ی‬‫م‬ ‫تعریف‬ ‫آن‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫را‬ ‫داده‬ ‫سازمان‬ ‫که‬ ‫تعاریف‬ ‫از‬ ‫حذف‬ ‫و‬ ‫اصالح‬ ،‫ایجاد‬ - ‫‌ها‬
‫ه‬‫داد‬ ‫تعریف‬
2
.
.‫واقعی‬ ‫‌های‬
‫ه‬‫داد‬ ‫حذف‬ ‫و‬ ‫اصالح‬ ،‫درج‬ - ‫روزرسانی‬ ‫به‬
3
.
‫‌های‬
‫ه‬‫برنام‬ ‫توسط‬ ‫بیشتر‬ ‫پردازش‬ ‫برای‬ ‫یا‬ ‫استفاده‬ ‫قابل‬ ‫مستقیم‬ ‫‌طور‬
‫ه‬‫ب‬ ‫فرم‬ ‫یک‬ ‫در‬ ‫اطالعات‬ ‫ارائه‬
‫یک‬ ‫در‬ ‫یا‬ ‫داده‬ ‫پایگاه‬ ‫در‬ ‫که‬ ‫است‬ ‫همان‬ ً‫اساسا‬ ‫فرم‬ ‫یک‬ ‫در‬ ‫است‬ ‫ممکن‬ ‫بازیابی‬ ‫‌های‬
‫ه‬‫داد‬ .‫دیگر‬ ‫کاربردی‬
‫دسترس‬ ‫در‬ ‫شده‬ ‫ذخیره‬ ‫‌های‬
‫ه‬‫داد‬ ‫پایگاه‬ ‫از‬ ‫موجود‬ ‫‌های‬
‫ه‬‫داد‬ ‫ترکیب‬ ‫یا‬ ‫تغییر‬ ‫با‬ ‫آمده‬ ‫دست‬ ‫به‬ ‫جدید‬ ‫فرم‬
.‫‌است‬
‫ه‬‫شد‬ ‫ساخته‬
4
.
،‫‌ها‬
‫ه‬‫داد‬ ‫تمامیت‬ ‫حفظ‬ ،‫عملکرد‬ ‫بر‬ ‫نظارت‬ ،‫‌ها‬
‫ه‬‫داد‬ ‫امنیت‬ ‫اجرای‬ ،‫کاربران‬ ‫بر‬ ‫نظارت‬ ‫و‬ ‫نام‬ ‫ثبت‬ - ‫اداره‬
‫مانند‬ ‫رویداد‬ ‫از‬ ‫برخی‬ ‫توسط‬ ‫که‬ ‫است‬ ‫اطالعات‬ ‫بعد‬ ‫نقاهت‬ ‫دوره‬ ‫و‬ ،‫همزمانی‬ ‫کنترل‬ ‫با‬ ‫فروش‬ ‫و‬ ‫خرید‬
.‫‌آید‬
‫ی‬‫م‬ ‫وجود‬ ‫به‬ ‫خراب‬ ‫سیستم‬ ‫غیرمنتظره‬ ‫شکست‬
‫هم‬ ‫و‬ ‫داده‬ ‫پایگاه‬ ‫هم‬
DBMS
‫جمعی‬ ‫اشاره‬ »‫داده‬ ‫پایگاه‬ ‫«سیستم‬ .‫است‬ ‫خاص‬ ‫داده‬ ‫پایگاه‬ ‫مدل‬ ‫اصول‬ ‫با‬ ‫مطابق‬
.‫است‬ ‫داده‬ ‫پایگاه‬ ‫و‬ ،‫داده‬ ‫پایگاه‬ ‫مدیریت‬ ‫سیستم‬ ،‫داده‬ ‫پایگاه‬ ‫مدل‬ ‫به‬
‫داده‬ ‫پایگاه‬ ‫تاریخچه‬
‫داده‬ ‫پایگاه‬ ‫مفهوم‬
‫دهٔه‬ ‫از‬ ‫داده‬ ‫پایگاه‬ ‫مفهوم‬
۱۹۶۰
‫‌های‬
‫م‬‫سسیست‬ ‫نگهداشت‬ ‫و‬ ،‫ساخت‬ ،‫طراحی‬ ‫در‬ ‫فزاینده‬ ‫مشکالت‬ ‫کاهش‬ ‫برای‬
‫این‬ .‫‌است‬
‫ه‬‫شد‬ ‫ایجاد‬ )‫مختلف‬ ‫دادٔه‬ ‫زیادی‬ ‫تعداد‬ ‫با‬ ‫و‬ ،‫همزمان‬ ‫نهایی‬ ِ‫ر‬‫کارب‬ ‫زیادی‬ ‫تعداد‬ ‫با‬ ً‫ال‬‫(معمو‬ ‫اطالعاتی‬
‫ممکن‬ ‫را‬ ‫‌ها‬
‫ه‬‫داد‬ ‫پایگاه‬ ‫به‬ ‫کارا‬ ‫و‬ ‫مؤثر‬ ‫دستکاری‬ ‫که‬ ‫داده‬ ‫پایگاه‬ ‫مدیریت‬ ‫‌های‬
‫م‬‫سیست‬ ‫مفهوم‬ ‫همراه‬ ‫به‬ ‫مفهوم‬
.‫‌است‬
‫ه‬‫کرد‬ ‫رشد‬ ‫‌کند‬
‫ی‬‫م‬
‫ژوئن‬ ‫به‬ ‫داده‬ ‫پایگاه‬ ‫اصطالح‬ ‫کاربردهای‬ ‫اولین‬
۱۹۶۳
‫شرکت‬ ‫که‬ ‫زمانی‬ ‫یعنی‬ ،‫‌گردد‬
‫ی‬‫بازم‬
System Development
Corporation
‫بر‬ ‫را‬ »‫مرکزی‬ ‫‌ای‬
‫ه‬‫داد‬ ‫پایگاه‬ ‫یک‬ ‫محاسباتی‬ ‫مدیریت‬ ‫و‬ ‫«توسعه‬ ‫نام‬ ‫به‬ ‫طرح‬ ‫یک‬ ‫اجرایی‬ ‫مسئولیت‬
‫دهه‬ ‫اوایل‬ ‫در‬ ‫واحد‬ ‫واژه‬ ‫یک‬ ‫عنوان‬ ‫به‬ ‫داده‬ ‫پایگاه‬ .‫گرفت‬ ‫عهده‬
۷۰
‫دهه‬ ‫اواخر‬ ‫در‬ ‫و‬ ‫اروپا‬ ‫در‬
۷۰
‫‌های‬
‫ه‬‫نام‬ ‫خبر‬ ‫در‬
‫سال‬ ‫اوایل‬ ‫در‬ ‫یا‬ ‫‌ای‬
‫ه‬‫داد‬ ‫(بانک‬ .‫رفت‬ ‫کار‬ ‫به‬ ‫آمریکایی‬ ‫معتبر‬
۱۹۶۶
)‫رفت‬ ‫کار‬ ‫پست‬ ‫واشینگتن‬ ‫روزنامه‬ ‫در‬
‫دهه‬ ‫در‬ ‫داده‬ ‫پایگاه‬ ‫مدیریت‬ ‫سیستم‬ ‫اولین‬
۶۰
.‫‌باشد‬
‫ی‬‫م‬ ‫بکمن‬ ‫چارلز‬ ‫شاخه‬ ‫این‬ ‫پیشگامان‬ ‫از‬ .‫یافت‬ ‫گسترش‬
‫مهیا‬ ‫را‬ ‫‌سازی‬
‫ه‬‫ذخیر‬ ‫وسایل‬ ‫به‬ ‫دسترسی‬ ‫برای‬ ‫مؤثرتری‬ ‫بسیار‬ ‫کاربرد‬ ‫او‬ ‫فرضیات‬ ‫که‬ ‫داد‬ ‫نشان‬ ‫را‬ ‫این‬ ‫بکمن‬ ‫مقاالت‬
‫سری‬ ‫پردازش‬ ‫که‬ ‫بود‬ ‫مغناطیسی‬ ‫نوارهای‬ ‫و‬ ‫منگنه‬ ‫‌های‬
‫ت‬‫کار‬ ‫پایه‬ ‫بر‬ ‫داده‬ ‫پردازش‬ ‫‌ها‬
‫ن‬‫زما‬ ‫آن‬ ‫در‬ .‫‌کند‬
‫ی‬‫م‬
:‫شد‬ ‫ایجاد‬ ‫‌ها‬
‫ن‬‫زما‬ ‫آن‬ ‫در‬ ‫‌ای‬
‫ه‬‫داد‬ ‫مدل‬ ‫نوع‬ ‫دو‬ .‫‌کند‬
‫ی‬‫م‬ ‫مهیا‬ ‫را‬ ‫اطالعات‬
CODASYL
‫‌ای‬
‫ه‬‫شبک‬ ‫مدل‬ ‫توسعه‬ ‫موجب‬
‫توسط‬ ‫که‬ ‫مراتبی‬ ‫سلسله‬ ‫مدل‬ ‫و‬ ‫داشت‬ ‫بکمن‬ ‫نظریات‬ ‫در‬ ‫ریشه‬ ‫شدکه‬
North American Rockwell
‫شد‬ ‫ایجاد‬
‫شرکت‬ ‫آن‬ ‫از‬ ‫اقتباس‬ ‫با‬ ً‫بعدا‬ ‫و‬
IBM
‫محصول‬
IMS
.‫نمود‬ ‫تولید‬ ‫را‬
‫توسط‬ ‫‌ای‬
‫ه‬‫رابط‬ ‫مدل‬
E. F. Codd
‫سال‬ ‫در‬
۱۹۷۰
‫برای‬ .‫‌داد‬
‫ی‬‫م‬ ‫قرار‬ ‫انتقاد‬ ‫مورد‬ ‫را‬ ‫موجود‬ ‫‌های‬
‫ل‬‫مد‬ ‫او‬ .‫شد‬ ‫ارائه‬
‫کامپیوترها‬ ‫میکرو‬ ‫برای‬ ‫موفق‬ ‫محصول‬ ‫اولین‬ .‫بود‬ ‫تأیید‬ ‫مورد‬ ‫علمی‬ ‫مجامع‬ ‫در‬ ‫مدل‬ ‫این‬ ‫طوالنی‬ ً‫نسبتا‬ ‫مدتی‬
dBASE
‫‌های‬
‫ل‬‫‌عام‬
‫م‬‫سیست‬ ‫برای‬ ‫بودکه‬
CP/M
‫و‬
PC-DOS/MS-DOS
‫سال‬ ‫جریان‬ ‫در‬ .‫شد‬ ‫ساخته‬
۱۹۸۰
‫پژوهش‬
( ‫پایگاهی‬ ‫‌های‬
‫ن‬‫ماشی‬ ‫و‬ ‫شده‬ ‫توزیع‬ ‫مدل‬ ‫‌های‬
‫ه‬‫پایگا‬ ‫روی‬ ‫بر‬
database machines
‫کمی‬ ‫تأثیر‬ ‫اما‬ ،‫شد‬ ‫متمرکز‬ )
‫سال‬ ‫در‬ .‫گذاشت‬ ‫بازار‬ ‫بر‬
۱۹۹۰
‫مرکب‬ ‫‌های‬
‫ه‬‫داد‬ ‫کنترل‬ ‫جهت‬ ‫مدل‬ ‫این‬ .‫شد‬ ‫جلب‬ ‫گرا‬ ‫شیء‬ ‫مدل‬ ‫طرف‬ ‫به‬ ‫توجهات‬
‫‌های‬
‫ه‬‫داد‬ ‫و‬ )‫منابع‬ ‫‌افزار‬
‫م‬‫نر‬ ‫مهندسی‬ ‫(شامل‬ ‫داده‬ ‫مهندسی‬ ،‫خاص‬ ‫‌های‬
‫ه‬‫داد‬ ‫پایگاه‬ ‫روی‬ ‫بر‬ ‫‌سادگی‬
‫ه‬‫ب‬ ‫و‬ ‫بود‬ ‫الزم‬
.‫‌کرد‬
‫ی‬‫م‬ ‫کار‬ ‫‌ای‬
‫ه‬‫رسان‬ ‫چند‬
‫سال‬ ‫در‬
۲۰۰۰
( ‫‌ال‬
‫م‬‫‌ا‬
‫س‬‫اک‬ ‫پایگاه‬ ‫و‬ ‫داد‬ ‫رخ‬ ‫‌ای‬
‫ه‬‫تاز‬ ‫نوآوری‬
XML
‫تفاوت‬ ‫بردن‬ ‫بین‬ ‫از‬ ‫مدل‬ ‫این‬ ‫هدف‬ .‫آمد‬ ‫وجود‬ ‫به‬ )
‫قرار‬ ‫هم‬ ‫کنار‬ ‫در‬ ‫نه‬ ‫یا‬ ‫باشند‬ ‫یافته‬ ‫ساخت‬ ‫چه‬ ‫اطالعاتی‬ ‫منابع‬ ‫که‬ ‫‌کند‬
‫ی‬‫م‬ ‫کمک‬ ‫و‬ ‫است‬ ‫‌ها‬
‫ه‬‫داد‬ ‫و‬ ‫مستندات‬ ‫بین‬
.‫گیرند‬
‫اس‬ .‫ام‬.‫بی‬.‫دی‬ ‫توضیح‬
DBMS
‫تالش‬ ‫سال‬ ‫و‬ ‫نفر‬ ‫هزاران‬ ‫به‬ ‫معمول‬ ‫‌طور‬
‫ه‬‫ب‬ ‫آن‬ ‫توسعه‬ ‫و‬ ‫‌است‬
‫ه‬‫یافت‬ ‫تکامل‬ ‫پیچیده‬ ‫‌افزار‬
‫م‬‫نر‬ ‫سیستم‬ ‫یک‬
‫مانند‬ ‫اس‬ .‫ام‬.‫بی‬.‫دی‬ ‫از‬ ‫برخی‬ .‫دارد‬ ‫نیاز‬ ‫وتوسعه‬
Adabas
‫و‬ ‫اوراکل‬ ،
DB2
‫نیازهای‬ ‫رفع‬ ‫اس‬ .‫ام‬.‫بی‬.‫دی‬ ‫هدف‬ .
‫با‬ .‫باشد‬ ‫تر‬ ‫صرفه‬ ‫به‬ ‫مقرون‬ ‫‌تواند‬
‫ی‬‫م‬ ‫توسعه‬ ‫هزینه‬ ‫که‬ ‫است‬ ‫واقعیت‬ ‫این‬ ،‫حال‬ ‫این‬ ‫با‬ .‫ست‬ ‫کاربردی‬ ‫‌های‬
‫ه‬‫برنام‬
،‫حال‬ ‫این‬
DBMS
‫موارد‬ ‫برخی‬ ‫در‬ :‫دارد‬ ‫‌ای‬
‫ه‬‫بهین‬ ‫حل‬ ‫راه‬ ‫همیشه‬
DBMS
.‫کند‬ ‫معرفی‬ ‫را‬ ‫غیرضروری‬ ‫سربار‬ ‫ممکن‬
‫سیستم‬ ‫رایج‬ ‫مثال‬ ‫یک‬ .‫دارد‬ ‫وجود‬ ‫خاص‬ ‫‌های‬
‫ه‬‫داد‬ ‫پایگاه‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫که‬ ‫‌های‬
‫م‬‫سیست‬ ‫از‬ ‫بسیاری‬ ‫‌های‬
‫ه‬‫نمون‬
‫بخش‬ ‫نیازی‬ ‫و‬ ،‫ایمیل‬ ‫‌های‬
‫م‬‫پیا‬ ‫مدیریت‬ ‫‌سازی‬
‫ه‬‫بهین‬ ‫برای‬ ‫‌است‬
‫ه‬‫شد‬ ‫طراحی‬ ‫ایمیل‬ ‫‌های‬
‫م‬‫سیست‬ :‫است‬ ‫ایمیل‬
‫قابلیت‬ ‫از‬ ‫توجهی‬ ‫قابل‬
DBMS
‫به‬ ‫دسترسی‬ ‫برای‬ ‫است‬ ‫‌ای‬
‫ه‬‫برنام‬ ‫‌افزار‬
‫م‬‫نر‬ ‫اطالعاتی‬ ‫‌های‬
‫ک‬‫بان‬ ‫از‬ ‫بسیاری‬ .‫است‬
‫رابط‬ ‫دادن‬ ‫قرار‬ ‫بدون‬ ،‫نهایی‬ ‫کاربران‬ ‫طرف‬ ‫از‬ ‫داده‬ ‫پایگاه‬
DBMS
‫ممکن‬ ‫‌افزار‬
‫م‬‫نر‬ ‫نویسان‬ ‫برنامه‬ .‫مستقیم‬ ‫‌طور‬
‫ه‬‫ب‬
.‫کنند‬ ‫استفاده‬ ‫برنامه‬ ‫‌نویسی‬
‫ه‬‫برنام‬ ‫رابط‬ ‫یک‬ ‫طریق‬ ‫از‬ ‫زیاد‬ ‫احتمال‬ ‫به‬ ‫یا‬ ،‫مستقیم‬ ‫‌طور‬
‫ه‬‫ب‬ ‫سیم‬ ‫پروتکل‬ ‫یک‬ ‫است‬
‫با‬ ‫داده‬ ‫پایگاه‬ ‫مدیران‬ ‫و‬ ‫داده‬ ‫پایگاه‬ ‫طراحان‬
DBMS
‫حفظ‬ ‫و‬ ‫ساخت‬ ‫برای‬ ‫شده‬ ‫داده‬ ‫اختصاص‬ ‫‌های‬
‫ط‬‫راب‬ ‫طریق‬ ‫از‬
‫عملکرد‬ ‫چگونگی‬ ‫مورد‬ ‫در‬ ‫درک‬ ‫و‬ ‫بیشتر‬ ‫دانش‬ ‫از‬ ‫برخی‬ ‫به‬ ‫نیاز‬ ‫نتیجه‬ ‫در‬ ‫و‬ ،‫داده‬ ‫‌های‬
‫ه‬‫پایگا‬ ' ‫کاربردی‬ ‫‌های‬
‫ه‬‫برنام‬
.‫‌کنند‬
‫ی‬‫م‬ ‫تعامل‬ ‫اس‬ .‫ام‬.‫بی‬.‫دی‬ ‫تنظیم‬ ‫پارامترهای‬ ‫و‬ ‫خارجی‬ ‫رابط‬ ‫و‬ ‫اس‬ .‫ام‬.‫بی‬.‫دی‬
‫داده‬ ‫پایگاه‬ ‫‌های‬
‫ل‬‫مد‬
‫‌های‬
‫ل‬‫مد‬ ‫برای‬ ‫مختلفی‬ ‫شگردهای‬ .‫‌کند‬
‫ی‬‫م‬ ‫مشخص‬ ‫منطقی‬ ‫سطح‬ ‫در‬ ‫را‬ ‫‌ها‬
‫ه‬‫داد‬ ‫پایگاه‬ ‫کاربران‬ ‫کاری‬ ‫الگوی‬
‫سطوح‬ ‫و‬ ‫است‬ ‫‌سازی‬
‫ه‬‫پیاد‬ ‫قابل‬ ‫مختلفی‬ ‫فیزیکی‬ ‫اجراهای‬ ‫منطقی‬ ‫‌های‬
‫ل‬‫مد‬ ‫از‬ ‫یک‬ ‫هر‬ ‫برای‬ .‫دارد‬ ‫وجود‬ ‫‌ای‬
‫ه‬‫داد‬
‫سلسله‬ ‫مدل‬ ،‫تخت‬ ‫مدل‬ ‫از‬ ‫عبارتند‬ ‫‌ها‬
‫ل‬‫مد‬ ‫این‬ .‫‌کند‬
‫ی‬‫م‬ ‫مهیا‬ ‫کاربران‬ ‫برای‬ ‫فیزیکی‬ ‫انطباق‬ ‫در‬ ‫مختلفی‬ ‫کنترل‬
.‫است‬ ‫امروزی‬ ‫‌های‬
‫ه‬‫داد‬ ‫پایگاه‬ ‫مدیریت‬ ‫سامانه‬ ‫کار‬ ‫اساس‬ ‫‌ای‬
‫ه‬‫رابط‬ ‫مدل‬ .‫‌ای‬
‫ه‬‫رابط‬ ‫مدل‬ ‫و‬ ‫‌ای‬
‫ه‬‫شبک‬ ‫مدل‬ ،‫مراتبی‬
‫‌سازی‬
‫ل‬‫مد‬ ‫و‬ ‫طراحی‬
‫ساختار‬ ‫‌کننده‬
‫س‬‫منعک‬ ‫که‬ ‫مفهومی‬ ‫داده‬ ‫مدل‬ ‫یک‬ ‫تولید‬ ‫برای‬ ‫که‬ ‫است‬ ‫این‬ ‫داده‬ ‫پایگاه‬ ‫طراح‬ ‫یک‬ ‫وظیفه‬ ‫اولین‬
‫اغلب‬ ،‫ارتباط‬-‫موجودیت‬ ‫مدل‬ ‫یک‬ ‫توسعه‬ ‫منظور‬ ‫به‬ .‫کند‬ ‫پیشنهاد‬ ‫طرحی‬ ‫‌شود‬
‫ی‬‫م‬ ‫برگزار‬ ‫داده‬ ‫پایگاه‬ ‫در‬ ‫اطالعات‬
‫حالت‬ ‫دقت‬ ‫به‬ ‫موفق‬ ‫داده‬ ‫مدل‬ .‫است‬ ‫یکپارچه‬ ‫‌سازی‬
‫ل‬‫مد‬ ‫زبان‬ ‫محبوب‬ ‫روش‬ ‫از‬ ‫دیگر‬ ‫یکی‬ .‫طراحی‬ ‫ابزار‬ ‫کمک‬ ‫با‬
‫یک‬ ‫از‬ ‫بیش‬ ‫‌توانند‬
‫ی‬‫م‬ ‫مردم‬ ‫اگر‬ ،‫مثال‬ ‫عنوان‬ ‫به‬ :‫شود‬ ‫خارج‬ ‫جهان‬ ‫از‬ ‫ممکن‬ ‫مدل‬ ‫دارد‬ ‫بستگی‬ ‫‌کننده‬
‫س‬‫منعک‬
‫داده‬ ‫مدل‬ ‫طراحی‬ .‫شود‬ ‫ذخیره‬ ‫اطالعات‬ ‫یک‬ ‫از‬ ‫بیش‬ ‫که‬ ‫‌دهد‬
‫ی‬‫نم‬ ‫اجازه‬ ‫حقیقت‬ ‫در‬ ،‫باشد‬ ‫داشته‬ ‫تلفن‬ ‫شماره‬
‫مورد‬ ‫در‬ ‫عمیق‬ ‫‌های‬
‫ل‬‫سوا‬ ‫پرسیدن‬ ‫شامل‬ ً‫ال‬‫معمو‬ .‫دارد‬ ‫کاربران‬ ‫کاربرد‬ ‫دامنه‬ ‫از‬ ‫خوبی‬ ‫درک‬ ‫به‬ ‫نیاز‬ ‫خوب‬ ‫مفهومی‬
،" ‫باشد؟‬ ‫کاال‬ ‫‌کننده‬
‫ه‬‫عرض‬ ‫یک‬ ‫‌تواند‬
‫ی‬‫م‬ ‫مشتری‬ ‫یک‬ " ‫مانند‬ ،‫‌باشد‬
‫ی‬‫م‬ ‫دارد‬ ‫عالقه‬ ‫آن‬ ‫به‬ ‫سازمان‬ ‫یک‬ ‫که‬ ‫چیزهایی‬
‫مختلف‬ ‫محصوالت‬ ‫یا‬ ‫محصول‬ ‫همان‬ ،‫‌رسد‬
‫ی‬‫م‬ ‫فروش‬ ‫به‬ ‫‌بندی‬
‫ه‬‫بست‬ ‫از‬ ‫مختلف‬ ‫فرم‬ ‫دو‬ ‫با‬ ‫محصول‬ ‫یک‬ ‫اگر‬ " ‫یا‬
‫و‬ ‫‌ها‬
‫ن‬‫آ‬ ‫روابط‬ ‫و‬ )‫پرواز‬ ‫بخش‬ ،‫پرواز‬ ،‫محصوالت‬ ،‫(مشتریان‬ ‫اشخاص‬ ‫برای‬ ‫اصطالحات‬ ‫تعاریف‬ ‫؟"پرسش‬ ‫است‬ ‫آن‬
‫از‬ ‫ورودی‬ ‫شامل‬ ‫اوقات‬ ‫گاهی‬ ‫مفهومی‬ ‫داده‬ ‫مدل‬ ‫تولید‬ .‫‌گیرد‬
‫ی‬‫م‬ ‫قرار‬ ‫استفاده‬ ‫مورد‬ ‫شده‬ ‫ایجاد‬ ‫‌های‬
‫ی‬‫ویژگ‬
‫پایگاه‬ ‫در‬ ‫اطالعاتی‬ ‫ایجاد‬ ‫به‬ ‫‌تواند‬
‫ی‬‫م‬ ‫این‬ .‫است‬ ‫سازمان‬ ‫در‬ ‫کار‬ ‫گردش‬ ‫تحلیل‬ ‫و‬ ‫تجزیه‬ ‫یا‬ ،‫کار‬ ‫و‬ ‫کسب‬ ‫فرایندهای‬
‫‌های‬
‫ه‬‫داد‬ ‫نگهداری‬ ‫برای‬ ‫نیاز‬ ‫مورد‬ ‫داده‬ ‫پایگاه‬ ‫‌گیری‬
‫م‬‫تصمی‬ ‫به‬ ‫‌تواند‬
‫ی‬‫م‬ ،‫مثال‬ ‫عنوان‬ ‫به‬ .‫کند‬ ‫کمک‬ ‫نیاز‬ ‫مورد‬ ‫داده‬
.‫هستند‬ ‫خوشحال‬ ‫کاربران‬ ‫مفهومی‬ ‫داده‬ ‫مدل‬ ‫یک‬ ‫تولید‬ ‫از‬ ‫پس‬ .‫کند‬ ‫کمک‬ ‫فعلی‬ ‫‌های‬
‫ه‬‫داد‬ ‫همچنین‬ ‫و‬ ‫تاریخی‬
‫پایگاه‬ ‫در‬ ‫مربوطه‬ ‫‌های‬
‫ه‬‫داد‬ ‫ساختمان‬ ‫‌سازی‬
‫ه‬‫پیاد‬ ‫که‬ ‫کنند‬ ‫ترجمه‬ ‫را‬ ‫طرح‬ ‫این‬ ‫که‬ ‫است‬ ‫این‬ ‫بعدی‬ ‫مرحله‬
‫در‬ ‫شده‬ ‫بیان‬ ‫‌ها‬
‫ه‬‫داد‬ ‫منطقی‬ ‫مدل‬ ‫خروجی‬ ‫و‬ ،‫منطقی‬ ‫‌های‬
‫ه‬‫داد‬ ‫پایگاه‬ ‫طراحی‬ ‫نام‬ ‫به‬ ‫اغلب‬ ‫فرایند‬ ‫این‬ .‫‌است‬
‫ه‬‫داد‬
‫پایگاه‬ ‫فناوری‬ ‫انتخاب‬ ‫از‬ ‫مستقل‬ )‫حداقل‬ ‫تئوری‬ ‫(در‬ ‫مفهومی‬ ‫داده‬ ‫مدل‬ ‫که‬ ‫حالی‬ ‫در‬ .‫است‬ ‫طرح‬ ‫یک‬ ‫قالب‬
‫توسط‬ ‫شده‬ ‫پشتیبانی‬ ‫خاص‬ ‫داده‬ ‫پایگاه‬ ‫مدل‬ ‫یک‬ ‫‌ها‬
‫ه‬‫داد‬ ‫منطقی‬ ‫مدل‬ ،‫‌است‬
‫ه‬‫داد‬
DBMS
.‫‌کند‬
‫ی‬‫م‬ ‫انتخاب‬ ‫را‬
‫با‬ ‫ما‬ ‫مقاله‬ ‫این‬ ‫در‬ ‫اما‬ ،‫‌شود‬
‫ی‬‫م‬ ‫استفاده‬ ‫یکدیگر‬ ‫جای‬ ‫به‬ ‫اغلب‬ ‫‌باشد‬
‫ی‬‫م‬ ‫داده‬ ‫پایگاه‬ ‫مدل‬ ‫و‬ ‫‌ها‬
‫ه‬‫داد‬ ‫شرایط‬ ‫(مدل‬
‫طراحی‬ ‫بیان‬ ‫‌سازی‬
‫ل‬‫مد‬ ‫نماد‬ ‫برای‬ ‫داده‬ ‫پایگاه‬ ‫مدل‬ ‫و‬ ،‫خاص‬ ‫داده‬ ‫پایگاه‬ ‫یک‬ ‫طراحی‬ ‫برای‬ ‫داده‬ ‫مدل‬ ‫از‬ ‫استفاده‬
‫عنوان‬ ‫به‬ ‫‌ای‬
‫ه‬‫رابط‬ ‫مدل‬ ،‫تر‬ ‫دقیق‬ ‫یا‬ ،‫‌ای‬
‫ه‬‫رابط‬ ‫مدل‬ ‫دادٔه‬ ‫پایگاه‬ ‫‌ترین‬
‫ب‬‫محبو‬ ‫داده‬ ‫پایگاه‬ ‫مدل‬ )‫‌کنیم‬
‫ی‬‫م‬ ‫استفاده‬
‫زبان‬
SQL
‫روش‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫مدل‬ ‫این‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫منطقی‬ ‫داده‬ ‫پایگاه‬ ‫طراحی‬ ‫یک‬ ‫ایجاد‬ ‫روند‬ .‫‌است‬
‫ه‬‫داد‬ ‫نشان‬
‫که‬ ‫است‬ »‫«حقیقت‬ ‫ابتدا‬ ‫در‬ ‫که‬ ‫‌شود‬
‫ی‬‫م‬ ‫حاصل‬ ‫اطمینان‬ .‫است‬ ‫عادی‬ ‫روش‬ ‫عنوان‬ ‫به‬ ‫شده‬ ‫شناخته‬ ‫روشمند‬
.‫‌شود‬
‫ی‬‫م‬ ‫انجام‬ ‫انسجام‬ ‫حفظ‬ ‫برای‬ ‫خودکار‬ ‫صورت‬ ‫به‬ ‫حذف‬ ‫و‬ ‫روزرسانی‬ ‫به‬ ‫‌طوری‬
‫ه‬‫ب‬ ،‫شده‬ ‫ثبت‬ ‫مکان‬ ‫یک‬ ‫در‬ ‫تنها‬
‫و‬ ،‫امنیت‬ ،‫بهبود‬ ،‫پذیری‬ ‫مقیاس‬ ،‫عملکرد‬ ‫برای‬ ‫‌گیری‬
‫م‬‫تصمی‬ ‫که‬ ‫است‬ ‫این‬ ‫داده‬ ‫پایگاه‬ ‫طراحی‬ ‫از‬ ‫نهایی‬ ‫مرحله‬
‫مرحله‬ ‫این‬ ‫در‬ ‫کلیدی‬ ‫هدف‬ .‫‌شود‬
‫ی‬‫م‬ ‫نامیده‬ ‫فیزیکی‬ ‫‌های‬
‫ه‬‫داد‬ ‫پایگاه‬ ‫طراحی‬ ‫اغلب‬ ‫که‬ ‫‌گذارد‬
‫ی‬‫م‬ ‫تأثیر‬ ‫آن‬ ‫مانند‬
‫باشد‬ ‫نامرئی‬ ‫باید‬ ‫عملکرد‬ ‫‌سازی‬
‫ه‬‫بهین‬ ‫اهداف‬ ‫برای‬ ‫شده‬ ‫اتخاذ‬ ‫تصمیمات‬ ‫که‬ ‫معنی‬ ‫این‬ ‫به‬ ،‫‌است‬
‫ه‬‫داد‬ ‫استقالل‬
‫رانده‬ ‫نیاز‬ ‫مورد‬ ‫عملکرد‬ ‫توسط‬ ً‫عمدتا‬ ‫فیزیکی‬ ‫طراحی‬ .‫است‬ ‫کاربردی‬ ‫‌های‬
‫ه‬‫برنام‬ ‫و‬ ‫کاربران‬ ‫به‬ ‫دادن‬ ‫پایان‬ ‫برای‬ ‫که‬
‫ارائه‬ ‫‌های‬
‫ی‬‫ویژگ‬ ‫از‬ ‫عمیق‬ ‫درک‬ ‫و‬ ،‫‌رود‬
‫ی‬‫م‬ ‫انتظار‬ ‫دسترسی‬ ‫و‬ ‫کار‬ ‫حجم‬ ‫الگوهای‬ ‫از‬ ‫خوبی‬ ‫دانش‬ ‫به‬ ‫نیاز‬ ‫و‬ ،‫‌شود‬
‫ی‬‫م‬
‫توسط‬ ‫شده‬
DBMS
‫این‬ .‫است‬ ‫امنیتی‬ ‫فیزیکی‬ ‫‌های‬
‫ه‬‫داد‬ ‫پایگاه‬ ‫طراحی‬ ‫جنبه‬ ‫از‬ ‫دیگر‬ ‫یکی‬ .‫‌است‬
‫ه‬‫شد‬ ‫انتخاب‬
‫برای‬ ‫روش‬ ‫و‬ ‫امنیتی‬ ‫سطوح‬ ‫تعریف‬ ‫همچنین‬ ‫و‬ ‫داده‬ ‫پایگاه‬ ‫اشیاء‬ ‫به‬ ‫دسترسی‬ ‫کنترل‬ ‫تعریف‬ ‫دو‬ ‫هر‬ ‫شامل‬
.‫است‬ ‫‌ها‬
‫ه‬‫داد‬
‫تخصصی‬ ‫و‬ ‫اجرایی‬ ‫بحث‬
‫بدون‬ ‫خود‬ ‫‌ای‬
‫ه‬‫حرف‬ ‫زندگی‬ ‫آغاز‬ ‫در‬ ‫که‬ ‫هستند‬ ‫غیرمتخصص‬ ‫کدنویسان‬ ‫برخی‬ ‫اطالعاتی‬ ‫بانک‬ ‫ساخت‬ ‫زمینه‬ ‫در‬
‫جدولی‬ ‫بین‬ ‫ارتباطات‬ ‫ایجاد‬ ‫حتی‬ ‫یا‬ ‫جداول‬ ‫ساخت‬ ‫به‬ ‫اقدام‬ ‫اطالعاتی‬ ‫بانک‬ ‫سرور‬ ‫‌های‬
‫ه‬‫پای‬ ‫با‬ ‫ساختاری‬ ‫آشنایی‬
( ‫‌کنند‬
‫ی‬‫م‬
relations
‫یا‬
RDBMS
‫جمله‬ ‫از‬ ‫است‬ ‫مطرح‬ ‫همیشه‬ ‫ثابت‬ ‫بحث‬ ‫چند‬ ‫اطالعاتی‬ ‫بانک‬ ‫طراحی‬ ‫در‬ .)
،)‫سرعت‬ ‫افزایش‬ ‫برای‬ ‫تکرار‬ ‫برای‬ ‫(تالش‬ ‫‌سازی‬
‫ل‬‫نانرما‬ ،)‫حجم‬ ‫در‬ ‫‌جویی‬
‫ه‬‫صرف‬ ‫برای‬ ‫تکرار‬ ‫از‬ ‫(اجتناب‬ ‫‌سازی‬
‫ل‬‫نرما‬
‫با‬ ‫آشنایی‬
indexing
‫همان‬ ً‫(تقریبا‬ ‫ایندکس‬ ‫کالسترد‬ ‫شامل‬ ‫حروف‬ ‫اساس‬ ‫بر‬ ‫هدفمند‬ ‫‌سازی‬
‫ب‬‫مرت‬ ‫یا‬
PKs
‫و‬ )
‫ردیف‬ ‫کالستردایندکس‬ ‫به‬ ‫یافتن‬ ‫از‬ ‫پس‬ ‫نام‬ ‫ایندکس‬ ‫مثال‬ ‫(برای‬ ‫دوم‬ ‫‌آپ‬
‫ک‬‫لو‬ ‫مبحث‬ ‫با‬ ‫دوم‬ ‫‌های‬
‫س‬‫ایندک‬
ً‫ال‬‫معمو‬ ‫که‬ ‫خودش‬
PK
‫مانند‬ ‫‌هایی‬
‫ث‬‫بح‬ ‫و‬ )‫کند‬ ‫استخراج‬ ‫را‬ ‫ردیف‬ ‫تا‬ ‫‌کند‬
‫ی‬‫م‬ ‫مراجعه‬ ‫است‬
B-tree
‫به‬ ‫برخی‬ ‫که‬
‫خود‬ ‫که‬ ‫معنی‬ ‫بدان‬ ‫است‬ ‫‌شونده‬
‫ل‬‫متعاد‬-‫خود‬ ‫درخت‬ ‫واقع‬ ‫در‬ ‫اما‬ ‫‌گیرند‬
‫ی‬‫م‬ ‫اشتباه‬ ‫باینری‬ ‫درخت‬ ‫با‬ ‫را‬ ‫آن‬ ‫اشتباه‬
‫دسته‬ ‫دسته‬ ‫را‬ ‫‌ها‬
‫س‬‫ایندک‬ ‫مرحله‬ ‫چند‬ ‫تا‬ ‫که‬ ‫‌گیرد‬
‫ی‬‫م‬ ‫تصمیم‬ ‫اطالعاتی‬ ‫جدول‬ ‫‌های‬
‫ف‬‫ردی‬ ‫تعداد‬ ‫اساس‬ ‫بر‬ ‫سرور‬
.‫برسد‬ ‫نظر‬ ‫مورد‬ ‫ردیف‬ ‫‌های‬
‫ه‬‫داد‬ ‫به‬ ‫ممکن‬ ‫زمان‬ ‫‌ترین‬
‫ع‬‫سری‬ ‫در‬ ‫جستجو‬ ‫مورد‬ ‫مقدار‬ ‫مقایسه‬ ‫با‬ ‫بتواند‬ ‫تا‬ ‫کند‬
‫با‬ ‫شاخه‬ ‫‌های‬
‫ه‬‫گر‬ ،)‫آغازین‬ ‫‌بندی‬
‫ه‬‫دست‬ ‫(تنها‬ ‫روت‬ ‫یا‬ ‫ریشه‬ ‫گره‬ ‫گونه‬ ‫سه‬ ‫به‬ ‫‌ها‬
‫ی‬‫‌بند‬
‫ه‬‫دست‬ ‫این‬ ‫مختلف‬ ‫سطوح‬
‫مهم‬ ‫مباحث‬ ‫جمله‬ ‫از‬ .‫دارند‬ ‫وجود‬ )‫(پایانی‬ ‫‌شوند‬
‫ی‬‫‌م‬
‫ه‬‫شناخت‬ ‫پیجز‬ ‫لیف‬ ‫به‬ ‫که‬ ‫لیفز‬ ‫یا‬ ‫برگ‬ ‫‌های‬
‫ه‬‫گر‬ ‫و‬ )‫(میانی‬ ‫برنچ‬
‫زمان‬ ‫در‬ ‫که‬ ‫است‬ ‫جستجو‬ ‫نوع‬ ‫با‬ ‫متناسب‬ ‫کامپوزیت‬ ‫یا‬ ‫ترکیبی‬ ‫‌های‬
‫س‬‫ایندک‬ ‫ایجاد‬ ‫اطالعاتی‬ ‫بانک‬ ‫کارایی‬ ‫افزایش‬
‫مانند‬ ‫سرورها‬ ‫برخی‬ ‫در‬ ‫مباحث‬ ‫این‬ ‫تمام‬ ‫بین‬ ‫در‬ .‫است‬ ‫برخوردار‬ ‫مهمی‬ ‫اهمیت‬ ‫از‬ ‫جداول‬ ‫بین‬ ‫ارتباطات‬ ‫ایجاد‬
‫اطالعاتی‬ ‫موتور‬ ‫نوع‬ ‫چه‬ ‫از‬ ‫اینکه‬ ‫‌کیوال‬
‫س‬‫‌ا‬
‫ی‬‫ما‬
MyISAM
‫یا‬
InnoDB
‫زیرا‬ ‫است‬ ‫سواالت‬ ‫اولین‬ ‫از‬ ‫شود‬ ‫استفاده‬
‫هم‬ ‫و‬ ‫ثبت‬ ‫هم‬ ‫سرعت‬ ‫در‬ ‫تعادل‬ ‫نماینده‬ ‫دومی‬ ‫و‬ )‫بایگانی‬ ً‫ال‬‫(معمو‬ ‫است‬ ‫اطالعات‬ ‫ثبت‬ ‫در‬ ‫سرعت‬ ‫نماینده‬ ‫اولی‬
‫غیرترزاکشن‬ ‫یا‬ ‫غیرتراکنشی‬ ‫عنوان‬ ‫با‬ ‫و‬ ‫‌کند‬
‫ی‬‫م‬ ‫قفل‬ ‫را‬ ‫جدول‬ ‫کل‬ ‫داده‬ ‫ثبت‬ ‫زمان‬ ‫در‬ ‫اولی‬ ‫در‬ ‫دلیل‬ ‫این‬ ‫به‬ ‫خواندن‬
.‫‌کند‬
‫ی‬‫م‬ ‫قفل‬ ‫را‬ ‫‌ها‬
‫ف‬‫ردی‬ ‫و‬ ‫است‬ ‫برعکس‬ ‫دومی‬ ‫که‬ ‫حالی‬ ‫در‬ ‫‌شود‬
‫ی‬‫م‬ ‫شناخته‬
‫نیز‬ ‫مدل‬ ‫طراحی‬ ‫مرحله‬ ‫که‬ ‫‌شود‬
‫ی‬‫م‬ ‫آغاز‬ ‫مغز‬ ‫یا‬ ‫فکر‬ ‫طوفان‬ ‫مرحله‬ ‫از‬ ‫پس‬ ‫اطالعاتی‬ ‫بانک‬ ‫طراحی‬ ‫فرایند‬ ً‫ال‬‫معمو‬
‫مانند‬ ‫شده‬ ‫استفاده‬ ‫فکر‬ ‫طوفان‬ ‫برای‬ ‫که‬ ‫شود‬ ‫انجام‬ ‫محیطی‬ ‫همان‬ ‫در‬ ‫است‬ ‫ممکن‬
MS Visio
‫پس‬ ً‫ال‬‫معمو‬ ‫اما‬
‫استودیوهای‬ ‫در‬ ‫مستقیم‬ ‫داده‬ ‫پایگاه‬ ‫طراحی‬ ‫و‬ ‫‌کشی‬
‫ل‬‫مد‬ ‫مرحله‬ ،‫پروژه‬ ‫ساختار‬ ‫دربارٔه‬ ‫تصمیمات‬ ‫شدن‬ ‫قطعی‬ ‫از‬
‫مانند‬ ‫اطالعاتی‬ ‫بانک‬ ‫طراحی‬
MySQL Workbench
‫یا‬
SQL server management studio
‫از‬ ‫‌شود‬
‫ی‬‫م‬ ‫انجام‬
‫تحت‬ ‫پروژه‬ ‫چه‬ ‫رو‬ ‫این‬
RUP
.‫شود‬ ‫اعمال‬ ‫اصلی‬ ‫مدل‬ ‫در‬ ‫بالفاصله‬ ‫‌تواند‬
‫ی‬‫م‬ ‫تغییرات‬ ‫شود‬ ‫اجرا‬ ‫اجیل‬ ‫یا‬
‫برنامه‬ ‫روی‬ ‫اطالعاتی‬ ‫بانک‬ ‫مدل‬ ‫میانی‬ ‫الیه‬ ‫عملکرد‬ ‫نحوه‬ ‫با‬ ‫پیش‬ ‫از‬ ‫که‬ ‫باشد‬ ‫‌ای‬
‫ه‬‫گون‬ ‫به‬ ‫باید‬ ‫پایگاه‬ ‫طراحی‬
‫نه‬ ‫اما‬ ‫‌شود‬
‫ی‬‫م‬ ‫ساخته‬ ‫موجود‬ ‫اطالعاتی‬ ‫بانک‬ ‫اساس‬ ‫بر‬ ‫برنامه‬ ‫برعکس‬ ‫(گاهی‬ ‫باشد‬ ‫هماهنگ‬ ‫‌کننده‬
‫ه‬‫استفاد‬
‫کاربران‬ ‫تعداد‬ ‫و‬ ‫پروژه‬ ‫وسعت‬ ‫میزان‬ ‫به‬ ‫بسته‬ ‫مثال‬ ‫برای‬ )‫است‬ ‫طراحی‬ ‫حال‬ ‫در‬ ‫پروژه‬ ‫مختص‬ ‫داده‬ ‫پایگاه‬ ‫زمانی‬
‫داده‬ ‫‌کشی‬
‫ه‬‫نقش‬ ‫الگوی‬ ‫الیه‬ ‫از‬ ‫است‬ ‫ممکن‬
(
en
)
(
Datamapper
‫نسبت‬ ‫‌تر‬
‫م‬‫عظی‬ ‫‌های‬
‫ه‬‫پروژ‬ ‫برای‬ ‫باالتر‬ ‫سرعت‬ ‫با‬ )
( ‫کنشور‬ ‫ثبت‬ ‫الگوی‬ ‫به‬
AR
‫است‬ ‫ممکن‬ ‫مواردی‬ ‫در‬ ‫حتی‬ ‫شود‬ ‫استفاده‬ ‫است‬ ‫برخوردار‬ ‫‌تری‬
‫ن‬‫‌پایی‬
‫ت‬‫سرع‬ ‫از‬ ‫که‬ )
‫الیه‬ ‫‌گونه‬
‫چ‬‫هی‬ ‫از‬ ‫استفاده‬ ‫امکان‬
ORM
‫تراکنش‬ ‫گونه‬ ‫هر‬ ‫امنیتی‬ ‫مسائل‬ ‫خاطر‬ ‫به‬ ‫مثال‬ ‫برای‬ ‫باشد‬ ‫نداشته‬ ‫وجود‬
‫بواسطه‬ ‫اطالعاتی‬ ‫بانک‬
procedure
‫یا‬ ‫افزودن‬ ‫اجازه‬ ‫و‬ ‫شود‬ ‫انجام‬ ‫ایمن‬ ‫شده‬ ‫‌نوشته‬
‫ش‬‫پی‬ ‫از‬ ‫‌های‬
‫ن‬‫روتی‬ ‫و‬ ‫ها‬
‫از‬ ‫که‬ ‫‌است‬
‫ه‬‫شد‬ ‫توصیه‬ ً‫اکثرا‬ .‫باشد‬ ‫نداشته‬ ‫وجود‬ ‫سرور‬ ‫کاربران‬ ‫برای‬ ‫اطالعاتی‬ ‫بانک‬ ‫سرور‬ ‫روی‬ ‫ویرایش‬
AR
‫برای‬
‫‌های‬
‫ک‬‫بان‬ ‫مبحث‬ ‫در‬ .‫است‬ ‫بهتر‬ ‫گزینه‬ ‫دیتامپر‬ ‫عوض‬ ‫در‬ ‫نشود‬ ‫استفاده‬ ‫دارند‬ ‫بسیار‬ ‫کاربران‬ ‫که‬ ‫‌هایی‬
‫ه‬‫پروژ‬
‫تضاد‬ ‫در‬ ‫دومین‬ ‫الیه‬ ‫‌ها‬
‫ن‬‫آ‬ ‫از‬ ‫یکی‬ ‫‌شود‬
‫ی‬‫م‬ ‫استفاده‬ ‫متفاوتی‬ ً‫ال‬‫کام‬ ‫امور‬ ‫برای‬ ‫دامنه‬ ‫یا‬ ‫دومین‬ ‫عبارت‬ ‫از‬ ‫اطالعاتی‬
‫دیگری‬ ‫و‬ ‫‌هاست‬
‫ه‬‫داد‬ ‫ریلیشن‬ ‫بررسی‬ ‫و‬ ‫ویرایش‬ ‫و‬ ‫ثبت‬ ‫‌کننده‬
‫ل‬‫کنتر‬ ‫الیه‬ ‫یکی‬ ‫که‬ ‫است‬ ‫دیتامپر‬ ‫در‬ ‫بیزینس‬ ‫الیه‬ ‫با‬
.‫‌کند‬
‫ی‬‫م‬ ‫استفاده‬ ‫اول‬ ‫الیه‬ ‫از‬ ‫که‬ ‫برنامه‬ ‫در‬ ‫‌سازی‬
‫ل‬‫مد‬ ‫الیه‬
‫‌کیوال‬
‫س‬‫‌ا‬
‫ی‬‫ما‬
:‫انگلیسی‬ ‫(به‬
MySQL
‫اوراکل‬ ‫شرکت‬ ‫توسط‬ ‫که‬ ‫است‬ ‫‌باز‬
‫ن‬‫مت‬ ‫‌ها‬
‫ه‬‫داد‬ ‫پایگاه‬ ‫مدیریت‬ ‫سامانه‬ ‫یک‬ )
.‫‌شود‬
‫ی‬‫م‬ ‫پشتیبانی‬ ‫و‬ ،‫توزیع‬ ،‫توسعه‬
.‫‌دهد‬
‫ی‬‫م‬ ‫را‬ ‫‌ها‬
‫ه‬‫داد‬ ‫از‬ ‫‌زمان‬
‫م‬‫ه‬ ‫استفاده‬ ‫اجازه‬ ‫کاربر‬ ‫چندین‬ ‫به‬ ‫‌کیوال‬
‫س‬‫‌ا‬
‫ی‬‫ما‬ ‫سرور‬
‫‌ها‬
‫ت‬‫مزی‬
:‫است‬ ‫‌مند‬
‫ه‬‫بهر‬ ‫زیر‬ ‫‌های‬
‫ت‬‫مزی‬ ‫از‬ ‫‌کیوال‬
‫س‬‫‌ا‬
‫ی‬‫ما‬
•
‫انعطاف‬ ‫قابلیت‬ ‫و‬ ‫‌پذیری‬
‫س‬‫مقیا‬
•
‫باال‬ ‫عملکرد‬
•
‫باال‬ ‫بودن‬ ‫دسترس‬ ‫در‬
•
‫‌ها‬
‫ش‬‫تراکن‬ ‫از‬ ‫پشتیبانی‬
•
‫داده‬ ‫از‬ ‫محافظت‬
•
‫مدیریت‬ ‫بودن‬ ‫آسان‬
•
‫برنامه‬ ‫بودن‬ ‫آزاد‬
•
‫‌روزی‬
‫ه‬‫شبان‬ ‫پشتیبانی‬
‫تاریخچه‬
‫سال‬ ‫در‬ ‫‌کیوال‬
‫س‬‫‌ا‬
‫ی‬‫ما‬ ‫توسعه‬
۱۹۹۴
‫در‬ ‫داخلی‬ ‫نسخه‬ ‫اولین‬ ‫شد‬ ‫آغاز‬ ‫آکسمارک‬ ‫دیوید‬ ‫و‬ ‫وایدنیوس‬ ‫مایکل‬ ‫توسط‬
۲۳
‫می‬
۱۹۹۵
‫سال‬ ‫در‬ .‫شد‬ ‫عرضه‬
۲۰۰۸
‫اوراکل‬ ‫شرکت‬ .‫کرد‬ ‫خریداری‬ ‫را‬ ‫‌بی‬
‫ی‬‫ا‬ ‫‌کیوال‬
‫س‬‫‌ا‬
‫ی‬‫ما‬ ‫میکروسیستمز‬ ‫سان‬
‫در‬ ‫را‬ ‫میکروسیستمز‬ ‫سان‬
۲۷
‫ژانویه‬
۲۰۱۰
.‫کرد‬ ‫خریداری‬
‫‌ها‬
‫ت‬‫قابلی‬
‫داده‬ ‫انواع‬
:‫است‬ ‫زیر‬ ‫موارد‬ ‫شامل‬ ‫‌کیوال‬
‫س‬‫‌ا‬
‫ی‬‫ما‬ ‫در‬ ‫شده‬ ‫پشتیبانی‬ ‫‌های‬
‫ه‬‫داد‬ ‫انواع‬
•
‫عددی‬
•
‫کاراکتری‬
•
( ‫شمارشی‬
Enum
)
•
‫تاریخ‬ ‫و‬ ‫زمان‬
•
‫دودویی‬ •
:‫انگلیسی‬ ‫(به‬ ‫فضایی‬ ‫‌های‬
‫ه‬‫داد‬ ‫‌های‬
‫ع‬‫نو‬
Spatial
)
‫‌سازی‬
‫ه‬‫ذخیر‬ ‫موتورهای‬
.‫‌کنند‬
‫ی‬‫م‬ ‫عمل‬ ‫مختلف‬ ‫جدول‬ ‫‌های‬
‫ع‬‫نو‬ ‫عنوان‬ ‫به‬ ‫که‬ ‫‌کند‬
‫ی‬‫م‬ ‫پشتیبانی‬ ‫‌سازی‬
‫ه‬‫ذخیر‬ ‫موتور‬ ‫چندین‬ ‫از‬ ‫‌کیوال‬
‫س‬‫‌ا‬
‫ی‬‫ما‬
.‫هستند‬ ‫ناامن‬ ‫‌ها‬
‫ش‬‫تراکن‬ ‫برابر‬ ‫در‬ ‫دیگر‬ ‫برخی‬ ‫و‬ ،‫امن‬ ‫‌ها‬
‫ش‬‫تراکن‬ ‫برابر‬ ‫در‬ ‫‌سازی‬
‫ه‬‫ذخیر‬ ‫موتورهای‬ ‫انواع‬ ‫برخی‬
:‫است‬ ‫زیر‬ ‫موارد‬ ‫شامل‬ ‫‌کیوال‬
‫س‬‫‌ا‬
‫ی‬‫ما‬ ‫‌سازی‬
‫ه‬‫ذخیر‬ ‫موتورهای‬ ‫لیست‬
•
‫‌بی‬
‫ی‬‫اینود‬
:‫انگلیسی‬ ‫(به‬
InnoDB
‫خارجی‬ ‫کلید‬ ‫جامعیت‬ ‫قواعد‬ ‫از‬ .‫است‬ ‫‌ها‬
‫ش‬‫تراکن‬ ‫برابر‬ ‫در‬ ‫امن‬ :)
‫‌کیوال‬
‫س‬‫‌ا‬
‫ی‬‫ما‬ ‫از‬ .‫‌کند‬
‫ی‬‫م‬ ‫پشتیبانی‬
۵٫۵٫۵
.‫است‬ ‫‌کیوال‬
‫س‬‫‌ا‬
‫ی‬‫ما‬ ‫‌فرض‬
‫ش‬‫پی‬ ‫‌سازی‬
‫ه‬‫ذخیر‬ ‫موتور‬
•
‫‌سم‬
‫ی‬‫‌آ‬
‫ی‬‫ما‬
:‫انگلیسی‬ ‫(به‬
MyISAM
‫نسخه‬ ‫از‬ ‫قبل‬ :)
۵٫۵٫۵
‫‌کیوال‬
‫س‬‫‌ا‬
‫ی‬‫ما‬ ‫‌فرض‬
‫ش‬‫پی‬ ‫‌سازی‬
‫ه‬‫ذخیر‬ ‫موتور‬
.‫بود‬
•
‫حافظه‬
:‫انگلیسی‬ ‫(به‬
Memory
.‫‌کند‬
‫ی‬‫م‬ ‫نگهداری‬ ‫حافظه‬ ‫در‬ ‫سریع‬ ‫دسترسی‬ ‫منظور‬ ‫به‬ ‫را‬ ‫داده‬ ‫تمام‬ :)
•
‫ادغام‬
:‫انگلیسی‬ ‫(به‬
Merge
‫‌ها‬
‫ن‬‫آ‬ ‫به‬ ‫ارجاع‬ ‫و‬ ‫مشابه‬ ‫‌سم‬
‫ی‬‫‌آ‬
‫ی‬‫ما‬ ‫جدول‬ ‫چندین‬ ‫کردن‬ ‫‌بندی‬
‫ه‬‫گرو‬ ‫قابلیت‬ :)
.‫‌دهد‬
‫ی‬‫م‬ ‫را‬ ‫جدول‬ ‫یک‬ ‫عنوان‬ ‫به‬
•
‫آرشیو‬
:‫انگلیسی‬ ‫(به‬
Archive
.‫‌شود‬
‫ی‬‫م‬ ‫ارجاع‬ ‫‌ها‬
‫ن‬‫آ‬ ‫به‬ ‫ندرت‬ ‫به‬ ‫که‬ ‫آرشیوی‬ ‫‌های‬
‫ه‬‫داد‬ ‫نگهداری‬ ‫برای‬ :)
•
‫متحد‬
:‫انگلیسی‬ ‫(به‬
Federated
‫یک‬ ‫ایجاد‬ ‫برای‬ ‫مجزا‬ ‫‌کیوال‬
‫س‬‫‌ا‬
‫ی‬‫ما‬ ‫سرور‬ ‫چندین‬ ‫زدن‬ ‫پیوند‬ ‫برای‬ :)
.‫فیزیکی‬ ‫سرور‬ ‫چندین‬ ‫از‬ ‫منطقی‬ ‫‌داده‬
‫ه‬‫پایگا‬
•
‫‌وی‬
‫س‬‫‌ا‬
‫ی‬‫س‬
:‫انگلیسی‬ ‫(به‬
CSV
‫‌سازی‬
‫ه‬‫ذخیر‬ ‫کاما‬ ‫با‬ ‫جداشده‬ ‫مقادیر‬ ‫قالب‬ ‫با‬ ‫متنی‬ ‫‌های‬
‫ل‬‫فای‬ ‫در‬ ‫را‬ ‫داده‬ :)
.‫‌کند‬
‫ی‬‫م‬
•
‫‌چاله‬
‫ه‬‫سیا‬
:‫انگلیسی‬ ‫(به‬
Blackhole
.‫‌کند‬
‫ی‬‫نم‬ ‫ذخیره‬ ‫را‬ ‫آن‬ ‫ولی‬ ،‫‌کند‬
‫ی‬‫م‬ ‫قبول‬ ‫را‬ ‫داده‬ ‫ورودی‬ :)
‫‌شده‬
‫ه‬‫ذخیر‬ ‫‌های‬
‫ه‬‫برنام‬
.‫‌است‬
‫ه‬‫شد‬ ‫تشکیل‬ ‫‌کیوال‬
‫س‬‫ا‬ ‫عبارات‬ ‫از‬ ‫که‬ ‫است‬ ‫بدنه‬ ‫یک‬ ‫شامل‬ ‫‌شده‬
‫ه‬‫ذخیر‬ ‫برنامه‬ ‫هر‬ ‫‌کیوال‬
‫س‬‫‌ا‬
‫ی‬‫ما‬ ‫در‬
‫توسط‬ ‫شده‬ ‫(ایجاد‬ ‫باشند‬ ‫داشته‬ ‫خروجی‬ ‫مقادیر‬ ‫‌توانند‬
‫ی‬‫م‬ ‫‌شده‬
‫ه‬‫ذخیر‬ ‫‌های‬
‫ه‬‫برنام‬
CREATE PROCEDURE
‫یا‬ )
‫توسط‬ ‫شده‬ ‫(ایجاد‬ ‫باشند‬ ‫نداشته‬
CREATE FUNCTION
‫‌توان‬
‫ی‬‫م‬ ‫آن‬ ‫از‬ ،‫باشد‬ ‫داشته‬ ‫خروجی‬ ‫برنامه‬ ‫یک‬ ‫اگر‬ .)
‫‌وجوی‬
‫س‬‫پر‬ ‫در‬
SELECT
.‫کرد‬ ‫استفاده‬
:‫کرد‬ ‫اشاره‬ ‫‌توان‬
‫ی‬‫م‬ ‫زیر‬ ‫موارد‬ ‫به‬ ‫‌کیوال‬
‫س‬‫‌ا‬
‫ی‬‫ما‬ ‫سرشناس‬ ‫کاربران‬ ‫از‬
•
‫‌پدیا‬
‫ی‬‫ویک‬
•
‫‌بوک‬
‫س‬‫فی‬
•
‫لینکداین‬
•
‫نوکیا‬
•
‫دیگ‬
•
‫فلیکر‬
RDBMS Terminology
Before we proceed to explain the MySQL database system, let us revise a few definitions related to the
database.
Database − A database is a collection of tables, with related data.
Table − A table is a matrix with data. A table in a database looks like a simple spreadsheet.
Column − One column (data element) contains data of one and the same kind, for example the
column postcode.
Row − A row (= tuple, entry or record) is a group of related data, for example the data of one
subscription.
Redundancy − Storing data twice, redundantly to make the system faster.
Primary Key − A primary key is unique. A key value can not occur twice in one table. With a key,
you can only find one row.
Foreign Key − A foreign key is the linking pin between two tables.
Compound Key − A compound key (composite key) is a key that consists of multiple columns,
because one column is not sufficiently unique.
Index − An index in a database resembles an index at the back of a book.
Referential Integrity − Referential Integrity makes sure that a foreign key value always points to an
existing row.
MySQL Database
MySQL is a fast, easy-to-use RDBMS being used for many small and big businesses. MySQL is
developed, marketed and supported by MySQL AB, which is a Swedish company. MySQL is becoming
so popular because of many good reasons −
MySQL is released under an open-source license. So you have nothing to pay to use it.
MySQL is a very powerful program in its own right. It handles a large subset of the functionality of
the most expensive and powerful database packages.
MySQL uses a standard form of the well-known SQL data language.
MySQL works on many operating systems and with many languages including PHP, PERL, C, C++,
JAVA, etc.
MySQL works very quickly and works well even with large data sets.
MySQL is very friendly to PHP, the most appreciated language for web development.
MySQL supports large databases, up to 50 million rows or more in a table. The default file size limit
for a table is 4GB, but you can increase this (if your operating system can handle it) to a theoretical
limit of 8 million terabytes (TB).
MySQL is customizable. The open-source GPL license allows programmers to modify the MySQL
software to fit their own specific environments.
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
‫تفاوت‬
mysql
‫و‬
mariadb
:
Mysql
‫سال‬ ‫در‬ ‫بار‬ ‫اولین‬ ‫دیتابیس‬ ‫سرویس‬ ‫این‬ :
1995
‫های‬ ‫شرکت‬ ‫در‬ ‫زمان‬ ‫آن‬ ‫از‬ ‫که‬ ‫شد‬ ‫ساخته‬ ‫و‬ ‫منتشر‬
‫ترین‬ ‫رایج‬ ‫و‬ ‫شود‬ ‫می‬ ‫استفاده‬ ..‫و‬ ‫فلیکس‬ ‫نت‬ – ‫ناسا‬ – ‫پال‬ ‫پی‬ – ‫توییتر‬ – ‫فیسبوک‬ ‫همچون‬ ‫مشهوری‬
‫اکنون‬ ‫هم‬ ‫آن‬ ‫نسخه‬ ‫آخرین‬ ‫که‬ ‫میباشد‬ ‫حاضر‬ ‫حال‬ ‫در‬ ‫انجین‬ ‫دیتابیس‬ ‫سرویس‬
Mysql 5.7
‫سرویس‬ .‫میباشد‬
mysql
‫زبان‬ ‫به‬
C
‫و‬
C
‫های‬ ‫عامل‬ ‫سیستم‬ ‫در‬ ‫و‬ ‫است‬ ‫شده‬ ‫نویسی‬ ‫برنامه‬ ++
Microsoft Windows, OS X,
Linux, AIX, BSDi, FreeBSD, HP-UX, IRIX, NetBSD, Novell Netware
.‫شود‬ ‫می‬ ‫پشتیبانی‬ ‫بخوبی‬
MariaDB
‫بزرگی‬ ‫های‬ ‫کمپانی‬ ‫و‬ ‫ها‬ ‫شرکت‬ ‫در‬ ‫امروزه‬ ‫که‬ ‫میباشد‬ ‫دیتابیس‬ ‫برای‬ ‫تری‬ ‫بهینه‬ ‫و‬ ‫جدید‬ ‫انجین‬ :
‫سال‬ ‫در‬ ‫بار‬ ‫اولین‬ ‫و‬ ‫میشود‬ ‫استفاده‬
2008
‫بنام‬ ‫شخصی‬ ‫آن‬ ‫اصلی‬ ‫نویس‬ ‫برنامه‬ ‫و‬ .‫شد‬ ‫معرفی‬ ‫و‬ ‫آمد‬ ‫بوجود‬
Michael “Monty” Widenius
‫سرویس‬ ‫گذاران‬ ‫بنیان‬ ‫از‬ ‫خود‬ ‫که‬ ‫میباشد‬
Mysql
.‫است‬ ‫بوده‬
MariaDB
‫در‬
‫مانند‬ ‫مشهوری‬ ‫و‬ ‫بزرگ‬ ‫بسیار‬ ‫های‬ ‫شرکت‬
Google, Craigslist, Wikipedia, archlinux, RedHat, CentOS,
and Fedora
‫دی‬ ‫ماریا‬.‫باشد‬ ‫می‬ ‫طرفدار‬ ‫پر‬ ‫بسیار‬ ‫لینوکس‬ ‫عامل‬ ‫سیستم‬ ‫در‬ ‫و‬ ‫شود‬ ‫می‬ ‫استفاده‬ ‫حاضر‬ ‫حال‬ ‫در‬
‫های‬ ‫زبان‬ ‫بوسیله‬ ‫بی‬
C
‫و‬ ++
Perl
‫و‬
Bash
‫های‬ ‫عامل‬ ‫سیستم‬ ‫در‬ ‫و‬ ‫است‬ ‫شده‬ ‫نوشته‬
Microsoft Windows,
Linux, OS X, FreeBSD, OpenBSD, Solaris
‫میشود‬ ‫پشتیبانی‬ ‫بخوبی‬
‫میتوان‬ ‫اختصار‬ ‫بطور‬
MariaDB
‫یافته‬ ‫بهینه‬ ‫نسخه‬ ‫را‬
Mysql
‫و‬ ‫میباشد‬ ‫تر‬ ‫بهینه‬ ‫بسیار‬ ‫عملکرد‬ ‫در‬ ‫چون‬ ‫نامید‬
‫منابع‬ ‫اینکه‬ ‫همه‬ ‫تر‬ ‫مهم‬ ‫و‬ ‫میکند‬ ‫عمل‬ ‫سریعتر‬ ‫ها‬ ‫کوئری‬ ‫به‬ ‫پاسخگویی‬ ‫در‬ ‫و‬ ‫دارد‬ ‫بهتری‬ ‫امنیت‬ ‫همچنین‬
‫سایت‬ ‫وب‬ ‫زیادی‬ ‫تعداد‬ ‫که‬ ‫هایی‬ ‫هاستینگ‬ ‫و‬ ‫بازدید‬ ‫پر‬ ‫های‬ ‫سایت‬ ‫وب‬ ‫برای‬ ‫پس‬ ‫میکند‬ ‫مصرف‬ ‫نیز‬ ‫کمتری‬
‫روی‬ ‫با‬ ‫که‬ ‫هایی‬ ‫سایت‬ ‫معموال‬ .‫بود‬ ‫خواهد‬ ‫مطلوب‬ ‫بسیار‬ ‫میکنند‬ ‫میزبانی‬
Mysql 5.6
‫میکنند‬ ‫کار‬ ‫بخوبی‬ ‫باال‬ ‫به‬
‫با‬
Maria DB
‫به‬ ‫ارتقاء‬ ‫از‬ ‫پس‬ ‫ناسازگاری‬ ‫عدم‬ ‫مشکالت‬ ‫برای‬ ‫نگرانی‬ ‫جای‬ ‫و‬ ‫کرد‬ ‫خواهند‬ ‫کار‬ ‫بخوبی‬ ‫نیز‬
MariaDB
.‫دهید‬ ‫انجام‬ ‫اینکارو‬ ‫میتوانید‬ ‫اطمینان‬ ‫با‬ ‫و‬ ‫ندارد‬ ‫وجود‬
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
‫لینوکس‬ ‫در‬ ‫داده‬ ‫پایگاه‬ ‫انواع‬
‫سیستم‬ ‫در‬
‫معروف‬ ‫جمله‬ ‫از‬ ‫که‬ ‫دارند‬ ‫وجود‬ ‫داده‬ ‫پایگاه‬ ‫افزارهای‬ ‫نرم‬ ‫از‬ ‫مختلفی‬ ‫انواع‬ ‫لینوکس‬ ‫عامل‬
: ‫نمود‬ ‫اشاره‬ ‫زیر‬ ‫موارد‬ ‫به‬ ‫میتوان‬ ‫آنها‬ ‫ترین‬
•
mysql
•
MariaDB
•
PostgerSQL
•
MongoDB
•
Oracle
.
•
SQLit
•
ms sql
•
…
‫اوراکل‬ ‫داده‬ ‫پایگاه‬ ‫راهبر‬ ‫یک‬ ‫پایه‬ ‫وظایف‬
‫لیست‬ ‫چک‬
DBA
( ‫اوراکل‬ ‫داده‬ ‫پایگاه‬ ‫مدیر‬ ‫یک‬ ‫نقش‬
Oracle DBA
‫اوراکل‬ ‫یک‬ .‫باشد‬ ‫پیچیده‬ ‫بسیار‬ ‫‌تواند‬
‫ی‬‫م‬ )
DBA
‫به‬ ‫باید‬ ‫تنها‬ ‫نه‬
‫فضای‬ ‫مدیریت‬ ‫و‬ ‫کاربران‬ ‫مدیریت‬
Tablespace
‫و‬ ‫جداول‬ ‫و‬ ‫ها‬
View
‫و‬ ‫ها‬
Index
‫بررسی‬ ‫به‬ ‫نیاز‬ ‫بلکه‬ ‫بپردازد‬ ‫ها‬
Object
‫قبیل‬ ‫از‬ ‫داده‬ ‫پایگاه‬ ‫داخلی‬ ‫های‬
Trigger
‫و‬ ‫ها‬
Procedure
‫و‬ ‫ها‬
Function
‫آن‬ ‫همراه‬ ‫‌های‬
‫ه‬‫بست‬ ‫و‬ ‫ها‬
‫نیز‬ ‫ها‬
.‫دارد‬
.‫است‬ ‫برخوردار‬ ‫خاصی‬ ‫اهمیت‬ ‫از‬ ‫نیز‬ ‫داده‬ ‫پایگاه‬ ‫تحوالت‬ ‫و‬ ‫تغییر‬ ‫جاری‬ ‫روند‬ ‫بررسی‬ ‫این‬ ‫بر‬ ‫عالوه‬
.‫پذیرند‬ ‫صورت‬ ‫باید‬ ‫روزمره‬ ‫های‬ ‫فعالیت‬ ‫از‬ ‫انبوهی‬ ‫روزانه‬ ‫وظایف‬ ‫شرح‬ ‫عنوان‬ ‫به‬
‫آنان‬ ‫از‬ ‫برخی‬ ‫حتی‬ ‫که‬ ‫داده‬ ‫پایگاه‬ ‫نگهداشت‬ ‫و‬ ‫مدیریت‬ ‫خودکار‬ ‫ابزارهای‬ ‫وجود‬ ‫از‬ ‫سال‬ ‫چندین‬ ‫گذشت‬ ‫وجود‬ ‫با‬
‫این‬ ‫در‬ ‫هنوز‬ ‫‌اند‬
‫ه‬‫شد‬ ‫عرضه‬ ‫جانبی‬ ‫کنندگان‬ ‫تولید‬ ‫طریق‬ ‫از‬ ‫نیز‬ ‫دیگر‬ ‫برخی‬ ‫و‬ ‫دارند‬ ‫وجود‬ ‫نیز‬ ‫اوراکل‬ ‫خود‬ ‫در‬ ‫نیز‬
‫یک‬ ‫که‬ ‫است‬ ‫شرایط‬ ‫این‬ ‫در‬ ‫و‬ ‫است‬ ‫نشده‬ ‫معرفی‬ ‫خصوص‬ ‫این‬ ‫در‬ ‫جامعی‬ ‫ابزار‬ ‫نوپا‬ ‫بسیار‬ ‫بازار‬
DBA
‫به‬ ‫مبرم‬ ‫نیاز‬
.‫نمود‬ ‫خواهد‬ ‫احساس‬ ‫شدت‬ ‫به‬ ‫را‬ ‫خویش‬ ‫فعالیت‬ ‫حوزه‬ ‫وظایف‬ ‫از‬ ‫مشروح‬ ‫لیست‬ ‫یک‬ ‫تهیه‬
‫خواهند‬ ‫وجود‬ ‫نیز‬ ‫دیگری‬ ‫ضروری‬ ‫های‬ ‫فعالیت‬ ‫قطعا‬ ‫و‬ ‫پرداخت‬ ‫خواهیم‬ ‫بحث‬ ‫به‬ ‫مذکور‬ ‫لیست‬ ‫خصوص‬ ‫در‬
‫هر‬ ‫و‬ ‫نیامده‬ ‫بحث‬ ‫این‬ ‫در‬ ‫که‬ ‫داشت‬
DBA
‫تهیه‬ ‫را‬ ‫خویش‬ ‫عملیاتی‬ ‫حوزه‬ ‫نیازهای‬ ‫با‬ ‫مطابق‬ ‫لیستی‬ ‫باید‬ ْ‫شخصا‬
.‫نماید‬
‫بازگردانی‬ ‫و‬ ‫‌گیری‬
‫ن‬‫پشتیبا‬
‫یک‬
DBA
‫خوانایی‬ ‫وضعیت‬ ‫و‬ ‫صحت‬ ‫از‬ ‫ولی‬ ‫‌نماید‬
‫ی‬‫م‬ ‫پشتیبان‬ ‫تهیه‬ ‫به‬ ‫اقدام‬ ‫قطعا‬
Tape
‫خود‬ ‫پشتیبان‬
‫فرآیند‬ ‫چرخه‬ ‫خصوص‬ ‫در‬ ‫دارد؟‬ ‫اطمینان‬
Tape
‫نیاز‬ ‫مورد‬ ‫مواقع‬ ‫در‬ ‫آن‬ ‫عملکرد‬ ‫صحت‬ ‫از‬ ‫کامل‬ ‫اطمینان‬ ‫و‬
‫است؟‬ ‫چگونه‬ ‫وضعیت‬
‫همچنین‬
Control file
‫که‬ ‫زمانی‬ .‫نکنید‬ ‫فراموش‬ ‫را‬ ‫ها‬
Instance
‫را‬
Shutdown
‫اجرای‬ ‫از‬ ‫پس‬ ‫و‬ ‫‌نمایید‬
‫ی‬‫م‬
BACKUP CONTROL FILES TO TRACE
‫فایل‬
Trace
‫در‬ ‫پشتیبان‬ ‫انجام‬ ‫از‬ ‫قبل‬ ‫و‬ ‫یافته‬ ‫را‬
Tape
‫به‬ ‫نسبت‬
.‫نمایید‬ ‫اقدام‬ ‫آن‬ ‫انتقال‬ ‫و‬ ‫تغییرنام‬
‫از‬ ‫‌گیری‬
‫ن‬‫پشتیبا‬ ‫خصوص‬ ‫در‬ ‫همچنین‬
init.ora
‫نظیر‬ ‫داده‬ ‫پایگاه‬ ‫اساسی‬ ‫‌های‬
‫ل‬‫فای‬ ‫دیگر‬ ‫و‬
listener.ora
‫و‬
login.sql
.‫شود‬ ‫الزم‬ ‫توجه‬ ‫باید‬
Shutdown/Restart
‫به‬ ‫اقدام‬ ‫‌ای‬
‫ه‬‫دور‬ ‫صورت‬ ‫به‬ ‫که‬ ‫فرض‬ ‫این‬ ‫با‬
Shutdown
‫و‬
Restart
‫پاکسازی‬ ‫موجب‬ ‫عمل‬ ‫این‬ ،‫شود‬ ‫داده‬ ‫پایگاه‬
‫مسیر‬
Trace file
‫یک‬ ‫ایجاد‬ ‫و‬
Error log
.‫‌شود‬
‫ی‬‫م‬ ‫جدید‬
‫از‬ ‫پس‬
Restart
‫یک‬
Instance
‫یک‬ ‫که‬ ‫کنید‬ ‫دقت‬
Data cache
‫برخی‬ ‫‌توانید‬
‫ی‬‫م‬ ‫لذا‬ ،‫داشت‬ ‫خواهید‬ ‫خالی‬
Package
‫و‬ ‫ها‬
Procedure
‫حافظه‬ ‫در‬ ‫را‬ ‫ها‬
Pin
‫صورت‬ ‫این‬ ‫در‬ ‫نمایید‬
Package header
‫حافظه‬ ‫در‬ ‫ها‬
Cache
‫برخی‬ ‫اجرای‬ ‫به‬ ‫نیاز‬ ‫شاید‬ ‫حال‬ ‫این‬ ‫با‬ .‫شد‬ ‫خواهند‬ ‫بارگذاری‬ ‫سیستم‬
Procedure
‫از‬ ‫قبل‬ ‫ها‬
Package body
‫ها‬
‫تمامی‬ ‫منظور‬ ‫این‬ ‫به‬ ،‫باشد‬
Package
‫مقدار‬ ‫با‬ ‫تنها‬ ‫را‬ ‫ها‬
Null
‫از‬ ‫پس‬ ‫اجرا‬ ‫برای‬ ‫‌ها‬
‫ن‬‫آ‬ ‫نمودن‬ ‫فعال‬ ‫جهت‬ ‫تنها‬
Startup
‫و‬ ‫سیستم‬
Pin
.‫کنید‬ ‫اجرا‬ ‫حافظه‬ ‫در‬ ‫‌ها‬
‫ن‬‫آ‬ ‫نمودن‬
‫مدیریت‬
Tablespace
‫روی‬ ‫اصلی‬ ‫اطالعات‬
Tablespace
‫سیستمی‬ ‫جداول‬ ‫وسیله‬ ‫به‬ ‫ها‬
DBA_TABLESPACES، DBA_DATA_FILES
‫و‬
V$FATAFILE
.‫‌شود‬
‫ی‬‫م‬ ‫نگهداری‬
‫وضعیت‬ ‫بررسی‬ ‫برای‬
Tablespace
‫درخواست‬ ‫سیستم‬ ‫در‬
DBA_FREE_SPACE
.‫شود‬ ‫اجرا‬
‫هر‬ ‫باقیمانده‬ ‫میزان‬ ‫درصد‬
Tablespace
.‫شود‬ ‫بررسی‬
‫هر‬ ‫از‬ ‫باقیمانده‬ ‫فضای‬ ‫میزان‬
Tablespace
‫درخواست‬ ‫با‬
DBA_EXTENTS
.‫شود‬ ‫بررسی‬
‫دستور‬ .‫‌ها‬
‫ه‬‫داد‬ ‫انتخاب‬ ‫بازه‬ ‫در‬ ‫مربوطه‬ ‫اثر‬ ‫و‬ ‫‌ها‬
‫ه‬‫داد‬ ‫‌ای‬
‫ه‬‫زنجیر‬ ‫سطرهای‬ ‫بررسی‬
ANALYZE TABLE
‫جدول‬ ‫نام‬
LIST CHAINED ROWS
‫جدول‬ ‫به‬ ‫را‬ ‫دیتا‬ ،
CHAINED_ROWS
‫توجه‬ ‫کار‬ ‫این‬ ‫انجام‬ ‫از‬ ‫قبل‬ ‫ولی‬ ‫‌نماید‬
‫ی‬‫م‬ ‫اضافه‬
‫ابتدا‬ ‫که‬ ‫باشید‬ ‫داشته‬
UTLCHAIN.SQL
.‫شود‬ ‫اجرا‬
‫موقت‬ ‫جدول‬ ‫یک‬ ‫کمک‬ ‫با‬ ‫سطر‬ ‫مجدد‬ ‫ورود‬ ‫و‬ ‫حذف‬ ‫به‬ ‫نسبت‬ ‫باید‬ ،‫شد‬ ‫پیدا‬ ‫‌ای‬
‫ه‬‫زنجیر‬ ‫سطر‬ ‫یک‬ ‫که‬ ‫هنگامی‬
‫که‬ ‫شود‬ ‫توجه‬ ،‫داده‬ ‫پایگاه‬ ‫‌اندازی‬
‫ه‬‫را‬ ‫و‬ ‫طراحی‬ ‫زمان‬ ‫در‬ .‫شود‬ ‫اقدام‬
Tablespace
‫و‬
Rollback segment
‫تنها‬ ‫ها‬
.‫باشند‬ ‫جداول‬ ‫از‬ ‫نوع‬ ‫یک‬ ‫شامل‬
Redo Logs
‫مدیریت‬ ‫و‬ ‫کنترل‬
Redo log
.‫شود‬ ‫سپرده‬ ‫فراموشی‬ ‫به‬ ‫نباید‬ ‫ولی‬ ‫است‬ ‫آسان‬ ‫بسیار‬ ‫ها‬
‫درخواست‬ ‫با‬
V$LOGFILE
‫و‬
V$LOG
‫و‬ ‫جاری‬ ‫وضعیت‬
Online
‫تمام‬ ‫بودن‬
Log
.‫شوند‬ ‫بررسی‬ ‫‌ها‬
‫ه‬‫گرو‬ ‫و‬ ‫ها‬
Rollback Segments
‫از‬ ‫معروفی‬ ‫جمله‬
Kevin Loney
‫مدیریت‬ .‫دارد‬ ‫وجود‬ ‫مورد‬ ‫این‬ ‫در‬ ”‫خانواده‬ ‫ناخلف‬ ‫“فرزند‬
Rollback
Segment
.‫شود‬ ‫پرداخته‬ ‫آن‬ ‫به‬ ‫جداگانه‬ ‫مقاله‬ ‫دریک‬ ‫باید‬ ‫که‬ ‫است‬ ‫مبحثی‬ ‫ها‬
‫یک‬ ‫که‬ ‫باشید‬ ‫داشته‬ ‫یاد‬ ‫به‬
Instance
‫ایجاد‬ ‫برای‬
Rollback
‫پارامترهای‬ ‫اساس‬ ‫بر‬ ‫نیاز‬ ‫مورد‬ ‫تعداد‬ ‫به‬
init.ora
‫و‬
TRANSACTIONS
‫بر‬ ‫تقسیم‬
TRANSACTIONS_PER_ROLLBACK_SEGMENT
.‫نمود‬ ‫خواهد‬ ‫اقدام‬
‫بیشتر‬ ‫تعدادی‬ ‫یا‬ ‫یک‬ ‫باید‬ ‫داده‬ ‫پایگاه‬ ‫هر‬ ‫شرایط‬ ‫بهترین‬ ‫در‬
Tablespace
‫برای‬ ‫تنها‬
Rollback segment
‫ها‬
‫این‬ ‫در‬ ‫اندازه‬ ‫از‬ ‫بیش‬ ‫انتشار‬ ‫و‬ ‫رشد‬ ،‫باشد‬ ‫داشته‬
Tablespace
‫طبیعی‬ ‫غیر‬ ‫بالاستفاده‬ ‫فضای‬ ‫ایجاد‬ ‫موجب‬ ‫ها‬
.‫‌شود‬
‫ی‬‫م‬
DBA
‫منظور‬ ‫به‬
Offline
‫یا‬
Online
‫دستور‬ ‫از‬ ‫استفاده‬ ‫به‬ ‫نیاز‬ ‫‌ساز‬
‫ه‬‫ذخیر‬ ‫در‬ ‫تغییر‬ ‫یا‬ ‫و‬
ALTER ROLLBACK
SEGMENT
.‫دارد‬
‫سیستمی‬ ‫جدول‬
DBA_ROLLBACK_SEGS
‫‌های‬
‫ت‬‫سگمن‬
Rollback
‫به‬ ‫را‬
Tablespace
‫دارد‬ ‫وجود‬ ‫آن‬ ‫در‬ ‫که‬
.‫‌سازد‬
‫ی‬‫م‬ ‫مرتبط‬
‫مدیریت‬
Table
‫تمام‬ ‫اینکه‬ ‫از‬ ‫سریع‬ ‫سنجی‬ ‫صحت‬ ‫و‬ ‫بررسی‬
Index
‫خود‬ ‫مناسب‬ ‫محل‬ ‫در‬ ‫دارد‬ ‫نیاز‬ ‫‌ها‬
‫ن‬‫آ‬ ‫به‬ ‫که‬ ‫جدولی‬ ‫هر‬ ‫برای‬ ‫ها‬
.‫است‬ ‫مفیدی‬ ‫فرآیند‬ ،‫دارند‬ ‫قرار‬ ‫مناسبی‬ ‫وضعیت‬ ‫در‬ ْ‫کامال‬ ‫و‬ ‫دارد‬ ‫قرار‬
‫تمامی‬ ‫بازسازی‬
Index
“ ‫ساختار‬ ‫‌شود‬
‫ی‬‫م‬ ‫‌بینی‬
‫ش‬‫پی‬ ‫که‬ ‫جداولی‬ ‫برای‬ ‫ها‬
btree
“ ‫به‬ ‫‌ها‬
‫ن‬‫آ‬ ”
skewed
‫همراه‬ ‫به‬ ”
‫جدول‬ .‫‌گردد‬
‫ی‬‫م‬ ‫پیشنهاد‬ ،‫شود‬ ‫تبدیل‬ ‫حذف‬ ‫و‬ ‫اضافه‬ ‫جدول‬ ‫زیادی‬ ‫تعداد‬
SYS.DBA_INDEXES
‫اطالعاتی‬ ‫شامل‬
‫و‬ ‫جدول‬ ‫هر‬ ‫خصوص‬ ‫در‬
Index
‫به‬ ‫بیشتری‬ ‫میزان‬ ‫نیاز‬ ‫درصورت‬ .‫است‬ ‫غیره‬ ‫و‬ ‫رشد‬ ‫میزان‬ ‫و‬ ‫حجم‬ ‫قبیل‬ ‫از‬ ‫ها‬
.‫دهید‬ ‫اختصاص‬ ‫‌توان‬
‫ی‬‫م‬ ‫آینده‬ ‫در‬ ‫رشد‬ ‫منظور‬
‫‌سازی‬
‫ه‬‫بهین‬ ‫اطالعات‬ ‫و‬ ‫آمار‬
‫قابل‬ ‫رشد‬ ‫دارای‬ ‫که‬ ‫جداولی‬ ‫روی‬ ‫بر‬ ،‫‌کنید‬
‫ی‬‫م‬ ‫استفاده‬ ‫محور‬ ‫هزینه‬ ‫‌سازی‬
‫ه‬‫بهین‬ ‫روش‬ ‫از‬ ‫شما‬ ‫اینکه‬ ‫فرض‬ ‫با‬
‫دستور‬ ‫هستند‬ ‫‌ای‬
‫ه‬‫مالحظ‬
ANALYZE TABLE COMPUTE STATISTICS
‫و‬ ‫الزم‬ ‫اعمال‬ ‫این‬ .‫کنید‬ ‫اجرا‬ ‫را‬
‫پرکاربرد‬ ‫جداول‬ ‫از‬ ‫شناختی‬ ‫باشید‬ ‫نداشته‬ ‫دست‬ ‫در‬ ‫اطمینانی‬ ‫قابل‬ ‫آمار‬ ‫شما‬ ‫که‬ ‫زمانی‬ ‫تا‬ ‫لذا‬ ‫یکدیگرند‬ ‫ملزوم‬
‫قرار‬ ‫شما‬ ‫اختیار‬ ‫در‬ ‫مناسبی‬ ‫اطالعات‬ ‫سامانه‬ ‫تجاری‬ ‫کاربری‬ ‫از‬ ‫کافی‬ ‫دانش‬ ‫شرایط‬ ‫این‬ ‫در‬ ،‫داشت‬ ‫نخواهیم‬
.‫داد‬ ‫خواهد‬
‫پردازشی‬ ‫بار‬ ،‫داده‬ ‫پایگاه‬ ‫بزرگ‬ ‫جداول‬ ‫در‬
COMPUTE STATISTICS
‫بررسی‬ ‫شامل‬ ‫که‬ ،‫بود‬ ‫خواهد‬ ‫باال‬ ‫مقداری‬
‫یک‬ ‫ساخت‬ ‫میزان‬ ‫به‬ ‫‌رود‬
‫ی‬‫م‬ ‫انتظار‬ ‫و‬ ‫است‬ ‫جدول‬ ‫کامل‬
Index
‫مقدار‬ ‫به‬ ‫همچنین‬ ‫و‬ ‫انجامد‬ ‫طول‬ ‫به‬ ‫کامل‬
‫بخش‬ ‫فضای‬ ‫از‬ ‫باالیی‬
Temporary
)‫جدول‬ ‫‌های‬
‫ن‬‫ستو‬ ‫میزان‬ ‫به‬ ‫(حداقل‬ ‫دارد‬ ‫نیاز‬
‫با‬ ‫که‬ ‫جداولی‬ ‫بین‬ ‫پردازشی‬ ‫بار‬ ‫منظور‬ ‫این‬ ‫به‬
COMPUTE
‫با‬ ‫که‬ ‫جداولی‬ ‫و‬ ‫است‬ ‫شده‬ ‫تحلیل‬
ESTIMATE
‫به‬
‫فرض‬ ‫پیش‬ ‫طور‬ ‫به‬ .‫‌شود‬
‫ی‬‫م‬ ‫تقسیم‬ ‫متناسب‬ ‫طور‬
ESTIMATE
‫تنها‬
۱۰۶۴
‫که‬ ‫خواند‬ ‫خواهد‬ ‫را‬ ‫ابتدایی‬ ‫سطر‬
.‫دارد‬ ‫وجود‬ ‫نیز‬ ‫آزمایشی‬ ‫حجم‬ ‫تعریف‬ ‫امکان‬ ‫البته‬ ‫خیر‬ ‫یا‬ ‫باشد‬ ‫شما‬ ‫‌های‬
‫ه‬‫داد‬ ‫گویای‬ ‫شاید‬
‫منطقی‬ ‫صحت‬
‫مستندات‬ ‫توسط‬ ‫‌ها‬
‫ت‬‫سای‬ ‫برخی‬ ‫در‬ ‫که‬ ‫دارد‬ ‫وجود‬ ‫بررسی‬ ‫جهت‬ ‫متعددی‬ ‫مناطق‬
DBA
‫نقاط‬ ‫این‬ ‫بررسی‬ ‫به‬
‫بدون‬ ‫درخواست‬ ‫هر‬ ‫از‬ ‫گیری‬ ‫گزارش‬ ،‫موجود‬ ‫فرزندی‬-‫والد‬ ‫ارتباطات‬ ‫نظیر‬ ‫‌شود‬
‫ی‬‫م‬ ‫پرداخته‬
Header
‫این‬ ‫البته‬ ،
‫وظایف‬ ‫از‬ ‫فعالیت‬
DBA
‫دهد؟‬ ‫انجام‬ ‫‌تواند‬
‫ی‬‫م‬ ‫فردی‬ ‫چه‬ ‫ولی‬ ‫نیست‬
‫وسیله‬ ‫به‬ ‫‌تواند‬
‫ی‬‫م‬ ‫فعالیت‬ ‫این‬
Trigger
.‫شود‬ ‫انجام‬ ‫سامانه‬ ‫در‬ ‫شده‬ ‫تعریف‬ ‫های‬
‫صحت‬
Object
‫داده‬ ‫پایگاه‬ ‫های‬
‫تمام‬ ‫نام‬ ‫روی‬ ‫مختصر‬ ‫گزارش‬
Package
‫و‬ ‫ها‬
Procedure
‫و‬ ‫ها‬
Function
‫دو‬ ‫یا‬ ‫یک‬ ‫که‬ ‫شرایطی‬ ‫در‬ ،‫ها‬
Object
‫جهت‬ ‫یا‬ ‫و‬ ‫یافته‬ ‫تغییر‬ ‫شخصی‬ ‫توسط‬
Re-Compilation
.‫‌اند‬
‫ه‬‫شد‬ ‫انتخاب‬
‫جدول‬
SYS.DBA_SOURCE
‫نگهداری‬ ‫منظور‬ ‫به‬
Object
‫مانند‬ ‫داده‬ ‫پایگاه‬ ‫داخلی‬ ‫های‬
Package
‫و‬ ‫ها‬
Package body
‫و‬ ‫ها‬
Procedure
‫مالک‬ ‫توسط‬ ‫غیره‬ ‫و‬ ‫ها‬
Schema
.‫‌شود‬
‫ی‬‫م‬ ‫مدیریت‬
‫امنیت‬
Role
‫کاربر‬ ‫و‬
‫در‬ ‫کاربران‬ ‫اطالعات‬ ‫بر‬ ‫مختصر‬ ‫بررسی‬ ‫یک‬
SYS.DBA_USERS
‫صحت‬ ‫از‬ ‫اطمینان‬ ‫برای‬
Tablespace
‫های‬
‫(از‬ ‫موقتی‬ ‫و‬ ‫‌فرض‬
‫ش‬‫پی‬
Tablespace
‫عنوان‬ ‫به‬ ‫سیستم‬
Tablespace
)‫نشود‬ ‫استفاده‬ ‫کاربری‬ ‫هیچ‬ ‫‌فرض‬
‫ش‬‫پی‬
‫جدول‬ ‫در‬ ‫کاربر‬ ‫هر‬ ‫‌های‬
‫ی‬‫دسترس‬
DBA_SYS_PRIVS
.‫است‬ ‫شده‬ ‫ذخیره‬
‫از‬ ‫اگر‬
Role
‫در‬ ،‫‌شود‬
‫ی‬‫م‬ ‫استفاده‬ ‫پروفایلی‬ ‫یا‬
SYS.DBA_ROLES
‫و‬
DBA_ROLE_PRIVS
‫و‬
DBA_PROFILES
.‫بیابید‬ ‫را‬ ‫آنها‬ ‫‌توانید‬
‫ی‬‫م‬
‫بررسی‬ ‫به‬ ‫نیاز‬ ‫است‬ ‫شده‬ ‫تعریف‬ ‫‌ها‬
‫ن‬‫ستو‬ ‫یا‬ ‫جدول‬ ‫سطح‬ ‫در‬ ‫خاصی‬ ‫امنیت‬ ‫که‬ ‫صورتی‬ ‫در‬
DBA_COL_PRIVS،
DBA_COL_PRIVS_MADE، DBA_COL_PRIVS_RECD
.‫دارد‬ ‫وجود‬
‫از‬ ‫کاربر‬ ‫یک‬ ‫سهم‬ ‫‌توانید‬
‫ی‬‫م‬ ‫راحتی‬ ‫به‬ ‫که‬ ‫باشید‬ ‫داشته‬ ‫توجه‬
Tablespace
‫ایجاد‬ ‫از‬ ‫جلوگیری‬ ‫منظور‬ ‫به‬ ‫را‬
Object
.‫دهید‬ ‫قرار‬ ‫صفر‬ ‫برابر‬
‫ظرفیت‬ ‫‌ریزی‬
‫ه‬‫برنام‬
‫حداکثر‬ ‫میزان‬ ‫به‬ ‫‌توان‬
‫ی‬‫م‬ ‫مستندات‬ ‫این‬ ‫بررسی‬ ‫با‬ ‫و‬ ‫است‬ ‫شده‬ ‫ثبت‬ ‫سایت‬ ‫استاندارد‬ ‫مستندات‬ ‫در‬ ‫مورد‬ ‫این‬
‫فضای‬
Tablespace
.‫‌برد‬
‫ی‬‫پ‬ ‫غیره‬ ‫و‬
‫جداول‬ ‫قبیل‬ ‫این‬ ‫افزایش‬ ‫نرخ‬ ‫الگوی‬ ‫یک‬ ‫تشکیل‬ ‫به‬ ‫اصلی‬ ‫جداول‬ ‫کلی‬ ‫حجم‬ ‫آوردن‬ ‫دست‬ ‫به‬ ‫مدت‬ ‫بلند‬ ‫در‬ ‫شاید‬
‫برخی‬ .‫کند‬ ‫کمک‬
DBA
‫در‬ ‫را‬ ‫نتایج‬ ‫این‬ ،‫ظرفیت‬ ‫‌ریزی‬
‫ه‬‫برنام‬ ‫برای‬ ‫بررسی‬ ‫منظور‬ ‫به‬ ‫ها‬
DBA Schema
‫قرار‬
.‫‌دهند‬
‫ی‬‫م‬
‫آخرین‬ ‫اجرای‬ ‫لحظه‬ ‫تا‬ ‫ارقام‬ ‫و‬ ‫آمار‬ ‫این‬ ‫که‬ ‫نکنید‬ ‫فراموش‬
ANALYZE TABLE COMPUTE STATISTICS
‫‌روز‬
‫ه‬‫ب‬
.‫‌باشد‬
‫ی‬‫م‬
‫برای‬ ‫بلکه‬ ‫نیست‬ ‫جداول‬ ‫نیاز‬ ‫مورد‬ ‫میزان‬ ‫جانب‬ ‫از‬ ‫تنها‬ ‫ظرفیت‬ ‫‌ریزی‬
‫ه‬‫برنام‬ ‫دیگر‬ ‫جنبه‬
Rollback segment
‫و‬ ‫ها‬
Temporary segment
.‫‌شود‬
‫ی‬‫م‬ ‫استفاده‬ ‫نیز‬ ‫دارند‬ ‫داده‬ ‫پایگاه‬ ‫مانند‬ ‫ظرفیت‬ ‫افزایش‬ ‫به‬ ‫نیاز‬ ‫که‬ ‫ها‬
‫برای‬ ‫است‬ ‫ممکن‬ ‫نیز‬ ‫اضافی‬ ‫‌های‬
‫ل‬‫دیتافای‬
Rollback segment
‫و‬ ‫ها‬
Temporary segment
‫نیاز‬ ‫جدید‬ ‫ها‬
.‫باشد‬
‫برخی‬
DBA
‫تعداد‬ ‫نمودن‬ ‫اضافه‬ ‫سیاست‬ ‫ها‬
Redo log file groups
‫کاربران‬ ‫تعداد‬ ‫اساس‬ ‫بر‬ ‫ها‬
Online
.‫دارند‬
‫اقدامات‬ ‫آخرین‬
.‫دارد‬ ‫وجود‬ ‫انجام‬ ‫برای‬ ‫مواردی‬ ‫همیشه‬
‫تمام‬ ‫وضعیت‬ ‫بررسی‬ ‫مانند‬
Tablespace
‫و‬ ‫ها‬
Rollback segment
‫وضعیت‬ ‫در‬ ‫که‬ ‫ها‬
Online
.‫باشند‬
‫اینکه‬ ‫و‬
SQL*Net listener
.‫باشد‬ ‫فعالیت‬ ‫حال‬ ‫در‬
.‫باشد‬ ‫راهگشا‬ ‫بسیار‬ ‫‌تواند‬
‫ی‬‫م‬ ‫موارد‬ ‫این‬ ‫بررسی‬ ‫خصوص‬ ‫در‬ ‫مختصر‬ ‫مستند‬ ‫یک‬ ‫بنابراین‬
‫‌بندی‬
‫ع‬‫جم‬
‫و‬ ‫باشد‬ ‫لیست‬ ‫چک‬ ‫مختصر‬ ‫‌های‬
‫م‬‫آیت‬ ‫یکسری‬ ‫عنوان‬ ‫به‬ ‫تنها‬ ‫‌تواند‬
‫ی‬‫م‬ ‫موارد‬ ‫این‬ ،‫شد‬ ‫اشاره‬ ‫ابتدا‬ ‫در‬ ‫که‬ ‫همانطور‬
‫هر‬
DBA
.‫نماید‬ ‫تهیه‬ ‫را‬ ‫خود‬ ‫تجربه‬ ‫اساس‬ ‫بر‬ ‫متناسب‬ ‫لیست‬ ‫باید‬
‫دیگران‬ ‫برای‬ ‫‌تواند‬
‫ی‬‫م‬ ‫نظر‬ ‫به‬ ‫و‬ ‫داشته‬ ‫را‬ ‫کاربرد‬ ‫بیشترین‬ ْ‫شخصا‬ ‫که‬ ‫است‬ ‫شده‬ ‫ذکر‬ ‫دلیل‬ ‫این‬ ‫به‬ ‫تنها‬ ‫موارد‬ ‫این‬
.‫باشد‬ ‫مفید‬ ‫نیز‬
‫نصب‬ ‫جهت‬ ‫را‬ ‫زیر‬ ‫مراحل‬
MySQL
‫نمایید‬ ‫پیگیری‬ ‫ترتیب‬ ‫به‬
:
1
.
‫دریافت‬
MySQL Yum Repository
# wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
--------------- On RHEL/CentOS 6 ---------------
# wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
--------------- On RHEL/CentOS 5 ---------------
# wget http://dev.mysql.com/get/mysql57-community-release-el5-7.noarch.rpm
--------------- On Fedora 23 ---------------
# wget http://dev.mysql.com/get/mysql57-community-release-fc23-7.noarch.rpm
--------------- On Fedora 22 ---------------
# wget http://dev.mysql.com/get/mysql57-community-release-fc22-7.noarch.rpm
--------------- On Fedora 21 ---------------
# wget http://dev.mysql.com/get/mysql57-community-release-fc21-7.noarch.rpm
# yum install mysql-community-server
# dnf install mysql-community-server
.
Start
‫سرور‬ ‫کردن‬
MySQL
‫آمیز‬ ‫موفقیت‬ ‫نصب‬ ‫از‬ ‫بعد‬
MySQL
‫سرور‬ ‫که‬ ‫رسیده‬ ‫آن‬ ‫زمان‬ ،
MySQL
‫زیر‬ ‫دستور‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫را‬
Start
‫کنیم‬
.
#service mysql start or systemctl start mariadb
‫ورژن‬ ‫به‬ ‫توان‬ ‫می‬ ‫زیر‬ ‫دستور‬ ‫با‬
mysql
: ‫برد‬ ‫پی‬
‫امن‬ ‫نصب‬
MySQL
‫دستور‬
mysql_secure_installation
‫نصب‬ ‫که‬ ‫میدهد‬ ‫اجازه‬ ‫شما‬ ‫به‬
MySQL
‫بوسیله‬ ‫ایمن‬ ‫بصورت‬ ‫را‬ ‫خود‬
‫جمله‬ ‫از‬ ‫مهمی‬ ‫تنظیمات‬ ‫انجام‬
:
root password
‫کاربران‬ ‫حذف‬ ،
anonymous
‫حذف‬ ،
rootlogin
‫و‬
...
‫انجام‬
‫دهید‬
.
‫نکته‬
:
MySQL
‫نسخه‬
5.7
‫مسیر‬ ‫در‬ ‫موقتی‬ ‫رندم‬ ‫عبور‬ ‫کلمه‬ ‫یک‬ ‫بعدی‬ ‫های‬ ‫نسخه‬ ‫و‬
/
var.log/mysqld.log
‫امن‬ ‫اجرای‬ ‫از‬ ‫قبل‬ ‫را‬ ‫عبور‬ ‫کلمه‬ ‫زیر‬ ‫دستور‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫میتوانید‬ ‫که‬ ‫میکنند‬ ‫تولید‬
MySQL
‫نمایید‬ ‫مشاهده‬
.
# grep 'temporary password' /var/log/mysqld.log
‫نصب‬ ‫زیر‬ ‫دستور‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫توانید‬ ‫می‬ ،‫میدانید‬ ‫را‬ ‫عبور‬ ‫کلمه‬ ‫که‬ ‫حال‬
MySQL
‫انجام‬ ‫امن‬ ‫بصورت‬ ‫را‬ ‫خود‬
‫دهید‬
:
# mysql_secure_installation
‫نکته‬
:
‫جدید‬ ‫عبور‬ ‫کلمه‬ ‫کردن‬ ‫وارد‬
Root
‫فایل‬ ‫از‬ ‫شما‬ ‫موقتی‬ ‫عبور‬ ‫کلمه‬ ‫که‬ ‫معناست‬ ‫این‬ ‫به‬
/
var/log/mysqld.log
‫میباشد‬
.
مرجع oracle mysql |mariadb
‫عبور‬ ‫کلمه‬ ‫و‬ ‫کاربر‬ ‫ایجاد‬
‫در‬
‫داده‬ ‫پایگاه‬
MySQL
‫نام‬ ‫به‬ ‫مدیر‬ ‫کاربر‬ ‫یک‬ ‫دارای‬
root
‫است‬
.
‫برای‬ ‫عبوری‬ ‫کلمه‬ ‫زیر‬ ‫دستور‬ ‫با‬ ‫باید‬
root
‫تعیین‬
‫کنیم‬
.
‫مدیریتی‬ ‫ابزار‬ ‫از‬ ‫کار‬ ‫این‬ ‫برای‬
mysqladmin
‫میکنیم‬ ‫استفاده‬
.
‫به‬ ‫که‬ ‫است‬ ‫مدیریتی‬ ‫دستور‬ ‫یک‬ ،‫ابزار‬ ‫این‬
‫بسته‬ ‫همراه‬
mysql
‫میشود‬ ‫نصب‬
.
‫سوئیچ‬ ‫زیر‬ ‫خط‬ ‫در‬
-
u
‫کننده‬ ‫تعیین‬
Username
‫سوئیچ‬ ‫و‬
password
‫تعیین‬
‫کننده‬
Password
‫است‬ ‫کاربر‬ ‫برای‬ ‫عبور‬ ‫کلمه‬ ‫یا‬
.
‫است‬ ‫زیر‬ ‫بصورت‬ ‫کاربر‬ ‫یک‬ ‫برای‬ ‫پسورد‬ ‫تعیین‬ ‫کلی‬ ‫شکل‬
# mysqladmin -u < Username > password < Your – Password >
‫کاربر‬ ‫پسورد‬ ‫تعیین‬ ‫برای‬ ‫مثال‬ ‫بطور‬
root
‫کلمه‬ ‫را‬ ‫کاربر‬ ‫پسورد‬ ‫که‬ ‫مینویسیم‬ ‫را‬ ‫زیر‬ ‫خط‬
P@ssw0rd
‫کاربر‬ ‫پس‬ ‫این‬ ‫از‬ ‫و‬ ‫میکند‬ ‫تعیین‬
root
‫وارد‬ ‫میتواند‬ ‫کلمه‬ ‫این‬ ‫با‬
MySQL
‫شود‬
# mysqladmin -u root password P@ssw0rd
‫به‬ ‫اتصال‬
MySQL Server
‫فرمان‬ ‫خط‬ ‫محیط‬ ‫وارد‬ ‫چگونه‬
MySQL
‫شویم؟‬
‫شویم‬ ‫سیستم‬ ‫وارد‬ ‫میتوانیم‬ ،‫پسوردش‬ ‫و‬ ‫کاربر‬ ‫هر‬ ‫ایجاد‬ ‫از‬ ‫پس‬
.
‫محیط‬ ‫به‬ ‫ورود‬ ‫برای‬
MySQL
‫محیط‬ ‫این‬ ‫در‬ ‫که‬
‫و‬ ‫کاربران‬ ‫به‬ ‫مجوزها‬ ‫اعطای‬ ‫و‬ ‫کاربران‬ ‫حذف‬ ،‫ایجاد‬ ‫مانند‬ ‫مدیریتی‬ ‫اعمال‬ ‫میتوانیم‬
...
‫دهیم‬ ‫راانجام‬
.
‫دستور‬ ‫از‬ ‫باید‬ ‫محیط‬ ‫این‬ ‫به‬ ‫ورود‬ ‫برای‬
mysql
‫کنیم‬ ‫استفاده‬ ‫زیر‬ ‫کلی‬ ‫شکل‬ ‫به‬
.
‫از‬ ‫زیر‬ ‫کلی‬ ‫شکل‬ ‫در‬
‫دستور‬
mysql
‫سوئیچ‬
-
u
‫یا‬ ‫کاربری‬ ‫نام‬ ‫تعیین‬ ‫برای‬
Username
‫سو‬ ‫و‬
‫ئیچ‬
-
p
‫است‬ ‫پسورد‬ ‫کردن‬ ‫وارد‬ ‫معرف‬
.
‫سوئیچ‬ ‫جلوی‬ ‫بیشتر‬ ‫امنیت‬ ‫برای‬
-
p
‫زدن‬ ‫و‬ ‫زیر‬ ‫کلی‬ ‫شکل‬ ‫نوشتن‬ ‫از‬ ‫پس‬ ‫بلکه‬ ‫نویسیم‬ ‫نمی‬ ‫را‬ ‫پسورد‬
Enter
‫یک‬
‫شود‬ ‫می‬ ‫داده‬ ‫نمایش‬ ‫شما‬ ‫از‬ ‫پسورد‬ ‫گرفتن‬ ‫برای‬ ‫اعالن‬
# mysql -u Username -p
‫کاربر‬ ‫برای‬ ‫مثال‬ ‫بطور‬
root
‫است‬ ‫زیر‬ ‫بصورت‬
# mysql -u root -p
‫از‬ ‫پس‬
Enter
‫اعالن‬ ‫باال‬ ‫خط‬ ‫زدن‬
Enter Password
‫کاربر‬ ‫پسورد‬ ‫باید‬ ‫که‬ ‫میشود‬ ‫داده‬ ‫نشان‬
root
‫کنید‬ ‫وارد‬ ‫را‬
.
‫فرمان‬ ‫خط‬ ‫محیط‬ ‫اعالن‬ ‫باشید‬ ‫کرده‬ ‫وارد‬ ‫درست‬ ‫را‬ ‫پسورد‬ ‫اگر‬
MySQL
. ‫میشود‬ ‫داده‬ ‫نشان‬ ‫زیر‬ ‫بصورت‬
Mysql >
‫میتوانید‬ ‫پس‬ ‫این‬ ‫از‬
Query
‫کنید‬ ‫اجرا‬ ‫را‬ ‫ها‬
.
‫سرویس‬ ‫دلیلی‬ ‫هر‬ ‫به‬ ‫اگر‬
mariadb | mysqld
‫یا‬ ‫شد‬ ‫مشکل‬ ‫دچار‬
‫یا‬ ‫مجدد‬ ‫اندازی‬ ‫راه‬ ‫آنرا‬ ‫میخواهید‬ ‫اینکه‬
reset
‫دهید‬ ‫انجام‬ ‫را‬ ‫کار‬ ‫این‬ ‫زیر‬ ‫های‬ ‫دستور‬ ‫از‬ ‫یکی‬ ‫با‬ ‫کنید‬
.
‫که‬ ‫تفاوتی‬
‫بین‬
reload
‫و‬
restart
‫با‬ ‫که‬ ‫است‬ ‫این‬ ‫دارد‬ ‫وجود‬
reload
‫سرور‬ ‫به‬ ‫کاربران‬ ‫ارتباط‬ ‫کردن‬
mysql
‫با‬ ‫ولی‬ ‫شد‬ ‫نخواهد‬ ‫قطع‬
restart
‫یکبار‬ ‫سرویس‬ ‫کردن‬
stop
‫نو‬ ‫از‬ ‫و‬
start
‫ارتباط‬ ‫قطع‬ ‫باعث‬ ‫که‬ ‫شود‬ ‫می‬
‫میشود‬
.
‫را‬ ‫سرویس‬ ‫هم‬ ‫دستور‬ ‫سومین‬
stop
‫میکند‬
#systemctl reload mysqld |mariadb
# systemctl restart mysqld |mariadb
# systemctl stop mysqld |mariadb
‫دستور‬ ‫دو‬ ‫با‬
mysqladmin
‫و‬
mysql
‫شدیم‬ ‫آشنا‬
.
‫می‬ ‫استفاده‬ ‫مدیریتی‬ ‫کارهای‬ ‫برای‬ ‫دستور‬ ‫اولین‬
‫دستور‬ ‫و‬ ‫شود‬
mysql
‫های‬ ‫سوئیچ‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫است‬ ‫زیادی‬ ‫های‬ ‫سوئیچ‬ ‫ای‬ ‫دار‬ ‫که‬
-
u
‫و‬
-
p
‫محیط‬ ‫وارد‬
MySQL
‫بشویم‬
.
‫محیط‬ ‫یک‬ ‫وارد‬ ‫ما‬ ‫باال‬ ‫مثال‬ ‫در‬
MySQL
‫در‬
Localhost
‫کالینت‬ ‫یک‬ ‫از‬ ‫میتوانیم‬ ‫ولی‬ ‫شدیم‬
MySQL
‫سرور‬ ‫از‬ ‫یا‬
MySQL
‫سرور‬ ‫یک‬ ‫وارد‬ ‫دیگری‬
MySQL
.‫شویم‬
‫معماری‬ ‫حالت‬ ‫این‬ ‫به‬
Client/Server
. ‫گویند‬
‫دستور‬ ‫بررسی‬ ‫به‬ ‫آینده‬ ‫در‬ : ‫نکته‬
mysqladmin
. ‫پرداخت‬ ‫خواهیم‬
‫محیط‬ ‫دستورهای‬ ‫اجرای‬
MySQL
‫با‬ ‫باشید‬ ‫توانسته‬ ‫اگر‬
Username/Password
‫محیط‬ ‫وارد‬
MySQL
، ‫باشید‬ ‫شده‬
‫کنید‬ ‫اجرا‬ ‫که‬ ‫دستوری‬ ‫اولین‬
help
‫است‬
.
‫میدهد‬ ‫نشان‬ ‫را‬ ‫محیط‬ ‫این‬ ‫فرامین‬ ‫تمامی‬ ‫لیست‬ ‫دستور‬ ‫این‬
.
‫در‬ ‫دستورها‬ ‫تمامی‬ ‫کنید‬ ‫(دقت‬
MySQL
‫خود‬ ‫و‬ ‫هستند‬ ‫کوچک‬
MySQL
) ‫است‬ ‫حساس‬ ‫کوچکی‬ ‫و‬ ‫بزرگی‬ ‫به‬
‫مانند‬ ‫ای‬ ‫شده‬ ‫خالصه‬ ‫شکل‬،‫دستورهای‬ ‫تمامی‬

c
‫ندارد‬ ‫تفاوتی‬ ‫دستور‬ ‫کامل‬ ‫نوشتن‬ ‫با‬ ‫که‬ ‫دارند‬ ‫را‬
.
‫د‬
‫پرداخت‬ ‫خواهیم‬ ‫آنها‬ ‫از‬ ‫برخی‬ ‫توضیح‬ ‫به‬ ‫ادامه‬ ‫ر‬
:

‫دستور‬
connect
:
‫برای‬
connect
‫یا‬ ‫مجدد‬
reconnect
‫است‬ ‫شدن‬
.
‫می‬ ‫و‬ ‫است‬ ‫زیر‬ ‫بصورت‬ ‫آن‬ ‫کلی‬ ‫شکل‬
‫نوشتن‬ ‫جای‬ ‫به‬ ‫توانید‬
connect
‫از‬

r
‫کنید‬ ‫استفاده‬
.
‫پارامترهای‬
db_name
‫و‬
host_name
‫و‬ ‫هستند‬ ‫اختیاری‬
‫دستور‬ ‫نوشتن‬
connect
‫یا‬ ‫تنهایی‬ ‫به‬

r
‫کند‬ ‫می‬ ‫کفایت‬
.
connect [db_name host_name]],  r [db_name host_name ]]
‫دستور‬
system
:
‫مانند‬ ‫عامل‬ ‫سیستم‬ ‫دستور‬ ‫یک‬ ‫اجرای‬ ‫باعث‬
ls
‫یا‬ ‫و‬ ‫لینوکس‬ ‫در‬
dir
‫محیط‬ ‫درون‬ ‫از‬ ‫ویندوز‬ ‫در‬
MySQL
‫میشود‬
.
‫است‬ ‫زیر‬ ‫بصورت‬ ‫آن‬ ‫کلی‬ ‫شکل‬
.
‫جای‬
command
‫بنویسید‬ ‫توانید‬ ‫می‬ ‫را‬ ‫دستوری‬ ‫هر‬
.
‫خالصه‬ ‫شکل‬
‫دستور‬ ‫شده‬
system
‫نماد‬
! 
‫است‬
.
system command, ! command
‫دستور‬
status
:
‫یا‬ ‫حالت‬ ‫نمایش‬
Status
‫به‬ ‫مربوط‬
Connection
‫دهد‬ ‫می‬ ‫نشان‬ ‫را‬ ‫فعلی‬
.
‫همچون‬ ‫اطالعاتی‬
:
Session ID
‫امن‬ ‫پروتکل‬ ‫از‬ ‫آیا‬ ،‫است‬ ‫شده‬ ‫وارد‬ ‫ماشین‬ ‫کدام‬ ‫از‬ ‫و‬ ‫کاربری‬ ‫نام‬ ،
SSL
‫و‬ ‫است‬ ‫شده‬ ‫استفاده‬
…
‫را‬
‫دهد‬ ‫می‬ ‫نشان‬
.
‫یک‬ ‫ورود‬ ‫که‬ ‫است‬ ‫عبور‬ ‫کلمه‬ ‫و‬ ‫کاربری‬ ‫نام‬ ‫یک‬ ‫کردن‬ ‫وارد‬ ‫به‬ ‫نیاز‬ ‫ارتباط‬ ‫هر‬ ‫ایجاد‬ ‫برای‬
Session
‫ترکیب‬ ‫برای‬
Username/Password
‫شود‬ ‫می‬ ‫ایجاد‬
.
‫های‬ ‫ماشین‬ ‫از‬ ‫یا‬ ‫ماشین‬ ‫یک‬ ‫از‬ ‫که‬ ‫است‬ ‫ممکن‬ ‫البته‬
‫کاربری‬ ‫نام‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫و‬ ‫متفاوت‬
/
‫چندین‬ ‫یکسان‬ ‫عبور‬ ‫کلمه‬
Session
‫کدام‬ ‫هر‬ ‫که‬ ‫شود‬ ‫ایجاد‬
ID
‫دارند‬ ‫را‬ ‫خودشان‬ ‫خاص‬
.
‫کردن‬ ‫محدود‬ ‫امکان‬ ‫البته‬
Session
‫هر‬ ‫برای‬ ‫ها‬
Username
‫است‬ ‫مقدور‬
.
‫است‬ ‫زیر‬ ‫بصورت‬ ‫آن‬ ‫از‬ ‫استفاده‬ ‫کلی‬ ‫شکل‬
status , s
‫دستور‬
quit
‫سرور‬ ‫با‬ ‫ارتباط‬ ‫قطع‬ ‫برای‬ :
MySQL
‫دستور‬ ‫از‬ ‫توان‬ ‫می‬
quit
 ‫یا‬
q
.‫نمود‬ ‫استفاده‬
mysql > quit
Bye
‫ترکیبی‬ ‫های‬ ‫کلمه‬ ‫فشردن‬ ‫با‬ ‫ارتباط‬ ‫میتوان‬ ‫همچنین‬
Ctrl+D
.‫کرد‬ ‫قطع‬ ‫نیز‬
:‫نمایید‬ ‫مراجعه‬ ‫زیر‬ ‫آدرس‬ ‫به‬ ‫توانید‬ ‫می‬ ‫بیشتر‬ ‫اطالعات‬ ‫کسب‬ ‫جهت‬
http://dev.mysql.com/doc/refman/5.0/en/mysql-commands.html
‫فایل‬
my.cnf
‫پیکربندی‬ ‫فایلی‬
MySQL
/ ‫دایرکتوری‬ ‫دردرون‬ ‫که‬ ‫است‬
etc
.‫دارد‬ ‫قرار‬
‫فایل‬،‫دیگر‬ ‫فایل‬ .‫میشود‬ ‫بررسی‬ ‫فایل‬ ‫این‬،‫فصل‬ ‫این‬ ‫مطالب‬ ‫ادامه‬ ‫در‬
Log
‫سرویس‬
mysqld
‫در‬ ‫که‬ ‫است‬
/ ‫مسیر‬
var/log
‫نام‬ ‫به‬ ‫و‬
mysqld.log
. ‫دارد‬ ‫قرار‬
: ‫داده‬ ‫پایگاه‬ ‫ایجاد‬
‫داده‬ ‫پایگاه‬ ‫ایجاد‬ ‫برای‬
tmp1
: ‫کنیم‬ ‫می‬ ‫عمل‬ ‫زیر‬ ‫بصورت‬
: ‫نکته‬
‫عبارت‬ ‫فوق‬ ‫دستور‬ ‫اجرای‬ ‫از‬ ‫پس‬ ‫صورتیکه‬ ‫در‬
query was correct
‫یا‬
Query OK
‫به‬ ،‫شود‬ ‫داده‬ ‫نمایش‬
‫که‬ ‫معناست‬ ‫این‬
database
‫است‬ ‫شده‬ ‫ایجاد‬ ‫موفقیت‬ ‫با‬
.
‫از‬ ‫استفاده‬ ‫با‬ ‫را‬ ‫موضوع‬ ‫این‬ ‫صحت‬ ‫میتوانید‬ ‫شما‬
: ‫نمایید‬ ‫بررسی‬ ‫زیر‬ ‫دستور‬
‫توجه‬
:
‫است‬ ‫بزرگ‬ ‫و‬ ‫کوچک‬ ‫حروف‬ ‫به‬ ‫حساس‬ ‫داده‬ ‫پایگاه‬ ‫نام‬ ‫لینوکس‬ ‫در‬
.
‫انتخاب‬
database
‫که‬ ‫دارید‬ ‫نیاز‬ ‫شما‬ ‫حال‬
database
‫نمایید‬ ‫انتخاب‬ ‫آن‬ ‫روی‬ ‫بر‬ ‫کار‬ ‫جهت‬ ‫اید‬ ‫کرده‬ ‫ایجاد‬ ‫قبل‬ ‫مرحله‬ ‫در‬ ‫که‬ ‫را‬
.
‫برای‬
‫کنید‬ ‫استفاده‬ ‫زیر‬ ‫دستور‬ ‫از‬ ‫میتوانید‬ ‫منظور‬ ‫این‬
‫می‬ ‫دفعات‬ ‫به‬ ‫و‬ ‫شده‬ ‫ایجاد‬ ‫یکبار‬ ‫تنها‬ ‫داده‬ ‫پایگاه‬
‫کرد‬ ‫انتخاب‬ ‫را‬ ‫آن‬ ‫توان‬
.
‫همزمان‬ ‫را‬ ‫نظر‬ ‫مورد‬ ‫داده‬ ‫پایگاه‬ ‫میتوان‬
‫سرور‬ ‫با‬ ‫ارتباط‬ ‫برقراری‬ ‫با‬
MySQL
: ‫نمود‬ ‫مشخص‬ ‫زیر‬ ‫دستور‬ ‫طریق‬ ‫از‬
# mysql -h <host-name or IP-Address> -u <username> -p <database-name>
Enter password: *******
‫در‬ ‫جداول‬ ‫ایجاد‬
MySQL
‫نمایید‬ ‫استفاده‬ ‫زیر‬ ‫دستور‬ ‫از‬ ‫جدول‬ ‫ایجاد‬ ‫برای‬ ،‫آن‬ ‫انتخاب‬ ‫و‬ ‫داده‬ ‫پایگاه‬ ‫ایجاد‬ ‫از‬ ‫بعد‬
.
‫قصد‬ ‫من‬ ‫مثال‬ ‫عنوان‬ ‫به‬
‫نام‬ ‫به‬ ‫جدول‬ ‫یک‬ ‫دارم‬
tbyashar
: ‫کنم‬ ‫ایجاد‬
. ‫نپذیرد‬ ‫خالی‬ ‫مقادیر‬ ‫که‬ ‫جدول‬ ‫ایجاد‬
مرجع oracle mysql |mariadb
‫داده‬ ‫انواع‬
‫در‬ ‫ها‬
MySQL
‫در‬
MySQL
‫دارد‬ ‫وجود‬ ‫داده‬ ‫اصلی‬ ‫نوع‬ ‫سه‬
:
‫تارخ‬ ‫نوع‬ ‫و‬ ‫عددی‬ ‫نوع‬ ،‫متنی‬ ‫نوع‬
/
‫زمان‬
•
‫متنی‬ ‫های‬ ‫داده‬
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
: ‫جدول‬ ‫به‬ ‫جدید‬ ‫ستون‬ ‫کردن‬ ‫اضافه‬
‫جدول‬ ‫های‬ ‫فیلد‬ ‫در‬ ‫مقادیر‬ ‫کردن‬ ‫وارد‬
: ‫کوئری‬ ‫یک‬ ‫در‬ ‫مقادیر‬ ‫چندین‬ ‫کردن‬ ‫وارد‬
: ‫جدول‬ ‫ستون‬ ‫در‬ ‫فیلد‬ ‫نام‬ ‫تعغییر‬
: ‫جدول‬ ‫ستون‬ ‫از‬ ‫فیلد‬ ‫حذف‬
: ‫داده‬ ‫پایگاه‬ ‫از‬ ‫جدول‬ ‫حذف‬
: ‫داده‬ ‫پایگاه‬ ‫حذف‬
مرجع oracle mysql |mariadb
‫دستور‬
select
:
‫کلی‬ ‫ساختار‬
select
: ‫باشد‬ ‫می‬ ‫زیر‬ ‫قرار‬ ‫به‬
SELECT field1, field2,...fieldN FROM table_name1, table_name2… [WHERE Clause] [OFFSET M ]
[LIMIT N]
You can use one or more tables separated by comma to include various conditions using a
WHERE clause, but the WHERE clause is an optional part of the SELECT command.
• You can fetch one or more fields in a single SELECT command.
• You can specify star (*) in place of fields. In this case, SELECT will return all the fields.
• You can specify any condition using the WHERE clause.
• You can specify an offset using OFFSET from where SELECT will start returning records. By
default, the offset starts at zero.
• You can limit the number of returns using the LIMIT attribute
‫ساختار‬
WHERE clause
:
: ‫باشد‬ ‫می‬ ‫زیر‬ ‫شرح‬ ‫به‬ ‫کلی‬ ‫شکل‬
SELECT field1, field2,...fieldN table_name1, table_name2...
[WHERE condition1 [AND [OR]] condition2.....
You can use one or more tables separated by a comma to include various conditions using a WHERE
clause, but the WHERE clause is an optional part of the SELECT command.
• You can specify any condition using the WHERE clause.
• You can specify more than one condition using the AND or the OR operators.
• A WHERE clause can be used along with DELETE or UPDATE SQL command also to specify
a condition.
The WHERE clause works like an if condition in any programming language. This clause is used to
compare the given value with the field value available in a MySQL table. If the given value from
outside is equal to the available field value in the MySQL table, then it returns that row.
Here is the list of operators, which can be used with the WHERE clause.
Assume field A holds 10 and field B holds 20, then −
update
: ‫جداول‬ ‫های‬ ‫داده‬ ‫کردن‬
: ‫باشد‬ ‫می‬ ‫زیر‬ ‫شرح‬ ‫به‬ ‫کلی‬ ‫ساختار‬
UPDATE table_name SET field1 = new-value1, field2 = new-value2
[WHERE Clause]
update
‫ترکیبی‬
:
‫ساختار‬ ‫ایجاد‬
auto number
:
update
: ‫کردن‬
: ‫هست‬ ‫شکل‬ ‫این‬ ‫به‬ ‫دستور‬ ‫کلی‬ ‫شکل‬
UPDATE table_name SET field1 = new-value1, field2 = new-value2 [WHERE Clause]
update
‫با‬
replace
:
‫ساختار‬ ‫کلی‬ ‫شکل‬
replace
: ‫باشد‬ ‫می‬ ‫زیر‬ ‫قرار‬ ‫به‬
replace(FIELD_NAME, 'find this string', 'replace found string with this string');
replace
‫با‬
select
:
مرجع oracle mysql |mariadb
‫از‬ ‫جدول‬ ‫ایجاد‬
select
:
: ‫باشد‬ ‫می‬ ‫زیر‬ ‫شرح‬ ‫به‬ ‫دستور‬ ‫کلی‬ ‫ساختار‬
CREATE TABLE table_name [ ( column_name [, ...] ) ]
AS select [ * ! ( column_name [, ...] ) ] FROM source_table_name
: ‫جدول‬ ‫از‬ ‫داده‬ ‫حذف‬
: ‫باشد‬ ‫می‬ ‫زیر‬ ‫شرح‬ ‫به‬ ‫کلی‬ ‫شکل‬
DELETE FROM table_name [WHERE Clause]
( ‫گیری‬ ‫گزارش‬
like
: )
: ‫باشد‬ ‫می‬ ‫زیر‬ ‫شرح‬ ‫به‬ ‫کلی‬ ‫شکل‬
SELECT field1, field2,...fieldN table_name1, table_name2...
WHERE field1 LIKE condition1 [AND [OR]] filed2 = 'somevalue'
• You can specify any condition using the WHERE clause.
• You can use the LIKE clause along with the WHERE clause.
• You can use the LIKE clause in place of the equals to sign.
• When LIKE is used along with % sign then it will work like a meta character search.
• You can specify more than one condition using AND or OR operators.
• A WHERE...LIKE clause can be used along with DELETE or UPDATE SQL command also to
specify a condition.
مرجع oracle mysql |mariadb
" ‫عبارات‬ ‫جستجو‬ ‫در‬ ‫نخواهیم‬ ‫اگر‬
b", "s
" ‫یا‬ ,"
p
‫؟‬ ‫کرد‬ ‫باید‬ ‫چه‬ ‫نشود‬ ‫شامل‬ ‫را‬ "
SELECT * FROM Customers WHERE City LIKE '[!bsp]%';
: ‫شود‬ ‫شامل‬ ‫را‬ ‫ما‬ ‫نظر‬ ‫مد‬ ‫عبارت‬ ‫تا‬ ‫عبارت‬ ‫هر‬
SELECT * FROM Customers WHERE City LIKE '_erlin';
: ‫شود‬ ‫ها‬ ‫کاراکتر‬ ‫این‬ ‫شامل‬ ‫ما‬ ‫عبارت‬
SELECT * FROM Customers WHERE City LIKE 'L_n_on';
: ‫سازی‬ ‫مرتب‬
. ‫باشد‬ ‫می‬ ‫زیر‬ ‫شرح‬ ‫به‬ ‫کلی‬ ‫ساختار‬
SELECT field1, field2,...fieldN table_name1, table_name2...
ORDER BY field1, [field2...] [ASC [DESC]]
• You can sort the returned result on any field, if that field is being listed out.
• You can sort the result on more than one field.
• You can use the keyword ASC or DESC to get result in ascending or descending order. By
default, it's the ascending order.
• You can use the WHERE...LIKE clause in the usual way to put a condition.
: ‫تعداد‬ ‫شمارش‬
: ‫بازگشتی‬ ‫تابع‬
alias
:
: ‫تکراری‬ ‫تابع‬
ltrim
:
Lpad
:
مرجع oracle mysql |mariadb
Rpad
:
space
:
sum
:
group by
:
‫با‬ ‫اصلی‬ ‫عمل‬
select
:
: ‫جدول‬ ‫از‬ ‫مقدار‬ ‫بیشترین‬ ‫کردن‬ ‫پیدا‬
‌
: ‫میانگین‬ ‫گرفتن‬
join
:
مرجع oracle mysql |mariadb
‫فصل‬
mysqladmin
‫در‬
: ‫رود‬ ‫می‬ ‫کار‬ ‫به‬ ‫مدیریتی‬ ‫ساختارهای‬ ‫انجام‬ ‫برای‬ ‫دستور‬ ‫این‬
: ‫باشد‬ ‫می‬ ‫زیر‬ ‫صورت‬ ‫به‬ ‫برنامه‬ ‫کلی‬ ‫شکل‬
mysqladmin [options] command [command-arg] [command [command-arg]] ...
create db_name
Create a new database named db_name.
• debug
Tell the server to write debug information to the error log. The connected user must have the SUPER
privilege. Format and content of this information is subject to change.
This includes information about the Event Scheduler. See Section 23.4.5, “Event Scheduler Status”.
• drop db_name
Delete the database named db_name and all its tables.
• extended-status
Display the server status variables and their values.
• flush-hosts
Flush all information in the host cache.
• flush-logs [log_type ...]
Flush all logs.
The mysqladmin flush-logs command permits optional log types to be given, to specify which logs to
flush. Following the flush-logs command, you can provide a space-separated list of one or more of
the following log types: binary, engine, error, general, relay, slow. These correspond to
the log types that can be specified for the FLUSH LOGS SQL statement.
• flush-privileges
Reload the grant tables (same as reload).
• flush-status
Clear status variables.
• flush-tables
Flush all tables.
• flush-threads
Flush the thread cache.
• kill id,id,...
Kill server threads. If multiple thread ID values are given, there must be no spaces in the list.
To kill threads belonging to other users, the connected user must have the CONNECTION_ADMIN or
SUPER privilege.
• password new_password
Set a new password. This changes the password to new_password for the account that you use with
mysqladmin for connecting to the server. Thus, the next time you invoke mysqladmin (or any other
client program) using the same account, you will need to specify the new password.
ping
Check whether the server is available. The return status from mysqladmin is 0 if the server is running,
1 if it is not. This is 0 even in case of an error such as Access denied, because this means that the
server is running but refused the connection, which is different from the server not running.
• processlist
Show a list of active server threads. This is like the output of the SHOW PROCESSLIST statement. If
the --verbose option is given, the output is like that of SHOW FULL PROCESSLIST. (See
Section 13.7.6.29, “SHOW PROCESSLIST Syntax”.)
• reload
Reload the grant tables.
• refresh
Flush all tables and close and open log files.
• shutdown
Stop the server.
• start-slave
Start replication on a slave server.
• status
Display a short server status message.
• stop-slave
Stop replication on a slave server.
• variables
Display the server system variables and their values.
• version
Display version information from the server.
Uptime
The number of seconds the MySQL server has been running.
• Threads
The number of active threads (clients).
• Questions
The number of questions (queries) from clients since the server was started.
• Slow queries
The number of queries that have taken more than long_query_time seconds. See Section 5.4.5,
“The Slow Query Log”.
• Opens
The number of tables the server has opened.
• Flush tables
The number of flush-*, refresh, and reload commands the server has executed.
• Open tables
The number of tables that currently are open.
Mysqlcheck :
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
mysqldump
mysqldump
‫گرفتن‬ ‫برای‬ ‫ابزاری‬
dump
‫باشد‬ ‫می‬ ‫زیر‬ ‫صورت‬ ‫به‬ ‫دستور‬ ‫کلی‬ ‫شکل‬ . ‫هست‬ ‫داده‬ ‫پایگاه‬ ‫از‬
mysqldump [options] > dump.sql
: ‫نمونه‬ ‫برای‬
mysqldump -u[username] -p[password] databasename > databasefilename.sql
mysqldump -u root -p TUTORIALS tutorials_tbl > dump.txt
mysqldump --user=user --password --host=db.example.com --all-databases > db.sql
: ‫نظر‬ ‫مد‬ ‫بیس‬ ‫دیتا‬
mysqldump --user=user --password --host=db.example.com tmpdb > db.sql
‫سازی‬ ‫فشرده‬
dump
:
mysqldump --user=user --password=pass --host=db.example.com wikidb |gzip -cq9 > db.sql.gz
SELECT * FROM tutorials_tbl INTO OUTFILE '/tmp/tutorials.txt';
مرجع oracle mysql |mariadb
import
mysql --user=user --password=pass db < db.sql
mysqlimport [options] db_name textfile1 [textfile2 ...]
مرجع oracle mysql |mariadb
mysqlimport --lines-terminated-by="rn" world City.txt
mysqlimport --ignore-lines=1 --fields-terminated-by=, --verbose --local -u [user] -
p [database] /path/to/address.csv
mysqlshow
: ‫داده‬ ‫پایگاه‬ ‫کانسپت‬ ‫در‬ ‫ها‬ ‫نقش‬ ‫و‬ ‫افراد‬ ‫انواع‬
• Customer
• Business analyst
• Database designer
• Database administrator
• Application developer
• Interface designer
• Project manager
mysqldumpslow
mysql> SET GLOBAL slow_query_log = 'ON';
mysql> SET GLOBAL slow_query_log_file = '/var/log/mysql/localhost-slow.log';
mysql> SET GLOBAL log_queries_not_using_indexes = 'ON';
mysql> SET SESSION long_query_time = 1;
mysql> SET SESSION min_examined_row_limit = 100;
SHOW GLOBAL VARIABLES LIKE 'slow_query_log';
مرجع oracle mysql |mariadb
‫فصل‬
‫در‬ ‫آن‬ ‫ساختار‬ ‫و‬ ‫فرم‬
. ‫باشد‬ ‫می‬ ‫موجود‬ ‫مختلفی‬ ‫ابزارهای‬ ‫فرم‬ ‫ساخت‬ ‫برای‬
‫در‬ ‫ساده‬ ‫ساختار‬ ‫زیر‬ ‫در‬
php
. ‫شود‬ ‫می‬ ‫بررسی‬
Function :
<html>
<head>
<title>PHP with MySQL</title>
</head>
<body>
<?php
$retval = mysql_function(value, [value,...]);
if( !$retval ) {
die ( "Error: a related error message" );
}
// Otherwise MySQL or PHP Statements
?>
</body>
</html>
connection :
<html>
<head>
<title>Connecting MySQL Server</title>
</head>
<body>
<?php
$dbhost = 'localhost:3306';
$dbuser = 'guest';
$dbpass = 'guest123';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($conn);
?>
</body>
</html>
create database :
<html>
<head>
<title>Creating MySQL Database</title>
</head>
<body>
<?php
$dbhost = 'localhost:3036';
$dbuser = 'root';
$dbpass = 'rootpassword';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully<br />';
$sql = 'CREATE DATABASE TUTORIALS';
$retval = mysql_query( $sql, $conn );
if(! $retval ) {
die('Could not create database: ' . mysql_error());
}
echo "Database TUTORIALS created successfullyn";
mysql_close($conn);
?>
</body>
</html>
Drop database :
<html>
<head>
<title>Deleting MySQL Database</title>
</head>
<body>
<?php
$dbhost = 'localhost:3036';
$dbuser = 'root';
$dbpass = 'rootpassword';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully<br />';
$sql = 'DROP DATABASE TUTORIALS';
$retval = mysql_query( $sql, $conn );
if(! $retval ) {
die('Could not delete database: ' . mysql_error());
}
echo "Database TUTORIALS deleted successfullyn";
mysql_close($conn);
?>
</body>
</html>
Use database :
<html>
<head>
<title>Selecting MySQL Database</title>
</head>
<body>
<?php
$dbhost = 'localhost:3036';
$dbuser = 'guest';
$dbpass = 'guest123';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_select_db( 'TUTORIALS' );
mysql_close($conn);
?>
</body>
</html>
create tables :
<html>
<head>
<title>Creating MySQL Tables</title>
</head>
<body>
<?php
$dbhost = 'localhost:3036';
$dbuser = 'root';
$dbpass = 'rootpassword';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully<br />';
$sql = "CREATE TABLE tutorials_tbl( ".
"tutorial_id INT NOT NULL AUTO_INCREMENT, ".
"tutorial_title VARCHAR(100) NOT NULL, ".
"tutorial_author VARCHAR(40) NOT NULL, ".
"submission_date DATE, ".
"PRIMARY KEY ( tutorial_id )); ";
mysql_select_db( 'TUTORIALS' );
$retval = mysql_query( $sql, $conn );
if(! $retval ) {
die('Could not create table: ' . mysql_error());
}
echo "Table created successfullyn";
mysql_close($conn);
?>
</body>
</html>
Drop tables :
<html>
<head>
<title>Creating MySQL Tables</title>
</head>
<body>
<?php
$dbhost = 'localhost:3036';
$dbuser = 'root';
$dbpass = 'rootpassword';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully<br />';
$sql = "DROP TABLE tutorials_tbl";
mysql_select_db( 'TUTORIALS' );
$retval = mysql_query( $sql, $conn );
if(! $retval ) {
die('Could not delete table: ' . mysql_error());
}
echo "Table deleted successfullyn";
mysql_close($conn);
?>
</body>
</html>
Insert :
<html>
<head>
<title>Add New Record in MySQL Database</title>
</head>
<body>
<?php
if(isset($_POST['add'])) {
$dbhost = 'localhost:3036';
$dbuser = 'root';
$dbpass = 'rootpassword';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
if(! get_magic_quotes_gpc() ) {
$tutorial_title = addslashes ($_POST['tutorial_title']);
$tutorial_author = addslashes ($_POST['tutorial_author']);
} else {
$tutorial_title = $_POST['tutorial_title'];
$tutorial_author = $_POST['tutorial_author'];
}
$submission_date = $_POST['submission_date'];
$sql = "INSERT INTO tutorials_tbl ".
"(tutorial_title,tutorial_author, submission_date) "."VALUES ".
"('$tutorial_title','$tutorial_author','$submission_date')";
mysql_select_db('TUTORIALS');
$retval = mysql_query( $sql, $conn );
if(! $retval ) {
die('Could not enter data: ' . mysql_error());
}
echo "Entered data successfullyn";
mysql_close($conn);
} else {
?>
<form method = "post" action = "<?php $_PHP_SELF ?>">
<table width = "600" border = "0" cellspacing = "1" cellpadding = "2">
<tr>
<td width = "250">Tutorial Title</td>
<td>
<input name = "tutorial_title" type = "text" id =
"tutorial_title">
</td>
</tr>
<tr>
<td width = "250">Tutorial Author</td>
<td>
<input name = "tutorial_author" type = "text" id =
"tutorial_author">
</td>
</tr>
<tr>
<td width = "250">Submission Date [ yyyy-mm-dd ]</td>
<td>
<input name = "submission_date" type = "text" id =
"submission_date">
</td>
</tr>
<tr>
<td width = "250"> </td>
<td> </td>
</tr>
<tr>
<td width = "250"> </td>
<td>
<input name = "add" type = "submit" id = "add" value = "Add
Tutorial">
</td>
</tr>
</table>
</form>
<?php
}
?>
</body>
</html>
Select :
<?php
$dbhost = 'localhost:3036';
$dbuser = 'root';
$dbpass = 'rootpassword';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
$sql = 'SELECT tutorial_id, tutorial_title, tutorial_author, submission_date
FROM tutorials_tbl';
mysql_select_db('TUTORIALS');
$retval = mysql_query( $sql, $conn );
if(! $retval ) {
die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) {
echo "Tutorial ID :{$row['tutorial_id']} <br> ".
"Title: {$row['tutorial_title']} <br> ".
"Author: {$row['tutorial_author']} <br> ".
"Submission Date : {$row['submission_date']} <br> ".
"--------------------------------<br>";
}
echo "Fetched data successfullyn";
mysql_close($conn);
?>
where clause :
<?php
$dbhost = 'localhost:3036';
$dbuser = 'root';
$dbpass = 'rootpassword';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
$sql = 'SELECT tutorial_id, tutorial_title,
tutorial_author, submission_date
FROM tutorials_tbl
WHERE tutorial_author = "Sanjay"';
mysql_select_db('TUTORIALS');
$retval = mysql_query( $sql, $conn );
if(! $retval ) {
die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) {
echo "Tutorial ID :{$row['tutorial_id']} <br> ".
"Title: {$row['tutorial_title']} <br> ".
"Author: {$row['tutorial_author']} <br> ".
"Submission Date : {$row['submission_date']} <br> ".
"--------------------------------<br>";
}
echo "Fetched data successfullyn";
mysql_close($conn);
?>
update :
<?php
$dbhost = 'localhost:3036';
$dbuser = 'root';
$dbpass = 'rootpassword';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
$sql = 'UPDATE tutorials_tbl
SET tutorial_title="Learning JAVA"
WHERE tutorial_id=3';
mysql_select_db('TUTORIALS');
$retval = mysql_query( $sql, $conn );
if(! $retval ) {
die('Could not update data: ' . mysql_error());
}
echo "Updated data successfullyn";
mysql_close($conn);
?>
delete query :
<?php
$dbhost = 'localhost:3036';
$dbuser = 'root';
$dbpass = 'rootpassword';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
$sql = 'DELETE FROM tutorials_tbl
WHERE tutorial_id=3';
mysql_select_db('TUTORIALS');
$retval = mysql_query( $sql, $conn );
if(! $retval ) {
die('Could not delete data: ' . mysql_error());
}
echo "Deleted data successfullyn";
mysql_close($conn);
?>
like clause :
<?php
$dbhost = 'localhost:3036';
$dbuser = 'root';
$dbpass = 'rootpassword';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
$sql = 'SELECT tutorial_id, tutorial_title,
tutorial_author, submission_date
FROM tutorials_tbl
WHERE tutorial_author LIKE "%jay%"';
mysql_select_db('TUTORIALS');
$retval = mysql_query( $sql, $conn );
if(! $retval ) {
die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) {
echo "Tutorial ID :{$row['tutorial_id']} <br> ".
"Title: {$row['tutorial_title']} <br> ".
"Author: {$row['tutorial_author']} <br> ".
"Submission Date : {$row['submission_date']} <br> ".
"--------------------------------<br>";
}
echo "Fetched data successfullyn";
mysql_close($conn);
?>
sorting :
<?php
$dbhost = 'localhost:3036';
$dbuser = 'root';
$dbpass = 'rootpassword';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
$sql = 'SELECT tutorial_id, tutorial_title,
tutorial_author, submission_date
FROM tutorials_tbl
ORDER BY tutorial_author DESC';
mysql_select_db('TUTORIALS');
$retval = mysql_query( $sql, $conn );
if(! $retval ) {
die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) {
echo "Tutorial ID :{$row['tutorial_id']} <br> ".
"Title: {$row['tutorial_title']} <br> ".
"Author: {$row['tutorial_author']} <br> ".
"Submission Date : {$row['submission_date']} <br> ".
"--------------------------------<br>";
}
echo "Fetched data successfullyn";
mysql_close($conn);
?>
‫فصل‬
‫تعغییر‬
engine
‫در‬
‫دارد؟‬ ‫وظایفی‬ ‫چه‬ ‫سازی‬ ‫ذخیره‬ ‫موتور‬
( ‫اطالعات‬ ‫مشاهده‬ ‫و‬ ‫حذف‬ ،‫بروزرسانی‬ ،‫ایجاد‬ ‫مسئول‬ ‫سازی‬ ‫ذخیره‬ ‫موتورهای‬
CRUD
‫می‬ ‫داد‬ ‫پایگاه‬ ‫جداول‬ ‫)در‬
‫داده‬ ‫پایگاه‬ ‫در‬ .‫باشند‬
MySQL
‫سازی‬ ‫ذخیره‬ ‫موتور‬ ‫دو‬
InnoDB
‫و‬
MyISAM
.‫دارد‬ ‫وجود‬ … ‫و‬
‫ها‬ ‫داده‬ ‫به‬ ‫دسترسی‬ ‫سرعت‬
‫جدول‬ ‫هر‬
InnoDB
( ‫ای‬ ‫خوشه‬ ‫اندیس‬ ‫بنام‬ ‫خاص‬ ‫اندیس‬ ‫یک‬
clusterd index
‫ذخیره‬ ‫آن‬ ‫در‬ ‫رکوردها‬ ‫که‬ ‫دارد‬ )
‫و‬ ‫رکورد‬ ‫هر‬ ‫های‬ ‫داده‬ ‫که‬ ‫است‬ ‫سریعتر‬ ‫علت‬ ‫این‬ ‫به‬ ‫جستجو‬ ‫اندیس‬ ‫طریق‬ ‫از‬ ‫ها‬ ‫داده‬ ‫به‬ ‫دسترسی‬ .‫شوند‬ ‫می‬
‫کاهش‬ ‫باعث‬ ‫اغلب‬ ‫ای‬ ‫خوشه‬ ‫اندیس‬ ‫ساختار‬ ،‫بزرگ‬ ‫جداول‬ ‫در‬ .‫دارند‬ ‫قرار‬ ‫صفحه‬ ‫یک‬ ‫در‬ ‫آن‬ ‫جستجوی‬ ‫اندیس‬
‫عملیات‬
I/O
.‫شود‬ ‫می‬ ‫دارند‬ ‫قرار‬ ‫متفاوتی‬ ‫صفحات‬ ‫در‬ ‫داده‬ ‫و‬ ‫اندیس‬ ‫که‬ ‫ساختارهایی‬ ‫به‬ ‫نسبت‬
MyISAM
‫از‬
.‫کند‬ ‫می‬ ‫استفاده‬ ‫ها‬ ‫اندیس‬ ‫جهت‬ ‫دیگری‬ ‫فایل‬ ‫و‬ ‫رکوردها‬ ‫ذخیره‬ ‫جهت‬ ‫فایل‬ ‫یک‬
‫در‬
InnoDB
( ‫ثانویه‬ ‫های‬ ‫اندیس‬ ‫بخش‬ ‫در‬ .‫شود‬ ‫می‬ ‫ایجاد‬ ‫اصلی‬ ‫کلید‬ ‫اساس‬ ‫بر‬ ‫ای‬ ‫خوشه‬ ‫اندیس‬
secondary
indexes
‫نیز‬ )
InnoDB
‫را‬ ‫اصلی‬ ‫کلید‬ ‫های‬ ‫ستون‬ ،‫خود‬ ‫های‬ ‫ستون‬ ‫بر‬ ‫عالوه‬ ‫ها‬ ‫اندیس‬ ‫این‬ .‫دارد‬ ‫بهتری‬ ‫عملکرد‬
‫و‬ ‫گیرند‬ ‫می‬ ‫بر‬ ‫در‬ ‫نیز‬
InnoDB
.‫کند‬ ‫می‬ ‫استفاده‬ ‫ای‬ ‫خوشه‬ ‫اندیس‬ ‫در‬ ‫جستجو‬ ‫برای‬ ‫اصلی‬ ‫کلید‬ ‫مقدار‬ ‫از‬
‫در‬
MySQL
.‫شوند‬ ‫می‬ ‫کش‬ ‫حافظه‬ ‫بافرهای‬ ‫در‬ ‫ها‬ ‫داده‬ ،‫کارایی‬ ‫و‬ ‫سرعت‬ ‫افزایش‬ ‫جهت‬
MyISAM
‫بافرهای‬ ‫از‬
‫بنام‬ ‫خاصی‬
Key cache
‫از‬ ‫دیگر‬ ‫های‬ ‫داده‬ ‫کردن‬ ‫کش‬ ‫برای‬ ‫و‬ ‫کند‬ ‫می‬ ‫استفاده‬ ‫ها‬ ‫اندیس‬ ‫کردن‬ ‫کش‬ ‫منظور‬ ‫به‬
‫مقابل‬ ‫در‬ .‫کند‬ ‫می‬ ‫استفاده‬ ‫عامل‬ ‫سیستم‬ ‫حافظه‬ ‫بافرهای‬
InnoDB
‫موسوم‬ ‫فضایی‬ ‫در‬ ‫را‬ ‫ها‬ ‫داده‬ ‫و‬ ‫ها‬ ‫اندیس‬
‫به‬
buffer pool
‫های‬ ‫درخت‬ ‫قالب‬ ‫در‬ ‫و‬
B-Tree
.‫کند‬ ‫می‬ ‫کش‬
‫ها‬ ‫تراکنش‬ ‫از‬ ‫پشتیبانی‬
‫طراحی‬
InnoDB
‫مدل‬ ‫اساس‬ ‫بر‬
ACID
‫همچون‬ ‫هایی‬ ‫قابلیت‬ ‫با‬ ‫ها‬ ‫تراکنش‬ ‫که‬ ‫است‬
commit ، roll back
‫و‬
‫در‬ .‫کند‬ ‫می‬ ‫پشتیبانی‬ ‫را‬ ‫کرش‬ ‫زمان‬ ‫در‬ ‫بازیابی‬
InnoDB
‫حالت‬ ‫بودن‬ ‫فعال‬ ‫با‬
autocommit
‫کاربر‬ ‫فعالیت‬ ‫تمام‬ ،
‫اگر‬ .‫گیرد‬ ‫می‬ ‫انجام‬ ‫تراکش‬ ‫درون‬
autocommit
‫از‬ ‫دستی‬ ‫بصورت‬ ‫توان‬ ‫می‬ ‫نباشد‬ ‫فعال‬
commit
‫و‬
roll back
.‫نمود‬ ‫استفاده‬
Commit
‫و‬ ‫کند‬ ‫می‬ ‫ثبت‬ ‫دائمی‬ ‫بصورت‬ ‫را‬ ‫فعلی‬ ‫تراکنش‬ ‫در‬ ‫شده‬ ‫انجام‬ ‫تغییرات‬
roll back
‫تمام‬
.‫کند‬ ‫می‬ ‫لغو‬ ‫را‬ ‫جاری‬ ‫تراکنش‬ ‫تغییرات‬
‫موتور‬ ،‫مقابل‬ ‫در‬
MyISAM
.‫کند‬ ‫نمی‬ ‫پشتیبانی‬ ‫ها‬ ‫تراکنش‬ ‫از‬
‫سازی‬ ‫موازی‬
‫بزرگ‬ ‫مشکالت‬ ‫از‬ ‫یکی‬
MyISAM
‫در‬ .‫است‬ ‫داده‬ ‫ردیف‬ ‫سطح‬ ‫کردن‬ ‫قفل‬ ‫قابلیت‬ ‫نداشتن‬
InnoDB
‫که‬ ‫هنگامی‬
‫اجرا‬ ‫همزمان‬ ‫بطور‬ ‫توانند‬ ‫می‬ ‫عملیات‬ ‫این‬ ،‫ردیف‬ ‫سطح‬ ‫قفل‬ ‫به‬ ‫توجه‬ ‫با‬ ‫دارد‬ ‫وجود‬ ‫نوشتن‬ ‫عملیات‬ ‫زیادی‬ ‫تعداد‬
‫در‬ ‫جدول‬ ‫سطح‬ ‫کردن‬ ‫قفل‬ ‫قابلیت‬ ‫اما‬ ‫شوند‬
MyISAM
.‫دهد‬ ‫نمی‬ ‫را‬ ‫کاری‬ ‫چنین‬ ‫اجازه‬
InnoDB
‫باالی‬ ‫سطوح‬ ‫در‬
.‫شود‬ ‫می‬ ‫استفاده‬ ‫موضوع‬ ‫این‬ ‫برای‬ ‫هم‬ ‫باز‬ ‫ولی‬ ‫دارد‬ ‫را‬ ‫ناسازگار‬ ‫دو‬ ‫به‬ ‫دو‬ ‫کردن‬ ‫قفل‬ ‫مشکل‬ ‫سازی‬ ‫موازی‬
‫نگهداری‬ ‫و‬ ‫پایداری‬
‫موتور‬ .‫شوند‬ ‫دیدگی‬ ‫آسیب‬ ‫دچار‬ ‫است‬ ‫ممکن‬ ‫افزار‬ ‫سخت‬ ‫شدن‬ ‫خراب‬ ‫یا‬ ‫کردن‬ ‫کرش‬ ‫اثر‬ ‫در‬ ‫ها‬ ‫دیتابیس‬
MyISAM
‫داده‬ ‫سازی‬ ‫یکپارچه‬ ‫به‬ ‫که‬ ‫مکانیزمی‬ ‫وجود‬ ‫عدم‬ ‫بدلیل‬ ‫و‬ ‫گیرد‬ ‫می‬ ‫قرار‬ ‫عوامل‬ ‫این‬ ‫تاثیر‬ ‫تحت‬ ‫بسادگی‬
‫به‬ ‫نیاز‬ ،‫کند‬ ‫کمک‬ ‫ها‬
repair
‫اما‬ .‫ندارد‬ ‫وجود‬ ‫ها‬ ‫داده‬ ‫کامل‬ ‫بازیابی‬ ‫برای‬ ‫ضمانتی‬ ‫هیچ‬ ‫ضمنا‬ ‫و‬ ‫دارد‬
InnoDB
‫حد‬ ‫تا‬ ‫افزاری‬ ‫سخت‬ ‫مشکالت‬ ‫وقوع‬ ‫هنگام‬ ‫خصوصا‬ ‫و‬ ‫کند‬ ‫تضمین‬ ‫را‬ ‫پایداری‬ ‫و‬ ‫دوام‬ ‫که‬ ‫شده‬ ‫طراحی‬ ‫ای‬ ‫بگونه‬
.‫هد‬ ‫می‬ ‫کاهش‬ ‫را‬ ‫ها‬ ‫داده‬ ‫خرابی‬ ‫زیادی‬
( ‫پشتیبان‬ ‫های‬ ‫فایل‬ ‫ایجاد‬
Back-up
)
‫در‬
InnoDB
‫اصطالحا‬ ‫روش‬ ‫این‬ ‫به‬ .‫کرد‬ ‫تهیه‬ ‫پشتیبان‬ ‫نسخه‬ ‫دیتابیس‬ ‫فعالیت‬ ‫حین‬ ‫در‬ ‫بسادگی‬ ‫توان‬ ‫می‬
hot
back-up
‫در‬ ‫اما‬ .‫شود‬ ‫می‬ ‫گفته‬
MyISAM
‫و‬ ‫جداول‬ ‫شدن‬ ‫قفل‬ ‫به‬ ‫منجر‬ ‫پشتیبان‬ ‫فایل‬ ‫ایجاد‬
Read only
‫شدن‬
‫تکنیک‬ ‫بزرگ‬ ‫مقیاس‬ ‫در‬ .‫گردد‬ ‫می‬ ‫آنها‬
replication
‫مشکل‬ ‫این‬ ‫بر‬ ‫غلبه‬ ‫برای‬ ‫دیگر‬ ‫سرور‬ ‫یک‬ ‫ایجاد‬ ‫و‬
MyISAM
.‫رود‬ ‫می‬ ‫بکار‬
‫تکنیک‬ ‫در‬
replication
‫سرور‬ ‫یک‬
Master
‫سرور‬ ‫چندین‬ ‫و‬
Slave
‫تغییر‬ ‫به‬ ‫منجر‬ ‫که‬ ‫عملیاتی‬ ‫تمام‬ .‫داریم‬
‫سرور‬ ‫روی‬ ‫بر‬ ‫فقط‬ ‫شوند‬ ‫می‬ ‫دیتابیس‬
Master
‫یک‬ ‫و‬ ‫شده‬ ‫اجرا‬
log
‫سرورهای‬ ‫سپس‬ .‫شود‬ ‫می‬ ‫ایجاد‬ ‫آنها‬ ‫از‬
Slave
‫این‬ ‫کمک‬ ‫به‬
log
‫سرور‬ ‫با‬ ‫را‬ ‫خود‬
Master
‫سرورهای‬ ‫معمول‬ ‫حالت‬ ‫در‬ .‫کنند‬ ‫می‬ )‫(همگام‬ ‫سینک‬
Slave
‫های‬ ‫سرور‬ ‫از‬ ‫یک‬ ‫هر‬ .‫شوند‬ ‫می‬ ‫استفاده‬ ‫اطالعات‬ ‫خواندن‬ ‫جهت‬ ‫تنها‬
Slave
‫از‬ ‫پشتیبان‬ ‫نسخه‬ ‫یک‬ ‫نقش‬
‫موتور‬ ‫آنالین‬ ‫گیری‬ ‫پشتیبان‬ ‫مشکل‬ ‫حل‬ ‫جهت‬ ‫راهکاری‬ ‫و‬ ‫دارند‬ ‫را‬ ‫دیتابیس‬ ‫اطالعات‬
MyISAM
‫می‬ ‫محسوب‬
.‫گردد‬
‫دیگر‬ ‫های‬ ‫تفاوت‬
‫رکوردها‬ ‫تعداد‬ ‫ذخیره‬ ·
‫در‬
InnoDB
‫خالف‬ ‫بر‬
MyISAM
‫دستور‬ ‫از‬ ‫و‬ ‫شود‬ ‫نمی‬ ‫ذخیره‬ ‫رکوردها‬ ‫تعداد‬
count
‫رکوردها‬ ‫تعداد‬ ‫تعیین‬ ‫جهت‬
‫شرط‬ ‫با‬ ‫دستور‬ ‫این‬ ‫از‬ ‫استفاده‬ .‫شود‬ ‫می‬ ‫استفاده‬
where
‫بهتر‬ ‫و‬ ‫است‬ ‫زمانبر‬ ‫شرط‬ ‫این‬ ‫بدون‬ ‫اما‬ ‫است‬ ‫معمول‬
.‫گردد‬ ‫استفاده‬ ‫جایگزین‬ ‫های‬ ‫روش‬ ‫است‬
‫خاصیت‬ ·
Full text
‫ها‬ ‫اندیس‬ ‫در‬
‫جستجوی‬
Full text
‫برخالف‬
like
.‫دهد‬ ‫می‬ ‫انجام‬ ‫کلمات‬ ‫روی‬ ‫را‬ ‫جو‬ ‫و‬ ‫پرس‬ ،‫کند‬ ‫می‬ ‫عمل‬ ‫کاراکترها‬ ‫روی‬ ‫بر‬ ‫که‬
‫با‬ ،‫باشیم‬ ‫رکورد‬ ‫میلیون‬ ‫چندین‬ ‫روی‬ ‫بر‬ ‫ترکیب‬ ‫یک‬ ‫جستجوی‬ ‫در‬ ‫اگر‬ ‫مثال‬ ‫بعنوان‬
like
‫چندین‬ ‫است‬ ‫ممکن‬
‫با‬ ‫ولی‬ ‫دقیقه‬
Full text search
.‫شود‬ ‫می‬ ‫انجام‬ ‫ثانیه‬ ‫چند‬ ‫طی‬
‫های‬ ‫نسخه‬ ‫تمام‬ ‫در‬
MyISAM
‫از‬ ‫ها‬ ‫اندیس‬ ،
Full text
‫از‬ ‫تنها‬ ‫اما‬ ‫کنند‬ ‫می‬ ‫پشتیبانی‬
MySQL 5.6.4
‫در‬ ‫بعد‬ ‫به‬
‫موتور‬
InnoDB
‫جستجوی‬ ‫از‬ ‫توان‬ ‫می‬
Full text
‫از‬ ‫گسترده‬ ‫بصورت‬ ‫حاضر‬ ‫حال‬ ‫در‬ .‫گرفت‬ ‫بهره‬ ‫ها‬ ‫اندیس‬ ‫روی‬ ‫بر‬
‫خاصیت‬ ‫این‬
InnoDB
.‫شود‬ ‫نمی‬ ‫استفاده‬
‫از‬ ‫استفاده‬ ‫دلیل‬
myISAM
‫خیلی‬ ‫؟‬ ‫است‬ ‫ان‬ ‫بودن‬ ‫انتخاب‬ ‫قابل‬ ‫یا‬ ‫سیستم‬ ‫در‬ ‫بودن‬ ‫فرض‬ ‫پیش‬ ‫خاطر‬ ‫به‬ ‫فقط‬ ‫؟‬
‫موارد‬ ‫از‬ ‫بسیاری‬ ‫در‬ ‫متاسفانه‬ ‫داده‬ ‫پایگاه‬ ‫مدیران‬ ! ‫باشد‬ ‫می‬ ‫دیتابیس‬ ‫معمار‬ ‫یک‬ ‫برای‬ ‫مهمی‬ ‫سوال‬ ‫این‬ ‫ها‬ ‫وقت‬
‫بودن‬ ‫فرض‬ ‫پیش‬ ‫دلیل‬ ‫به‬
myISAM
‫به‬ ‫سازی‬ ‫ذخیره‬ ‫موتور‬ ‫این‬ ‫از‬ ‫هم‬ ‫مواردی‬ ‫در‬ ‫ولی‬ ‫کنند‬ ‫می‬ ‫استفاده‬ ‫آن‬ ‫از‬
. ‫شود‬ ‫می‬ ‫استفاده‬ ‫شده‬ ‫بهینه‬ ‫و‬ ‫هوشمندانه‬ ‫کامال‬ ‫شکل‬
‫منفی‬ ‫و‬ ‫مثبت‬ ‫جوانب‬ ‫از‬ ‫مقایسه‬
، ‫داده‬ ‫پایگاه‬ ‫در‬ ‫سازی‬ ‫ذخیره‬ ‫های‬ ‫موتور‬ ‫اصلی‬ ‫نوع‬ ‫دو‬ ‫در‬
myISAM & InnoDB
‫کرد‬ ‫اشاره‬ ‫زیر‬ ‫موارد‬ ‫به‬ ‫توان‬ ‫می‬
:
innoDB
‫که‬ ‫حالی‬ ‫در‬ ‫است‬ ‫تری‬ ‫جدید‬ ‫ساز‬ ‫ذخیره‬ ‫موتور‬
myISAM
‫است‬ ‫تر‬ ‫گسترده‬
.
innoDB
‫به‬ ‫نسبت‬ ‫بیشتری‬ ‫های‬ ‫پیچیدگی‬
MyISAM
‫دارد‬ ‫ساده‬
.
innoDB
‫نسبت‬ ‫به‬ ‫است‬ ‫تر‬ ‫پاسخگو‬ ‫ها‬ ‫داده‬ ‫نگهداشت‬ ‫در‬
myisam
Innodb
‫از‬
transaction
‫که‬ ‫حالی‬ ‫در‬ ‫کند‬ ‫می‬ ‫پشتیبانی‬ ‫ها‬
myISAM
‫ندارد‬ ‫را‬ ‫قابلیت‬ ‫این‬
.
innoDB
‫که‬ ‫حالی‬ ‫در‬ ‫محدود‬ ‫های‬ ‫ارتباط‬ ‫برای‬ ‫خارجی‬ ‫کلید‬ ‫قابلیت‬ ‫دارای‬
myisam
‫کند‬ ‫نمی‬ ‫پشتیبانی‬ ‫را‬ ‫ان‬
.
myISAM
‫قابلیت‬
full-text
‫ولی‬ ‫دارد‬ ‫را‬ ‫ها‬ ‫ایندکس‬ ‫در‬
InnoDB
‫کند‬ ‫نمی‬ ‫پشتیبانی‬
.
‫باال‬ ‫موارد‬ ‫از‬ ‫بسیاری‬ ‫در‬ ‫است‬ ‫درست‬
Innodb
‫دوتا‬ ‫این‬ ‫از‬ ‫کدام‬ ‫هر‬ ‫ولی‬ ‫است‬ ‫شده‬ ‫مطرح‬ ‫که‬ ‫دارد‬ ‫قوتی‬ ‫نقاط‬
‫را‬ ‫یکی‬ ‫میتواند‬ ‫نیاز‬ ‫اساس‬ ‫بر‬ ‫پروژه‬ ‫دیتابیس‬ ‫معمار‬ ‫که‬ ‫دارند‬ ‫را‬ ‫هایی‬ ‫ضعف‬ ‫و‬ ‫توانایی‬ ‫سازی‬ ‫ذخیره‬ ‫موتور‬
‫کند‬ ‫انتخاب‬
.
‫از‬ ‫استفاده‬ ‫معایب‬
Innodb
:
‫در‬ ‫اینکه‬ ‫دلیل‬ ‫به‬
Innodb
‫معمار‬ ‫لذا‬ ‫دارید‬ ‫را‬ ‫داده‬ ‫پایگاه‬ ‫درون‬ ‫جداول‬ ‫بین‬ ‫روابط‬ ‫تمام‬ ‫از‬ ‫مراقبت‬ ‫به‬ ‫نیاز‬ ‫شما‬
‫نسبت‬ ‫به‬ ‫طراحی‬ ‫برای‬ ‫بیشتری‬ ‫زمان‬ ‫گذاشتن‬ ‫به‬ ‫نیاز‬ ‫شما‬ ‫دیتابیس‬
myisam
‫باشد‬ ‫می‬
.
‫به‬ ‫نسبت‬ ‫بیشتری‬ ‫سیستم‬ ‫اصلی‬ ‫فضا‬ ‫از‬ ‫استفاده‬
Myisam
‫باشد‬ ‫می‬
.
‫خود‬ ‫سایت‬ ‫در‬ ‫وقتی‬ ‫البته‬ ‫که‬
mysql
‫یا‬
‫حالت‬ ‫در‬ ‫شما‬ ‫داده‬ ‫پایگاه‬ ‫ساختار‬ ‫که‬ ‫صورتی‬ ‫در‬ ‫که‬ ‫دارد‬ ‫اشاره‬ ‫نکته‬ ‫این‬ ‫بر‬ ‫اکیدا‬ ‫کنید‬ ‫می‬ ‫مطالعه‬ ‫شما‬ ‫اوراکل‬
Innodb
‫موتور‬ ‫باشد‬ ‫نمی‬
Innodb
‫شده‬ ‫نصب‬
(
‫سرویس‬
)
‫کنید‬ ‫خاموش‬ ‫را‬ ‫ان‬
.
‫های‬ ‫قابلیت‬ ‫از‬ ‫پشتیبانی‬ ‫در‬ ‫ناتوانی‬
transaction
‫حساس‬ ‫های‬ ‫داده‬ ‫پایگاه‬ ‫برای‬
‫از‬ ‫استفاده‬ ‫مزایای‬
Myisam
:
‫باشد‬ ‫می‬ ‫داده‬ ‫پایگاه‬ ‫های‬ ‫پروژه‬ ‫در‬ ‫مبتدیان‬ ‫برای‬ ‫راهکار‬ ‫بهترین‬ ‫بنابراین‬ ، ‫ساده‬ ‫بسیار‬ ‫سازی‬ ‫پیاده‬ ‫و‬ ‫طراحی‬
.
‫جداول‬ ‫بین‬ ‫در‬ ‫خارجی‬ ‫روابط‬ ‫برای‬ ‫طراحی‬ ‫به‬ ‫نیاز‬ ‫عدم‬
‫از‬ ‫تر‬ ‫سریع‬ ‫بسیار‬ ، ‫سبک‬ ‫های‬ ‫داده‬ ‫پایگاه‬ ‫در‬
innodb
‫تر‬ ‫پایین‬ ‫نیز‬ ‫هم‬ ‫سرور‬ ‫نگهداری‬ ‫هزینه‬ ‫پس‬ ، ‫باشد‬ ‫می‬
‫است‬
.
‫هنگام‬ ‫در‬ ‫بیشتر‬ ‫سرعت‬ ‫برای‬ ‫ها‬ ‫داده‬ ‫سازی‬ ‫فشرده‬ ‫امکان‬
select
‫جداول‬ ‫از‬ ‫گرفتن‬
‫معایب‬
myISAM
:
‫واقع‬ ‫در‬ ‫باشد‬ ‫داشته‬ ‫وجود‬ ‫عیب‬ ‫این‬ ‫که‬ ‫هنگامی‬ ، ‫جداول‬ ‫بین‬ ‫ارتباط‬ ، ‫ها‬ ‫داده‬ ‫تمامیت‬ ‫مدیریت‬ ‫عدم‬
‫پروژه‬ ‫های‬ ‫نویس‬ ‫برنامه‬ ‫برای‬ ‫شود‬ ‫می‬ ‫سربار‬ ‫فرآیندی‬ ‫جداول‬ ‫بین‬ ‫رابطه‬ ‫کردن‬ ‫درست‬ ‫مسئولیت‬
.
‫از‬ ‫پشتیبانی‬ ‫توانایی‬
transaction
‫می‬ ‫توجه‬ ‫مورد‬ ‫بسیار‬ ‫بانکداری‬ ‫مانند‬ ‫حساس‬ ‫و‬ ‫کاربردی‬ ‫های‬ ‫برنامه‬ ‫در‬ ‫که‬ ‫ها‬
. ‫ندارد‬ ‫را‬ ‫باشند‬
‫از‬ ‫تر‬ ‫کند‬ ‫بسیار‬ ، ‫داده‬ ‫پایگاه‬ ‫توسط‬ ‫شوند‬ ‫مدیریت‬ ‫باال‬ ‫ها‬ ‫رکورد‬ ‫است‬ ‫قرار‬ ‫که‬ ‫حالتی‬ ‫در‬
InnoDB
‫مثال‬ ‫باشد‬ ‫می‬
‫می‬ ‫انجام‬ ‫را‬ ‫جدول‬ ‫سازی‬ ‫آزاد‬ ‫کار‬ ‫اتمام‬ ‫از‬ ‫بعد‬ ‫و‬ ‫کند‬ ‫می‬ ‫قفل‬ ‫را‬ ‫جدول‬ ‫کل‬ ، ‫خاص‬ ‫رکورد‬ ‫یک‬ ‫کردن‬ ‫اضافه‬ ‫برای‬
‫دهد‬
.
‫نتیجه‬
:
‫از‬ ‫باید‬ ‫باشیم‬ ‫داشته‬ ‫مکرر‬ ‫ها‬ ‫رسانی‬ ‫روز‬ ‫به‬ ‫سیستم‬ ‫در‬ ‫بخواهیم‬ ‫اگر‬ ‫کرد‬ ‫ساده‬ ‫توان‬ ‫می‬ ‫را‬ ‫مقایسه‬
Innodb
‫کردن‬ ‫اضافه‬ ‫و‬ ‫نمایش‬ ‫و‬ ‫انتخاب‬ ‫به‬ ‫کلی‬ ‫نیاز‬ ‫سیستم‬ ‫در‬ ‫فقط‬ ، ‫دیگر‬ ‫سوی‬ ‫از‬ ‫اگر‬ ‫و‬ ‫کنیم‬ ‫استفاده‬ ‫حتما‬
‫از‬ ‫حتما‬ ‫باشد‬ ‫می‬ ‫تر‬ ‫ساده‬ ‫های‬ ‫پروژه‬ ‫حد‬ ‫در‬ ‫ها‬ ‫رکورد‬
myISAM
‫کنید‬ ‫استفاده‬
.
‫پ‬
.
‫ن‬
:
Full Text Search
‫امکان‬
index
‫در‬ ‫کلیدی‬ ‫لغات‬ ‫مبنای‬ ‫بر‬ ‫را‬ ‫متنی‬ ‫دیتای‬ ‫جستجوی‬ ‫و‬ ‫کردن‬
SQL
Server
‫کند‬ ‫می‬ ‫فراهم‬
.
‫خالف‬ ‫بر‬
LIKE
، ‫کاراکترهاست‬ ‫روی‬ ‫آن‬ ‫عمل‬ ‫محدوده‬ ‫که‬
Full Text Search
‫روی‬ ‫بر‬
‫دهد‬ ‫می‬ ‫انجام‬ ‫جو‬ ‫و‬ ‫پرس‬ ، ‫متن‬ ‫زبان‬ ‫مبنای‬ ‫بر‬ ‫کلمات‬
.
‫سرعت‬ ‫اختالف‬
Full Text Search
‫و‬
LIKE
‫که‬ ‫زمانی‬ ‫در‬
‫یک‬ ‫خواهیم‬ ‫می‬
Query
‫است‬ ‫مشهود‬ ‫بسیار‬ ‫کنیم‬ ‫اجرا‬ ‫رکورد‬ ‫میلیون‬ ‫چند‬ ‫روی‬ ‫بر‬ ‫را‬
.
‫با‬ ‫اگر‬
LIKE
‫یک‬ ‫دنبال‬
‫از‬ ‫استفاده‬ ‫که‬ ‫حالی‬ ‫در‬ ‫بکشد‬ ‫طول‬ ‫دقیقه‬ ‫چندین‬ ‫است‬ ‫ممکن‬ ‫گزارش‬ ‫تهیه‬ ، ‫بگردیم‬ ‫ترکیب‬
Full Text Search
‫دهد‬ ‫می‬ ‫کاهش‬ ‫ثانیه‬ ‫چند‬ ‫به‬ ‫را‬ ‫آن‬
.
‫از‬ ‫توان‬ ‫می‬ ‫چگونه‬ ‫اما‬ ‫و‬
full text search
: ‫کرد‬ ‫استفاده‬
: ‫باشد‬ ‫می‬ ‫زیر‬ ‫شرح‬ ‫به‬ ‫آن‬ ‫ساختار‬ ‫کلی‬ ‫شکل‬
MATCH (col1,col2,col3...) AGAINST (expr [search_modifier])
SELECT * FROM table_name WHERE MATCH(col1, col2) AGAINST('search terms'
IN NATURAL LANGUAGE MODE)
‫هر‬ ‫های‬ ‫ویژگی‬ ‫اما‬
engine
: ‫است‬ ‫صورتی‬ ‫چه‬ ‫به‬
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
. ‫است‬ ‫سازی‬ ‫پیاده‬ ‫قابل‬ ‫جدول‬ ‫هر‬ ‫ساختار‬ ‫هر‬ ‫در‬ ‫و‬ ‫فرض‬ ‫پیش‬ ‫صورت‬ ‫به‬ ‫روند‬ ‫این‬
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
InnoDB’s history
InnoDB has a complex release history, but it’s very helpful to understand it. In 2008,the so-
called InnoDB plugin was released for MySQL 5.1. This was the next generation of InnoDB
created by Oracle, which at that time owned InnoDB but not MySQL. For various reasons that
are great to discuss over beers, MySQL continued shipping the older version of InnoDB,
compiled into the server. But you could disable this and install the newer, better-performing,
more scalable InnoDB plugin if you wished. Eventually, Oracle acquired Sun Microsystems
and thus MySQL, and removed the older codebase, replacing it with the “plugin” by default in
MySQL 5.5. (Yes, this means that now the “plugin” is actually compiled in, not installed as a
plugin. Old terminology dies hard.)
The modern version of InnoDB, introduced as the InnoDB plugin in MySQL 5.1, sports new
features such as building indexes by sorting, the ability to drop and add indexes without
rebuilding the whole table, and a new storage format that offers compression, a new way to
store large values such as BLOB columns, and file format management. Many people who
use MySQL 5.1 don’t use the plugin, sometimes because they aren’t aware of it. If you’re
using MySQL 5.1, please ensure that you’re using the InnoDB plugin. It’s much better than the
older version of InnoDB. InnoDB is such an important engine that many people and
companies have invested in developing it, not just Oracle’s team. Notable contributions have
come from Google, Yasufumi Kinoshita, Percona, and Facebook, among others. Some of
these improve-ments have been included into the official InnoDB source code, and many
others have been reimplemented in slightly different ways by the InnoDB team. In
general,InnoDB’s development has accelerated greatly in the last few years, with major im-
provements to instrumentation, scalability, configurability, performance, features, and support
for Windows, among other notable items. MySQL 5.6 lab previews and mile- stone releases
include a remarkable palette of new features for InnoDB, too. Oracle is investing tremendous
resources in improving InnoDB performance, and doing
a great job of it (a considerable amount of external contribution has helped with this,too). In
the second edition of this book, we noted that InnoDB failed pretty miserably beyond four
CPU cores. It now scales well to 24 CPU cores, and arguably up to 32 or even more cores
depending on the scenario. Many improvements are slated for the upcoming 5.6 release, but
there are still opportunities for enhancement.
Column-oriented storage engines MySQL is row-oriented by default, meaning that each row’s
data is stored together, and the server works in units of rows as it executes queries. But for
very large volumes of data, a column-oriented approach can be more efficient; it allows the
engine to re-trieve less data when full rows aren’t needed, and when each column is stored
sepa-rately, it can often be compressed more effectively.
Community storage engines
A full list of community storage engines would run into the scores, and perhaps even to triple
digits if we researched them exhaustively. However, it’s safe to say that most of them serve
very limited niches, and many aren’t known or used by more than a few
people. We’ll just mention a few of them. We haven’t seen most of these in production use.
Caveat emptor!
Aria
Aria, formerly named Maria, is the original MySQL creator’s planned successor to
MyISAM. It’s available in MariaDB. Many of the features that were planned for it
seem to have been deferred in favor of improvements elsewhere in the MariaDB
server. At the time of writing it is probably best to describe it as a crash-safe version
of MyISAM, with several other improvements such as the ability to cache data (not
just indexes) in its own memory.
Groonga
This is a full-text search storage engine that claims to offer accuracy and high speed.
OQGraph
This engine from Open Query supports graph operations (think “find the shortest
path between nodes”) that are impractical or impossible to perform in SQL.
Q4M
This engine implements a queue inside MySQL, with support for operations that
SQL itself makes quite difficult or impossible to do in a single statement.
SphinxSE
This engine provides a SQL interface to the Sphinx full-text search server, which
we discuss more in Appendix F.
Spider
This engine partitions data into several partitions, effectively implementing trans-
parent sharding, and executes your queries in parallel across shards, which can be
located on different servers.
VPForMySQL
This engine supports vertical partitioning of tables through a sort of proxy storage
engine. That is, you can chop a table into several sets of columns and store those
independently, but query them as a single table. It’s by the same author as the
Spider engine.
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
‫باال‬ ‫کارایی‬ ‫و‬ ‫پرفرمنس‬ : ‫فصل‬
‫؟‬ ‫معناست‬ ‫چه‬ ‫به‬ ‫داده‬ ‫پایگاه‬ ‫در‬ ‫بندی‬ ‫پارتیشن‬
‫ورژن‬ ‫از‬ ‫که‬ ‫است‬ ‫کاربردی‬ ‫ویژگی‬ ‫یک‬ ‫ویژگی‬ ‫این‬
5.5
‫بعد‬ ‫به‬
Mysql
. ‫شد‬ ‫گنجانده‬
‫فهرست‬ ‫جدولی‬ ‫در‬ ‫اگر‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫است‬ ‫‌تر‬
‫ل‬‫مستق‬ ‫‌های‬
‫ت‬‫قسم‬ ‫به‬ ‫‌ها‬
‫ه‬‫داد‬ ‫تقسیم‬ ،‫‌بندی‬
‫ن‬‫پارتیش‬ ‫از‬ ‫منظور‬
‫جدول‬ ‫همان‬ ‫در‬ ...‫و‬ ‫تولد‬ ‫سال‬ ،‫جنسیت‬ ‫همچون‬ ‫معیارهایی‬ ‫با‬ ‫را‬ ‫‌ها‬
‫ن‬‫آ‬ ‫توانید‬ ‫می‬ ،‫دارید‬ ‫می‬ ‫نگه‬ ‫را‬ ‫اشخاص‬
.‫شود‬ ‫می‬ ‫‌ها‬
‫ه‬‫داد‬ ‫بیشتر‬ ‫پذیری‬ ‫دسترس‬ ‫نتیجه‬ ‫در‬ ‫و‬ ‫کارایی‬ ‫افزایش‬ ‫سبب‬ ‫کار‬ ‫این‬ .‫نمایید‬ ‫‌بندی‬
‫ه‬‫دست‬
: ‫آن‬ ‫های‬ ‫معیار‬ ‫و‬ ‫بندی‬ ‫پارتیشن‬ ‫انواع‬
‫این‬ ‫برای‬ .‫دارد‬ ‫وجود‬ ‫داده‬ ‫پایگاه‬ ‫تقسیم‬ ‫جهت‬ ‫گوناگونی‬ ‫ضوابط‬ ‫و‬ ‫معیارها‬ ‫‌ای‬
‫ه‬‫رابط‬ ‫داده‬ ‫‌های‬
‫ه‬‫پایگا‬ ‫نوع‬ ‫در‬
( ‫‌بندی‬
‫ن‬‫پارتیش‬ ‫کلید‬ ‫یک‬ ‫ابتدا‬ ،‫منظور‬
Partitioning Key
‫معیارهای‬ ‫و‬ ‫آن‬ ‫اساس‬ ‫بر‬ ‫سپس‬ ‫و‬ ‫کرده‬ ‫تعریف‬ ‫را‬ )
:‫از‬ ‫عبارتند‬ ‫معیارها‬ ‫‌ترین‬
‫ی‬‫عموم‬ .‫‌کنند‬
‫ی‬‫م‬ ‫تقسیم‬ ‫مختلف‬ ‫‌های‬
‫ن‬‫پارتیش‬ ‫را‬ ‫‌ها‬
‫ه‬‫داد‬ ‫مشخص‬
( ‫‌ای‬
‫ه‬‫محدود‬ ‫‌بندی‬
‫ن‬‫پارتیش‬
Range partitioning
)
‫ده‬ ‫کدپستی‬ ‫اطالعات‬ ‫که‬ ‫کنید‬ ‫فرض‬ .‫‌پذیرد‬
‫ی‬‫م‬ ‫صورت‬ ‫شده‬ ‫داده‬ ‫کلید‬ ‫و‬ ‫آن‬ ‫محدوده‬ ‫براساس‬ ‫پارتیشن‬ ‫انتخاب‬
‫در‬ ‫داده‬ ‫پایگاه‬ ‫در‬ ‫رقمی‬
۹
‫دسته‬
۱۰۰۰۰۰۰۰۰۰
‫این‬ ‫از‬ ‫یکی‬ ‫در‬ ‫شده‬ ‫داده‬ ‫کلید‬ ‫که‬ ‫صورتی‬ ‫در‬ .‫اند‬ ‫شده‬ ‫تقسیم‬
۹
‫کلید‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫گرفت‬ ‫خواهند‬ ‫قرار‬ ‫بررسی‬ ‫مورد‬ ‫محدوده‬ ‫آن‬ ‫در‬ ‫موجود‬ ‫اطالعات‬ ‫فقط‬ ،‫باشد‬ ‫محدوده‬
)‫(کدپستی‬
۶۸۹۵۶۳۲۶۵۳
‫محدوده‬ ‫فقط‬ ‫که‬ ‫کند‬ ‫می‬ ‫مشخص‬
۶۰۰۰۰۰۰۰۰۰
‫تا‬
۶۹۹۹۹۹۹۹۹۹
‫یعنی‬ .‫شود‬ ‫بررسی‬
‫تقریبا‬
۱/۹
.‫نظر‬ ‫مورد‬ ‫جدول‬ ‫اطالعات‬ ‫کل‬
( ‫‌وار‬
‫ت‬‫فهرس‬ ‫‌بندی‬
‫ن‬‫پارتیش‬
List partitioning
)
‫مرکزی‬ ،‫شرقی‬ ،‫غربی‬ ‫‌های‬
‫ن‬‫استا‬ ‫فهرست‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫‌شوند‬
‫ی‬‫م‬ ‫مشخص‬ ‫فهرست‬ ‫یک‬ ‫اساس‬ ‫بر‬ ‫‌ها‬
‫ن‬‫پارتیش‬
‫‌های‬
‫ن‬‫استا‬ ‫عنوان‬ ‫با‬ ‫پارتیشنی‬ ‫‌توانند‬
‫ی‬‫م‬ ‫زنجان‬ ‫و‬ ‫اردبیل‬ ،‫شرقی‬ ‫آذربایجان‬ ،‫غربی‬ ‫آذربایجان‬ ‫‌های‬
‫ن‬‫استا‬ ‫مثال‬ . ...‫و‬
‫‌غربی‬
‫ل‬‫شما‬ ‫‌های‬
‫ن‬‫استا‬ ‫‌های‬
‫ه‬‫داد‬ ‫فقط‬ ،‫باشد‬ ‫اردبیل‬ ‫آدرس‬ ‫یک‬ ‫استان‬ ‫صورتیکه‬ ‫در‬ .‫دهند‬ ‫تشکیل‬ ‫‌غریی‬
‫ل‬‫شما‬
.‫‌شوند‬
‫ی‬‫م‬ ‫بررسی‬
( ‫درهم‬ ‫‌بندی‬
‫ن‬‫پارتیش‬
Hash partitioning
)
( ‫‌سازی‬
‫م‬‫دره‬ ‫تابع‬ ‫و‬ ‫کلید‬ ‫یک‬ ‫اساس‬ ‫بر‬ ‫‌ها‬
‫ه‬‫داد‬ ،‫‌بندی‬
‫ن‬‫پارتیش‬ ‫نوع‬ ‫این‬ ‫در‬
hash function
‫‌های‬
‫ن‬‫پارتیش‬ ‫به‬ )
.‫‌شوند‬
‫ی‬‫م‬ ‫تقسیم‬ ‫مختلف‬
( ‫کلیدی‬ ‫‌بندی‬
‫ن‬‫پارتیش‬
Key partitioning
)
‫صورت‬ ‫به‬ ‫اطالعات‬ ‫قرارگیری‬ ‫نحوه‬ ‫که‬ ‫تفاوت‬ ‫این‬ ‫با‬ ‫است‬ ‫درهم‬ ‫‌بندی‬
‫ن‬‫پارتیش‬ ‫مانند‬ ‫‌بندی‬
‫ن‬‫پارتیش‬ ‫نوع‬ ‫این‬
.‫‌گیرد‬
‫ی‬‫م‬ ‫صورت‬ ‫داده‬ ‫پایگاه‬ ‫توسط‬ ‫خودکار‬
( ‫ترکیبی‬ ‫‌بندی‬
‫ن‬‫پارتیش‬
Composite partitioning
)
.‫است‬ ‫‌ها‬
‫ی‬‫‌بند‬
‫ن‬‫پارتیش‬ ‫انواع‬ ‫از‬ ‫‌ای‬
‫ه‬‫مجموع‬ ،‫ترکیبی‬ ‫‌بندی‬
‫ن‬‫پارتیش‬ ،‫است‬ ‫مشخص‬ ‫وی‬ ‫نام‬ ‫از‬ ‫که‬ ‫همانگونه‬
‫شده‬ ‫‌بندی‬
‫ن‬‫پارتیش‬ ‫اطالعات‬ ‫ذخیره‬ ‫‌های‬
‫ش‬‫رو‬
‫‌تر‬
‫ک‬‫کوچ‬ ‫قطعات‬ ‫در‬ ‫و‬ ‫کرده‬ ‫تقسیم‬ ‫را‬ ...‫و‬ ‫‌ها‬
‫ف‬‫ردی‬ ،‫جداول‬ ‫یا‬ ‫و‬ ‫داده‬ ‫پایگاه‬ ‫کل‬ ‫مانند‬ ‫اطالعاتی‬ ،‫‌بندی‬
‫ن‬‫پارتیش‬
( ‫افقی‬ ‫صورت‬ ‫به‬ ‫‌توان‬
‫ي‬‫م‬ ‫جدول‬ ‫یک‬ ‫در‬ ‫موجود‬ ‫‌های‬
‫ف‬‫ردی‬ ‫کردن‬ ‫تقسیم‬ ‫برای‬ .‫‌کند‬
‫ی‬‫م‬ ‫ذخیره‬
Horizontal
‫و‬ )
( ‫عمودی‬
Vertical
.‫کرد‬ ‫عمل‬ )
‫حالت‬ ‫در‬
( ‫افقی‬
Horizontal
)
‫در‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫‌شوند‬
‫ی‬‫م‬ ‫ذخیره‬ ‫جداگانه‬ ‫‌های‬
‫ل‬‫جدو‬ ‫در‬ ‫مختلف‬ ‫‌های‬
‫ف‬‫ردی‬
‫از‬ ‫کمتر‬ ‫آنان‬ ‫کدپستی‬ ‫که‬ ‫افرادی‬ ،‫مشتریان‬ ‫جدول‬
50000
( ‫شرقی‬ ‫مشتریان‬ ‫جدول‬ ‫در‬ ‫باشد‬
CustomerEast
‫و‬ )
‫باالی‬ ‫کدپستی‬ ‫دارای‬ ‫که‬ ‫افرادی‬ ‫باقی‬
50000
( ‫غربی‬ ‫مشتریان‬ ‫جدول‬ ‫در‬ ‫‌باشند‬
‫ی‬‫م‬
CustomerWest
‫ذخیره‬ )
‫از‬ ‫استفاده‬ ‫با‬ ‫توان‬ ‫می‬ ‫مشتریان‬ ‫تمامی‬ ‫به‬ ‫دستیابی‬ ‫برای‬ ‫همچنین‬ .‫‌شوند‬
‫ی‬‫م‬
UNION
‫یک‬
VIEW
‫که‬ ‫کرد‬ ‫ایجاد‬
.‫باشد‬ ‫‌ها‬
‫ف‬‫ردی‬ ‫تمامی‬ ‫شامل‬
‫در‬
( ‫عمودی‬ ‫حالت‬
Vertical
)
‫متناظر‬ ‫صورت‬ ‫به‬ ‫‌ها‬
‫ن‬‫ستو‬ ‫بقیه‬ ‫و‬ ‫‌گیرند‬
‫ی‬‫م‬ ‫قرار‬ ‫اصلی‬ ‫جدول‬ ‫در‬ ‫کمتری‬ ‫‌های‬
‫ن‬‫ستو‬
‫و‬ ‫ثابت‬ ‫نسبتا‬ ‫اطالعات‬ ‫با‬ ‫‌هایی‬
‫ن‬‫ستو‬ ‫جداکردن‬ ‫روش‬ ‫این‬ ‫کاربرد‬ ‫‌ترین‬
‫ی‬‫عموم‬ .‫‌گیرند‬
‫ی‬‫م‬ ‫قرار‬ ‫دیگر‬ ‫‌های‬
‫ل‬‫جدو‬ ‫در‬
‫فعلی‬ ‫نسخه‬ .‫است‬ ‫متغیر‬ ‫اطالعات‬ ‫با‬ ‫‌هایی‬
‫ن‬‫ستو‬
MySQL 5.6
.‫‌شود‬
‫ی‬‫نم‬ ‫پشتیبانی‬ ‫عمودی‬ ‫حالت‬ ‫از‬
‫داریم؟‬ ‫نیاز‬ ‫داده‬ ‫پایگاه‬ ‫‌بندی‬
‫ن‬‫پارتیش‬ ‫به‬ ‫چرا‬ ‫و‬ ‫زمانی‬ ‫چه‬
:‫‌انجامد‬
‫ی‬‫م‬ ‫بازدهی‬ ‫محسوس‬ ‫افزایش‬ ‫به‬ ‫‌بندی‬
‫ن‬‫پارتیش‬ ‫از‬ ‫استفاده‬ ‫زیر‬ ‫موارد‬ ‫در‬
•
‫زیاد‬ ‫خیلی‬ ‫‌های‬
‫ه‬‫داد‬
•
‫حافظه‬ ‫کمبود‬
RAM
•
‫های‬ ‫داده‬
HISTORICAL
•
‫ها‬ ‫داده‬ ‫حجم‬ ‫افزایش‬
•
‫مشخص‬ ‫‌های‬
‫ی‬‫‌بند‬
‫ه‬‫دست‬ ‫با‬ ‫‌هایی‬
‫ه‬‫داد‬
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
( ‫کوئری‬ ‫اجرای‬ ‫هنگام‬
Query
‫جدول‬ ‫کل‬ ‫روی‬ ‫بر‬ ‫دستور‬ ،‫باشد‬ ‫نشده‬ ‫‌بندی‬
‫ن‬‫پارتیش‬ ‫نظر‬ ‫مورد‬ ‫جدول‬ ‫صورتیکه‬ ‫در‬ )
:‫مانند‬ .‫‌شود‬
‫ی‬‫م‬ ‫اجرا‬
مرجع oracle mysql |mariadb
‫اجرای‬ ‫هنگام‬ ،‫نمایید‬ ‫‌بندی‬
‫ن‬‫پارتیش‬ ‫را‬ ‫نظر‬ ‫مورد‬ ‫جدول‬ ‫اگر‬ ‫حال‬
Query
)‫پارتیشن(های‬ ‫فقط‬ ‫بررسی‬ ‫‌ی‬
‫ه‬‫محدود‬ ،
‫بررسی‬ ‫را‬ ‫زیر‬ ‫شده‬ ‫مشخص‬ ‫‌های‬
‫ه‬‫محدود‬ ،‫جدول‬ ‫‌بندی‬
‫ن‬‫پارتیش‬ ‫فرض‬ ‫با‬ ‫قبلی‬ ‫دستورات‬ .‫‌شود‬
‫ی‬‫م‬ ‫شامل‬ ‫را‬ ‫مرتبط‬
:‫‌نماید‬
‫ی‬‫م‬
مرجع oracle mysql |mariadb
: ‫کنید‬ ‫استفاده‬ ‫بندی‬ ‫پارتیشن‬ ‫از‬ ‫باید‬ ‫که‬ ‫دلیل‬ ‫چند‬
•
‫به‬ ‫بخشیدن‬ ‫سرعت‬
select
‫و‬
insert
•
‫های‬ ‫محدوده‬ ‫سریعتر‬ ‫نتایج‬ ‫آوردن‬ ‫بدست‬
select
•
‫مختلف‬ ‫های‬ ‫مسیر‬ ‫دستیابی‬ ‫برای‬ ‫ها‬ ‫داده‬ ‫جداسازی‬ ‫به‬ ‫کمک‬
•
‫ها‬ ‫داده‬ ‫به‬ ‫ای‬ ‫تاریخچه‬ ‫دسترسی‬ ‫ذخیره‬
•
‫ای‬ ‫محدوده‬ ‫های‬ ‫داده‬ ‫سریعتر‬ ‫حذف‬
•
… ‫و‬
: ‫بندی‬ ‫پارتیشن‬ ‫محدودیت‬
( ‫عدد‬ ‫نوع‬ ‫از‬ ‫ستونی‬ ‫توسط‬ ‫بایستی‬ ‫پارتیشن‬
INTEGER
‫شما‬ ‫حال‬ ‫این‬ ‫با‬ .‫باشد‬ ‫شده‬ ‫مشخص‬ )
:‫دهید‬ ‫بسط‬ ‫را‬ ‫‌بندی‬
‫ن‬‫پارتیش‬ ‫زیر‬ ‫موارد‬ ‫رعایت‬ ‫با‬ ‫ستون‬ ‫این‬ ‫جای‬ ‫به‬ ‫‌توانید‬
‫ی‬‫م‬
•
‫صورت‬ ‫به‬ ‫از‬ ‫ستونی‬ ‫اگر‬
Unique Key
‫یا‬
Primary Key
‫ستون‬ ‫این‬ ‫باید‬ ‫‌بندی‬
‫ن‬‫پارتیش‬ ،‫باشد‬ ‫شده‬ ‫تعریف‬
.‫گیرد‬ ‫بر‬ ‫در‬
•
‫توابع‬ ‫(شامل‬ ‫عبارت‬ ‫از‬ ،‫ستون‬ ‫یک‬ ‫جای‬ ‫به‬ ‫توانید‬ ‫می‬ ‫پارتیشن‬ ‫ساخت‬ ‫در‬
MySQL
‫با‬ .‫نمایید‬ ‫استفاده‬ )
.‫بازگرداند‬ ‫را‬ ‫عددی‬ ‫مقدار‬ ‫نظر‬ ‫مورد‬ ‫عبارت‬ ‫که‬ ‫شرط‬ ‫این‬
•
‫عبارت‬ ‫از‬ ‫توانید‬ ‫می‬ ‫عددی‬ ‫محدود‬ ‫ندانستن‬ ‫صورت‬ ‫در‬
MAXVALUE
.‫نمایید‬ ‫استفاده‬ ‫باال‬ ‫بازه‬ ‫برای‬
•
‫‌ها‬
‫ن‬‫پارتیش‬ ‫تعداد‬ ‫حداکثر‬
2
10
=
1024
.‫باشد‬ ‫می‬
‫در‬ ‫‌بندی‬
‫ن‬‫پارتیش‬ ‫‌سازی‬
‫ه‬‫پیاد‬
MySQL|MariaDb
‫پایگاه‬ ‫در‬ ‫اطالعات‬ ‫‌بندی‬
‫ش‬‫پارتی‬ ‫مبحث‬ .‫است‬ ‫منبع‬ ‫خود‬ ‫راهنمای‬ ‫مطالعه‬ ،‫مهارتی‬ ‫هر‬ ‫فراگیری‬ ‫برای‬ ‫راه‬ ‫بهترین‬
‫این‬ ‫حوصله‬ ‫از‬ ‫‌ها‬
‫ن‬‫آ‬ ‫‌ی‬
‫ه‬‫هم‬ ‫به‬ ‫پرداختن‬ ‫که‬ ‫‌باشد‬
‫ی‬‫م‬ ‫زیادی‬ ‫درشت‬ ‫و‬ ‫ریز‬ ‫نکات‬ ‫دارای‬ ‫و‬ ‫بوده‬ ‫گسترده‬ ‫بسیار‬ ‫داده‬
.‫‌اند‬
‫ه‬‫شد‬ ‫ارائه‬ ‫زیر‬ ‫در‬ ‫‌ها‬
‫ن‬‫پارتیش‬ ‫ایجاد‬ ‫نحوه‬ ‫خالصه‬ ‫صورت‬ ‫به‬ ‫حال‬ ‫این‬ ‫با‬ .‫است‬ ‫خارج‬ ‫مقاله‬
( ‫‌ای‬
‫ه‬‫محدود‬ ‫پارتیشن‬ ‫ساخت‬ ‫نحوه‬
Range partitioning
)
1
2
3
4
5
6
7
8
9
CREATE TABLE t1 (
id int
) ENGINE=InnoDB
# or MyISAM, ARCHIVE
PARTITION BY RANGE (id)
(
PARTITION P1 VALUES LESS THAN (10),
PARTITION P2 VALUES LESS THAN (20)
)
( ‫‌وار‬
‫ت‬‫فهرس‬ ‫پارتیشن‬ ‫ساخت‬ ‫نحوه‬
List partitioning
)
1
2
3
4
5
6
7
8
CREATE TABLE t1 (
id int
) ENGINE=InnoDB
PARTITION BY LIST (id)
(
PARTITION P1 VALUES IN (1,2,4),
PARTITION P2 VALUES IN (3,5,9)
)
( ‫درهم‬ ‫پارتیشن‬ ‫ساخت‬ ‫نحوه‬
Hash partitioning
)
1
2
3
4
5
CREATE TABLE t1 (
id int not null primary key
) ENGINE=InnoDB
PARTITION BY HASH (id)
PARTITIONS 10;
( ‫کلیدی‬ ‫پارتیشن‬ ‫ساخت‬ ‫نحوه‬
Key partitioning
)
1
2
3
4
5
CREATE TABLE t1 (
id int not null primary key
) ENGINE=InnoDB
PARTITION BY KEY ()
PARTITIONS 10;
‫های‬ ‫جدول‬ ‫در‬ ‫پارتیشن‬ ‫ساخت‬ ‫نحوه‬ ‫با‬ ‫باال‬ ‫موارد‬ ‫بیشتر‬ ‫درک‬ ‫برای‬
t1
‫و‬
t2
:‫فرمایید‬ ‫توجه‬ ‫زیر‬ ‫در‬
1
2
3
4
5
6
7
8
9
10
11
12
13
14
CREATE TABLE t1 (
d date
) ENGINE=InnoDB
PARTITION BY RANGE (YEAR(d))
(
PARTITION P1 VALUES
LESS THAN (1999),
PARTITION P2 VALUES
LESS THAN (2005),
PARTITION P3 VALUES
LESS THAN (2010),
PARTITION P4 VALUES
LESS THAN (MAXVALUE)
)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
CREATE TABLE t2 (
d date
) ENGINE=InnoDB
PARTITION BY RANGE (TO_DAYS(d))
(
PARTITION P1 VALUES
LESS THAN (TO_DAYS('1999-01-01')),
PARTITION P2 VALUES
LESS THAN (TO_DAYS('2005-01-01')),
PARTITION P3 VALUES
LESS THAN (TO_DAYS('2010-01-01')),
PARTITION P4 VALUES
LESS THAN (MAXVALUE)
)
CREATE TABLE t1 (
id INT NOT NULL,
fname VARCHAR(30),
lname VARCHAR(30),
hired DATE NOT NULL DEFAULT '1970-01-01',
separated DATE NOT NULL DEFAULT '9999-12-31',
job_code INT NOT NULL,
store_id INT NOT NULL
)
PARTITION BY RANGE (store_id) (
PARTITION p0 VALUES LESS THAN (6),
PARTITION p1 VALUES LESS THAN (11),
PARTITION p2 VALUES LESS THAN (16),
PARTITION p3 VALUES LESS THAN (21)
);
‫دارد؟‬ ‫تاثیر‬ ‫دستورات‬ ‫اجرای‬ ‫سرعت‬ ‫در‬ ‫چقدر‬ ‫‌بندی‬
‫ن‬‫پارتیش‬
‫از‬ ‫منظور‬ ‫این‬ ‫برای‬ .‫داریم‬ ‫اطالعات‬ ‫توجهی‬ ‫قابل‬ ‫مقدار‬ ‫با‬ ‫داده‬ ‫پایگاه‬ ‫یک‬ ‫به‬ ‫نیاز‬ ‫‌بندی‬
‫ن‬‫پارتیش‬ ‫تاثیر‬ ‫بررسی‬ ‫برای‬
‫پروژه‬
MySQL Employees Test Database
‫حدودا‬ ‫شامل‬ ‫که‬
۴
‫در‬ ‫رکورد‬ ‫میلیون‬
۶
‫استفاده‬ ‫است‬ ‫جدول‬
:‫‌کنید‬
‫ی‬‫م‬ ‫مشاهده‬ ‫را‬ ‫داده‬ ‫پایگاه‬ ‫این‬ ‫ساختار‬ ‫زیر‬ ‫در‬ .‫‌ایم‬
‫ه‬‫کرد‬
( ‫جستار‬ ‫به‬
Query
:‫فرمایید‬ ‫توجه‬ ‫آن‬ ‫اجرای‬ ‫زمان‬ ‫و‬ ‫زیر‬ )
1
2
3
4
5
6
7
SELECT COUNT(*) FROM salaries WHERE from_date BETWEEN '1999-01-01' AND
'1999-12-31';
+----------+
| COUNT(*) |
+----------+
| 260957 |
+----------+
1 row in set (1.07 sec)
:‫‌بندی‬
‫ن‬‫پارتیش‬ ‫از‬ ‫بعد‬ ‫دستور‬ ‫همان‬ ‫و‬
1
2
3
4
5
6
7
SELECT COUNT(*) FROM salaries WHERE from_date BETWEEN '1999-01-01' AND
'1999-12-31';
+----------+
| COUNT(*) |
+----------+
| 260957 |
+----------+
1 row in set (0.32 sec)
( ‫جستار‬ ‫به‬ ‫اطالعات‬ ‫حذف‬ ‫سرعت‬ ‫افزایش‬ ‫برای‬ ‫‌بندی‬
‫ن‬‫پارتیش‬ ‫عملکرد‬ ‫مشاهده‬ ‫برای‬
Query
‫اجرای‬ ‫زمان‬ ‫و‬ ‫زیر‬ )
:‫فرمایید‬ ‫توجه‬ ‫آن‬
1
2
DELETE FROM salaries WHERE from_date BETWEEN '1999-01-01' AND '1999-12-
31';
Query OK, 247489 rows affected (10.57 sec)
:‫‌بندی‬
‫ن‬‫پارتیش‬ ‫از‬ ‫بعد‬ ‫حذف‬ ‫دستور‬ ‫همان‬ ‫و‬
1
2
ALTER TABLE salaries DROP PARTITION p15;
Query OK, 0 rows affected (1.35 sec)
‫جدول‬ ‫‌بندی‬
‫ن‬‫پارتیش‬ ‫نحوه‬
salaries
‫داده‬ ‫پایگاه‬ ‫در‬
employees
( ‫‌ها‬
‫ق‬‫حقو‬ ‫جدول‬ ‫‌بندی‬
‫ن‬‫پارتیش‬ ‫دستور‬ ‫زیر‬ ‫در‬
salaries
( ‫‌ای‬
‫ه‬‫محدود‬ ‫صورت‬ ‫به‬ )
RANGE
‫سال‬ ‫تاریخ‬ ‫اساس‬ ‫بر‬ )
from_date
:‫‌فرمایید‬
‫ی‬‫م‬ ‫مشاهده‬
ALTER TABLE salaries
PARTITION BY RANGE (YEAR(from_date))
(
PARTITION p1 VALUES LESS THAN (1985),
PARTITION p2 VALUES LESS THAN (1986),
PARTITION p3 VALUES LESS THAN (1987),
PARTITION p4 VALUES LESS THAN (1988),
PARTITION p5 VALUES LESS THAN (1989),
PARTITION p6 VALUES LESS THAN (1990),
PARTITION p7 VALUES LESS THAN (1991),
PARTITION p8 VALUES LESS THAN (1992),
PARTITION p9 VALUES LESS THAN (1993),
PARTITION p10 VALUES LESS THAN (1994),
PARTITION p11 VALUES LESS THAN (1995),
PARTITION p12 VALUES LESS THAN (1996),
PARTITION p13 VALUES LESS THAN (1997),
PARTITION p14 VALUES LESS THAN (1998),
PARTITION p15 VALUES LESS THAN (1999),
PARTITION p16 VALUES LESS THAN (2000),
PARTITION p17 VALUES LESS THAN (2001),
PARTITION p18 VALUES LESS THAN (2002),
PARTITION p19 VALUES LESS THAN (2003),
PARTITION p20 VALUES LESS THAN
(MAXVALUE)
)
;
‫خطای‬ ‫با‬ ‫اگر‬ : ‫نکته‬
Cannot delete or update a parent row: a foreign key constraint fails
‫مواجه‬
‫خارجی‬ ‫کلید‬ ‫زیر‬ ‫دستور‬ ‫با‬ ،‫شدید‬
salaries_ibfk_1
:‫نمایید‬ ‫حذف‬ ‫را‬
ALTER TABLE salaries DROP FOREIGN KEY salaries_ibfk_1;
: ‫لیست‬ ‫بواسطه‬ ‫بندی‬ ‫پارتیشن‬
: ‫هش‬ ‫بواسطه‬ ‫بندی‬ ‫پارتیشن‬
‫بواسطه‬ ‫بندی‬ ‫پارتیشن‬
key
:
. ‫شود‬ ‫استفاده‬ ‫آن‬ ‫در‬ ‫زیر‬ ‫مقادیر‬ ‫از‬ ‫باید‬ ‫رنج‬ ، ‫لیست‬ ، ‫هش‬ ‫بندی‬ ‫پارتیشن‬ : ‫نکته‬
‫قابلیت‬ ‫از‬ ‫استفاده‬ ‫برای‬ : ‫نکته‬
partition
. ‫باشد‬ ‫فعال‬ ‫آن‬ ‫پالگین‬ ‫باید‬
. ‫ایم‬ ‫کرده‬ ‫استفاده‬ ‫پارتیشن‬ ‫از‬ ‫هایی‬ ‫ساختار‬ ‫چه‬ ‫داده‬ ‫پایگاه‬ ‫در‬ ‫اینکه‬ ‫فهمیدن‬ ‫چگونگی‬
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
: ‫ها‬ ‫کوئری‬ ‫در‬ ‫کش‬ ‫قابلیت‬ ‫کردن‬ ‫فعال‬
. ‫دارد‬ ‫تکراری‬ ‫های‬ ‫کوئری‬ ‫سرعت‬ ‫افزایش‬ ‫در‬ ‫شایانی‬ ‫کمک‬ ‫کار‬ ‫این‬
‫باید‬ ‫قابلیت‬ ‫این‬ ‫بودن‬ ‫فعال‬ ‫بررسی‬ ‫برای‬
have_query_cache
‫برابر‬
yes
. ‫باشد‬
‫در‬ : ‫نکته‬
mariadb
‫از‬ ‫توان‬ ‫می‬ ‫ان‬ ‫تعغیر‬ ‫برای‬ ‫نبود‬ ‫فعال‬ ‫اگر‬. ‫باشد‬ ‫می‬ ‫فعال‬ ‫فرض‬ ‫پیش‬ ‫بصورت‬ ‫قابلیت‬ ‫این‬
. ‫برد‬ ‫بهره‬ ‫زیر‬ ‫ساختار‬
SET optimizer_switch='subquery_cache=on';
‫ساختارهای‬ ‫از‬
optimizer_switch
: ‫کرد‬ ‫اشاره‬ ‫زیر‬ ‫موارد‬ ‫به‬ ‫توان‬ ‫می‬
. ‫داد‬ ‫تعغییر‬ ‫را‬ ‫کش‬ ‫میزان‬ ‫حجم‬ ‫توان‬ ‫می‬ ‫همچنین‬
: ‫تکمیلی‬ ‫اطالعات‬
query_cache_size
• Description: Size in bytes available to the query cache. About 40KB is needed for query cache
structures, so setting a size lower than this will result in a warning. 0, the default before
MariaDB 10.1.7, effectively disables the query cache. Starting from MariaDB 10.1.7,
query_cache_type is automatically set to ON if the server is started with the query_cache_size
set to a non-zero (and non-default) value.
• Commandline: --query-cache-size=#
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 1M (>= MariaDB 10.1.7), 0 (<= MariaDB 10.1.6) (although frequently given a
default value in some setups)
• Valid Values: 0 upwards in units of 1024.
query_cache_type
• Description: If set to 0, the query cache is disabled (although a buffer of query_cache_size
bytes is still allocated). If set to 1 all SELECT queries will be cached unless SQL_NO_CACHE
is specified. If set to 2 (or DEMAND), only queries with the SQL CACHE clause will be cached.
Note that if the server is started with the query cache disabled, it cannot be enabled at runtime.
Starting from MariaDB 10.1.7, query_cache_type is automatically set to ON if the server is
started with the query_cache_size set to a non-zero (and non-default) value.
• Commandline: --query-cache-type=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: enumeration
• Default Value: OFF (>= MariaDB 10.1.7), ON (<= MariaDB 10.1.6)
• Valid Values: 0 or OFF, 1 or ON, 2 or DEMAND
‫در‬ ‫قابلیت‬ ‫این‬ ‫کردن‬ ‫فعال‬ ‫برای‬ : ‫نکته‬
mysql
‫فایل‬ ‫به‬ ‫توان‬ ‫می‬ ‫را‬ ‫ساختار‬ ‫این‬
my.cnf
. ‫نمود‬ ‫اضافه‬
query_cache_size = 268435456
query_cache_type=1
query_cache_limit=1048576
‫فایل‬ ‫در‬
my.ini
‫و‬ ‫ویندوز‬ ‫در‬
my.cnf
‫پارامتر‬ ‫ها‬ ‫یونیکس‬ ‫و‬ ‫لینوکس‬ ‫در‬
datadir
‫به‬ ‫مربوط‬ ‫پیشفرض‬ ‫دایرکتوری‬
‫های‬ ‫دایرکتوری‬ ‫سازی‬ ‫ذخیره‬
MySQL
،‫دهیم‬ ‫تغییر‬ ‫را‬ ‫محل‬ ‫این‬ ‫تا‬ ‫داریم‬ ‫الزم‬ ‫دلیلی‬ ‫هر‬ ‫به‬ .‫شود‬ ‫می‬ ‫داری‬ ‫نگه‬
‫پارامتر‬ ‫تا‬ ‫است‬ ‫الزم‬ ‫بنابراین‬
datadir
.‫کنیم‬ ‫ویرایش‬ ‫را‬
ِ
‫های‬ ‫داده‬ ‫پایگاه‬ ‫به‬ ‫مربوط‬ ‫های‬ ‫فایل‬ ‫که‬ ‫دایرکتوریی‬ ‫مسیر‬ ‫کردن‬ ‫پیدا‬ ‫برای‬
MySQL
‫یا‬
MariaDB
‫لینوکس‬ ‫در‬ ‫را‬
.‫کنید‬ ‫استفاده‬ ‫زیر‬ ‫دستور‬ ‫از‬ ‫کند‬ ‫می‬ ‫داری‬ ‫نگه‬ ‫ها‬ ‫یونیکس‬ ‫دیگر‬ ‫یا‬
locate my.cnf
‫فایل‬ ‫از‬ ‫است‬ ‫الزم‬ ‫حال‬ ‫هر‬ ‫به‬
my.cnf
‫پارامتر‬
datadir
.‫شود‬ ‫ویرایش‬
datadir=/var/lib/mysql
‫سرویس‬ ‫ابتدا‬ ‫لینوکس‬ ‫در‬
mysql
‫را‬
stop
.‫کنید‬
service mysql stop
OR
etc/init.d/mysql stop/
‫سپس‬
‫دایرکتوری‬ ‫درون‬ ‫های‬ ‫فایل‬ ‫تمامی‬
var/lib/mysql
‫کنیم‬ ‫می‬ ‫فرض‬ .‫کنید‬ ‫منتقل‬ ‫جدید‬ ‫دایرکتوری‬ ‫به‬ ‫را‬ /
‫در‬ ‫را‬ ‫جدید‬ ‫دایرکتوری‬
mnt/mysql_data
‫مجوز‬ ‫با‬ ‫چون‬ ‫و‬ ،‫باشیم‬ ‫گرفته‬ ‫نظر‬ ‫در‬ /
root
‫ایجاد‬ ‫را‬ ‫دایرکتوری‬ ‫این‬
‫و‬ ‫کاربر‬ ‫باید‬ ‫فایل‬ ‫این‬ ‫مالک‬ ‫گروه‬ ‫و‬ ‫مالک‬ .‫دهیم‬ ‫تغییر‬ ‫را‬ ‫فایل‬ ‫مجوز‬ ‫کپی‬ ‫از‬ ‫پس‬ ‫تا‬ ‫است‬ ‫الزم‬ ‫بنابراین‬ ،‫کردیم‬
‫گروه‬
mysql
.‫باشد‬
chown mysql:mysql -R /mnt/mysql_data
chmod -R 777 /mnt/mysql_data
‫فایل‬ ‫سپس‬
my.cnf
‫پارامتر‬ ‫مقدار‬ ‫و‬ ‫کنید‬ ‫باز‬ ‫را‬
datadir
.‫دهید‬ ‫تغییر‬ ‫جدید‬ ‫دایرکتوری‬ ‫مسیر‬ ‫به‬ ‫را‬
datadir=/mnt/mysql_data
‫های‬ ‫فایل‬ ‫پیشفرض‬ ‫صورت‬ ‫به‬ ‫ابونتو‬ ‫در‬ .‫شود‬ ‫ویرایش‬ ‫زیر‬ ‫فایل‬ ‫تا‬ ‫است‬ ‫الزم‬ ‫باال‬ ‫های‬ ‫گام‬ ‫انجام‬ ‫از‬ ‫پس‬
MySQL
‫دایرکتوری‬ ‫در‬
var/lib/mysql
.‫دارد‬ ‫قرار‬ /
: ‫شبکه‬ ‫طریق‬ ‫از‬ ‫داده‬ ‫پایگاه‬ ‫به‬ ‫اتصال‬ ‫قابلیت‬ ‫کردن‬ ‫فعال‬ ‫نحوه‬
‫فایل‬ ‫در‬ ‫ریموت‬ ‫بصورت‬ ‫اتصال‬ ‫قابلیت‬ ‫کردن‬ ‫فعال‬ ‫برای‬
my.cnf
: ‫دهید‬ ‫انجام‬ ‫را‬ ‫زیر‬ ‫های‬ ‫ساختار‬
[mysqld]
bind-address=YOUR-SERVER-IP
: ‫نمونه‬ ‫برای‬
[
mysqld
]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/English
bind-address = 23.55.25.2
# skip-networking
‫برای‬
skip-networking
‫درخواستی‬ ‫به‬ ‫لحضه‬ ‫هر‬ ‫است‬ ‫معنی‬ ‫این‬ ‫به‬ ‫باشد‬ ‫فعال‬ ‫اگر‬
tcp/ip
. ‫نمیدهد‬ ‫گوش‬
‫سرویس‬ ‫سپس‬
mysql
. ‫کنیم‬ ‫می‬ ‫ریستارت‬ ‫را‬
. ‫شود‬ ‫وصل‬ ‫ریموت‬ ‫است‬ ‫قرار‬ ‫که‬ ‫کامپیوتری‬ ‫به‬ ‫مجوز‬ ‫دادن‬ : ‫بعدی‬ ‫مرحله‬
create database tmpfoo ;
grant all on tmpfoo.* to user@’ip’ identified by ‘password’ ;
update db set HOST=’ip’ where Db=’webdb’ ;
update user set Host=’ip’ where user=’user’ ;
/
sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
‫داده‬ ‫پایگاه‬ ‫در‬ ‫ها‬ ‫داده‬ ‫انواع‬
MySQL
:
MySQL
:‫کند‬ ‫می‬ ‫پشتیبانی‬ ‫زیر‬ ‫های‬ ‫بندی‬ ‫دسته‬ ‫در‬ ‫را‬ ‫داده‬ ‫مختلف‬ ‫انواع‬
•
( ‫اعداد‬
Numeric
)
•
( ‫زمان‬
Date and Time
)
•
( ‫ها‬ ‫رشته‬
String
)
•
( ‫فضایی‬ ‫های‬ ‫داده‬
Spatial
)
( ‫اعداد‬
Numeric
)
MySQL
‫استاندارد‬ ‫عددی‬ ‫های‬ ‫داده‬ ‫انواع‬ ‫تمامی‬
SQL
.‫کند‬ ‫می‬ ‫پشتبانی‬ ‫را‬ ‫تقریبی‬ ‫اعداد‬ ‫و‬ ‫صحیح‬ ‫اعداد‬ ‫شامل‬
‫که‬ ‫باشید‬ ‫داشته‬ ‫نظر‬ ‫در‬ ‫همچنین‬ .‫دارند‬ ‫نیاز‬ ‫سازی‬ ‫ذخیره‬ ‫برای‬ ‫مشخصی‬ ‫حافظه‬ ‫عددی‬ ‫های‬ ‫داده‬ ‫نوع‬ ‫از‬ ‫یک‬ ‫هر‬
‫صورت‬ ‫به‬ ‫توان‬ ‫می‬ ‫را‬ ‫عددی‬ ‫های‬ ‫داده‬ ‫این‬ ‫از‬ ‫نوع‬ ‫هر‬ .‫کنند‬ ‫می‬ ‫پشتیبانی‬ ‫را‬ ‫مشخصی‬ ‫محدوده‬ ‫آنها‬ ‫از‬ ‫کدام‬ ‫هر‬
SIGNED
‫یا‬
UNSIGNED
‫حالت‬ ‫در‬ .‫کرد‬ ‫تعریف‬
SIGNED
‫ولی‬ ‫کنند‬ ‫می‬ ‫پشتبیبانی‬ ‫منفی‬ ‫مقادیر‬ ‫از‬ ‫ها‬ ‫ستون‬ ‫این‬
‫حالت‬ ‫در‬
UNSIGNED
‫داده‬ ‫نوع‬ ‫که‬ ‫باشید‬ ‫داشته‬ ‫نظر‬ ‫در‬ .‫باشند‬ ‫صفر‬ ‫مساوی‬ ‫ویا‬ ‫بزرگتر‬ ‫باید‬ ‫شده‬ ‫ذخیره‬ ‫اعداد‬
BOOLEAN
‫مقادیر‬ ‫ذخیره‬ ‫برای‬
TRUE
‫و‬
FALSE
‫همان‬
TINYINT(1)
.‫باشد‬ ‫می‬
‫حالت‬ ‫در‬ ‫را‬ ‫عددی‬ ‫های‬ ‫داده‬ ‫نوع‬ ‫کلی‬ ‫اطالعات‬ ‫زیر‬ ‫جدول‬
SIGNED
‫و‬
UNSIGNED
:‫دهد‬ ‫می‬ ‫نشان‬
‫عددی‬ ‫های‬ ‫داده‬ ‫نوع‬ ‫کلی‬ ‫اطالعات‬
Integer
‫نوع‬ )‫(بایت‬ ‫حافظه‬ ‫مقدار‬ ‫حداقل‬ ‫مقدار‬ ‫حداکثر‬
TINYINT 1
-
128 127
0 255
SMALLINT 2
-
32768 32767
0 65535
MEDIUMINT 3
-
8388608 8388607
0 16777215
INTEGER 4
-
2147483648 2147483647
0 4294967295
BIGINT 8 -
92233720368547758
08
922337203685477580
7
0184467440737095516
‫نوع‬ )‫(بایت‬ ‫حافظه‬ ‫مقدار‬ ‫حداقل‬ ‫مقدار‬ ‫حداکثر‬
15
‫شناور‬ ‫عددی‬ ‫های‬ ‫داده‬ ‫نوع‬ ‫کلی‬ ‫اطالعات‬
‫نوع‬ )‫(بایت‬ ‫حافظه‬
‫مقدار‬ ‫تعریف‬ ‫نحوه‬ ‫توضیحات‬
FLOAT 4 ‫از‬
۰
‫تا‬
۲۳
‫رقم‬ FLOAT(M,D)
‫تقریبی‬ ‫مقدار‬ (Approximate
Value)
DOUBLE 8
‫از‬
۲۴
‫تا‬
۵۳
‫رقم‬
DOUBLE(M,D)
‫تقریبی‬ ‫مقدار‬ (Approximate
Value)
DECIMAL
‫هر‬
۹
‫رقم‬
۴
‫صورت‬ ‫به‬ ‫بایت‬
‫باینری‬
‫تا‬
۶۵
‫رقم‬ DECIMAL(M,D)‫دقیق‬ ‫مقدار‬ (Exact Value)
‫حرف‬ ‫باال‬ ‫جدول‬ ‫در‬
M
‫حرف‬ ‫و‬ ‫داده‬ ‫‌های‬
‫م‬‫رق‬ ‫کل‬ ‫تعداد‬ ‫‌دهنده‬
‫ن‬‫نشا‬
D
‫ممیز‬ ‫از‬ ‫بعد‬ ‫‌های‬
‫م‬‫رق‬ ‫تعداد‬ ‫‌دهنده‬
‫ن‬‫نشا‬
‫صورت‬ ‫به‬ ‫که‬ ‫ستونی‬ ‫در‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫باشد‬ ‫می‬ ).(
FLOAT(7,4)
‫مقدار‬ ‫حداکثر‬ ‫توان‬ ‫می‬ ‫است‬ ‫شده‬ ‫تعریف‬
999.9999
‫عدد‬ ‫شما‬ ‫که‬ ‫صورتی‬ ‫در‬ .‫نمود‬ ‫ذخیره‬ ‫را‬
999.00009
‫به‬ ‫واردشده‬ ‫عدد‬ ،‫کنید‬ ‫وارد‬ ‫جدول‬ ‫این‬ ‫به‬ ‫را‬
‫صورت‬
999.0001
.‫شد‬ ‫خواهد‬ ‫ذخیره‬
‫سوال‬
‫چیست؟‬ ‫شناور‬ ‫عددی‬ ‫های‬ ‫داده‬ ‫جدول‬ ‫در‬ ‫دقیق‬ ‫و‬ ‫تقریبی‬ ‫مقدار‬ ‫از‬ ‫منظور‬ :
‫پاسخ‬
‫فرمان‬ ‫خط‬ ‫در‬ ‫دستور‬ ‫چند‬ ‫کردن‬ ‫اجرا‬ ‫با‬ ‫زیر‬ ‫در‬ .‫شوند‬ ‫می‬ ‫گرد‬ ‫اعداد‬ ‫تقریبی‬ ‫‌های‬
‫ه‬‫داد‬ ‫نوع‬ ‫در‬ ‫اوقات‬ ‫گاهی‬ :
MySQL
‫ستون‬ ‫دو‬ ‫با‬ ‫‌ای‬
‫ه‬‫داد‬ ‫پایگاه‬
Decimal
‫و‬
Float
‫در‬ ‫را‬ ‫گردشدن‬ ‫نتیجه‬ ‫دستور‬ ‫آخرین‬ ‫در‬ .‫کردیم‬ ‫تعریف‬
‫ستون‬
Float
:‫فرمایید‬ ‫می‬ ‫مشاهده‬
1
2
3
4
5
6
7
8
mysql> create table numbers (a decimal(10,2), b float);
mysql> insert into numbers values (100, 100);
mysql> select @a := (a/3), @b := (b/3), @a * 3, @b * 3 from numbers G
*************************** 1. row ***************************
@a := (a/3): 33.333333333
@b := (b/3): 33.3333333333333
@a * 3: 99.999999999
@b * 3: 100
‫صفحه‬ ‫به‬ ‫بیشتر‬ ‫اطالعات‬ ‫برای‬
Problems with Floating-Point Values
‫سایت‬ ‫در‬
MySQL
.‫نمایید‬ ‫مراجعه‬
‫از‬ ‫قبل‬ ‫های‬ ‫نسخه‬ ‫در‬
5.0.3
‫داده‬ ‫نوع‬
DECIMAL
‫صورت‬ ‫به‬
String
‫که‬ ‫‌هایی‬
‫م‬‫رق‬ ‫مقدار‬ ‫و‬ ‫شود‬ ‫می‬ ‫ذخیره‬
‫داده‬ ‫نوع‬ ‫مانند‬ ‫کرد‬ ‫می‬ ‫پشتیبانی‬
DOUBLE
.‫بود‬
‫داده‬ ‫نوع‬
BIT
‫‌های‬
‫ت‬‫بی‬ ‫ذخیره‬ ‫برای‬ ‫داده‬ ‫نوع‬ ‫این‬
۰
‫و‬
۱
‫عبارت‬ ‫از‬ ‫نوع‬ ‫این‬ ‫از‬ ‫ستونی‬ ‫تعریف‬ ‫برای‬ .‫شود‬ ‫می‬ ‫استفاده‬
BIT(M)
‫اینجا‬ ‫در‬ ‫که‬ ‫کنیم‬ ‫می‬ ‫استفاده‬
M
‫تقریبا‬ ‫طول‬ ‫به‬ ‫فضایی‬
(
M+7
/)
8
.‫کند‬ ‫می‬ ‫ایجاد‬ ‫‌ها‬
‫ه‬‫داد‬ ‫نگهداری‬ ‫برای‬ ‫را‬ ‫بایت‬
M
‫از‬ ‫عددی‬ ‫تواند‬ ‫می‬
۱
‫تا‬
۶۴
‫‌دادن‬
‫ن‬‫نشا‬ ‫برای‬ .‫باشد‬
۰
‫و‬
۱
‫حرف‬ ‫از‬ ‫بیت‬ ‫صورت‬ ‫به‬
b
‫عنوان‬ ‫به‬ .‫کنیم‬ ‫می‬ ‫استفاده‬
‫مثال‬
b'111
'
‫و‬
b'10000000
'
‫اعداد‬ ‫برابر‬ ‫ترتیب‬ ‫به‬ ‫که‬
۷
‫و‬
۱۲۸
‫به‬ ‫موضوع‬ ‫این‬ ‫بیشتر‬ ‫درک‬ ‫برای‬ .‫باشند‬ ‫می‬
‫فرمان‬ ‫خط‬ ‫در‬ ‫زیر‬ ‫نتایج‬ ‫و‬ ‫دستورات‬
MySQL
:‫فرمایید‬ ‫توجه‬
1
2
3
4
5
6
7
8
9
1
0
1
1
1
2
mysql> INSERT INTO t SET b = b'11111111';
mysql> INSERT INTO t SET b = b'1010';
mysql> INSERT INTO t SET b = b'0101';
mysql> SELECT b+0, BIN(b+0), OCT(b+0), HEX(b+0) FROM t;
+------+----------+----------+----------+
| b+0 | BIN(b+0) | OCT(b+0) | HEX(b+0) |
+------+----------+----------+----------+
| 255 | 11111111 | 377 | FF |
| 10 | 1010 | 12 | A |
| 5 | 101 | 5 | 5 |
+------+----------+----------+----------+
3 rows in set (0.03 sec)
‫آخرین‬
Query
‫عبارت‬ .‫دهد‬ ‫می‬ ‫نشان‬ ‫را‬ ‫اعداد‬ ‫این‬ ‫تبدیل‬ ‫برای‬ ‫مختلف‬ ‫توابع‬ ‫باال‬ ‫در‬
+
0
‫ذخیره‬ ‫دودویی‬ ‫مقدار‬
.‫کند‬ ‫می‬ ‫تبدیل‬ ‫متناظر‬ ‫‌دهی‬
‫ه‬‫د‬ ‫عدد‬ ‫به‬ ‫را‬ ‫شده‬
( ‫زمان‬
Date and Time
)
‫کل‬ ‫در‬
۵
‫مشاهده‬ ‫را‬ ‫‌ها‬
‫ه‬‫داد‬ ‫نوع‬ ‫این‬ ‫اطالعات‬ ‫زیر‬ ‫جدول‬ ‫در‬ .‫داریم‬ )‫تاریخ‬ ‫و‬ ‫(ساعت‬ ‫زمان‬ ‫ذخیره‬ ‫برای‬ ‫داده‬ ‫نوع‬
:‫‌فرمایید‬
‫ی‬‫م‬
‫زمانی‬ ‫های‬ ‫داده‬ ‫نوع‬ ‫کلی‬ ‫اطالعات‬ (Date and Time)
‫نوع‬ )‫(بایت‬ ‫حافظه‬
‫صفر‬ ‫مقدار‬ (“Zero” Value)
DATE 3 '0000-00-00'
TIME 3 '00:00:00'
DATETIME 8 '0000-00-00 00:00:00'
TIMESTAMP 4 '0000-00-00 00:00:00'
YEAR 1 0000
.‫پرداخت‬ ‫خواهیم‬ ‫باال‬ ‫در‬ ‫شده‬ ‫ذکر‬ ‫‌های‬
‫ه‬‫داد‬ ‫نوع‬ ‫بررسی‬ ‫به‬ ‫ادامه‬ ‫در‬
‫داده‬ ‫نوع‬
DATE
‫داده‬ ‫نوع‬ ‫این‬ ‫فرض‬ ‫پیش‬ ‫فرمت‬ .‫شود‬ ‫می‬ ‫استفاده‬ ‫تاریخ‬ ‫سازی‬ ‫ذخیره‬ ‫برای‬ ‫فقط‬ ‫داده‬ ‫نوع‬ ‫این‬
'
YYYY-MM-
DD
'
‫توسط‬ ‫که‬ ‫‌ای‬
‫ه‬‫باز‬ .‫است‬
DATE
‫از‬ ‫شود‬ ‫می‬ ‫پشتیبانی‬
'
1000
-
01
-
01
'
‫تا‬
'
9999
-
12
-
31
'
.‫باشد‬ ‫می‬
‫داده‬ ‫نوع‬
TIME
‫داده‬ ‫نوع‬ ‫این‬ ‫‌فرض‬
‫ش‬‫پی‬ ‫فرمت‬ .‫شود‬ ‫می‬ ‫استفاده‬ )‫ثانیه‬ ،‫دقیقه‬ ،‫(ساعت‬ ‫زمان‬ ‫سازی‬ ‫ذخیره‬ ‫برای‬ ‫داده‬ ‫نوع‬ ‫این‬
'
HH:MM:SS
'
‫یا‬ ‫و‬
'
HHH:MM:SS
'
‫نوع‬ ‫در‬ ‫که‬ ‫ای‬ ‫بازه‬ .‫است‬
TIME
‫از‬ ‫شود‬ ‫می‬ ‫پشتیبانی‬
-'
838:59:59
'
‫تا‬
'
838:59:59
'
‫داده‬ ‫نوع‬ .‫باشد‬ ‫می‬
TIME
‫تفاوت‬ ‫نمایش‬ ‫برای‬ .‫شود‬ ‫نمی‬ ‫استفاده‬ ‫روز‬ ‫زمان‬ ‫نمایش‬ ‫برای‬ ‫فقط‬
‫از‬ ‫تواند‬ ‫می‬ ‫نیز‬ ‫‌مانده‬
‫ی‬‫باق‬ ‫زمان‬ ‫یا‬ ‫و‬ ‫بازه‬ ‫دو‬ ‫زمانی‬
TIME
‫شده‬ ‫پشتیبانی‬ ‫بازه‬ ‫دلیل‬ ‫همین‬ ‫به‬ .‫نمود‬ ‫استفاده‬
‫از‬ ‫بیشتر‬
۲۴
.‫باشد‬ ‫می‬ )‫(منفی‬ ‫صفر‬ ‫از‬ ‫کمتر‬ ‫یا‬ ‫و‬ ‫ساعت‬
‫داده‬ ‫نوع‬ ‫در‬ ‫مخفف‬ ‫های‬ ‫عبارت‬ ‫از‬ ‫استفاده‬ ‫برای‬
TIME
‫مثال‬ ‫عنوان‬ ‫به‬ .‫نمایید‬ ‫دقت‬ ‫باید‬
MySQL
‫عبارت‬
'
11:12
'
‫صورت‬ ‫به‬ ‫را‬
'
11:12:00
'
‫بدون‬ ‫داده‬ ‫که‬ ‫صورتی‬ ‫در‬ .‫کند‬ ‫می‬ ‫تفسیر‬
':'
،‫شود‬ ‫بیان‬ )‫نقطه‬ ‫(دو‬
MySQL
‫آن‬
‫عبارت‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫کند‬ ‫می‬ ‫تفسیر‬ ‫راست‬ ‫سمت‬ ‫از‬ ‫را‬
'
1112
'
‫یا‬ ‫و‬
1112
‫معنی‬ ‫به‬
'
00:11:12
'
.‫است‬
‫فرض‬ ‫پیش‬ ‫صورت‬ ‫به‬
MySQL
‫محدوده‬ ‫از‬ ‫خارج‬ ‫‌های‬
‫ه‬‫داد‬
TIME
‫شده‬ ‫وارد‬ ‫مناسب‬ ‫فرمت‬ ‫با‬ ‫که‬ ‫صورتی‬ ‫در‬ ‫را‬
‫‌های‬
‫ت‬‫عبار‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫کند‬ ‫می‬ ‫تبدیل‬ ‫بازه‬ ‫‌ترین‬
‫ک‬‫نزدی‬ ‫به‬ ‫باشند‬
-'
850:00:00
'
‫و‬
'
850:00:00
'
‫به‬
-'
838:59:59
'
‫و‬
'
838:59:59
'
‫برای‬ ‫تفسیر‬ ‫قابل‬ ‫یا‬ ‫و‬ ‫نداشته‬ ‫مناسب‬ ‫فرمت‬ ‫که‬ ‫‌هایی‬
‫ه‬‫داد‬ .‫شد‬ ‫خواهند‬ ‫تبدیل‬
‫داده‬
TIME
‫عبارت‬ ‫به‬ ‫نباشند‬
'
00:00:00
'
.‫شد‬ ‫خواهند‬ ‫تبدیل‬
‫داده‬ ‫نوع‬
DATETIME
‫پیش‬ ‫فرمت‬ .‫شود‬ ‫می‬ ‫استفاده‬ ‫ساعت‬ ‫و‬ ‫تاریخ‬ ‫شامل‬ ‫کامل‬ ‫صورت‬ ‫به‬ ‫زمان‬ ‫سازی‬ ‫ذخیره‬ ‫برای‬ ‫داده‬ ‫نوع‬ ‫این‬
‫داده‬ ‫نوع‬ ‫این‬ ‫فرض‬
'
YYYY-MM-DD HH:MM:SS
'
‫پشتیبانی‬ ‫‌ی‬
‫ه‬‫باز‬ .‫باشد‬ ‫می‬
DATETIME
‫از‬
'
1000
-
01
-
01
00:00:00
'
‫تا‬
'
9999
-
12
-
31
23:59:59
'
.‫است‬
‫داده‬ ‫نوع‬
TIMESTAMP
‫همانند‬ ‫داده‬ ‫نوع‬ ‫این‬
DATETIME
‫توسط‬ ‫که‬ ‫‌ای‬
‫ه‬‫باز‬ .‫باشد‬ ‫می‬
TIMESTAMP
‫از‬ ‫‌شود‬
‫ی‬‫م‬ ‫پشتیبانی‬
'
1970
-
01
-
01
00:00:01
'
‫تا‬
'
2038
-
01
-
19
03:14:07
'
.‫است‬
‫‌های‬
‫ه‬‫داد‬
TIMESTAMP
( ‫زمانی‬ ‫منطقه‬ ‫زمان‬ ‫از‬ ‫شدن‬ ‫ذخیره‬ ‫هنگام‬
Time Zone
‫به‬ ‫سیستم‬ ‫کنونی‬ )
UTC
‫‌های‬
‫ه‬‫داد‬ ‫دادن‬ ‫نشان‬ ‫هنگام‬ ،‫امر‬ ‫همین‬ ‫با‬ ‫متناظر‬ .‫شوند‬ ‫می‬ ‫ذخیره‬ ‫و‬ ‫تبدیل‬
TIMESTAMP
‫از‬ ‫‌ها‬
‫ه‬‫داد‬ ‫ابتدا‬ ،
UTC
‫که‬ ‫صورتی‬ ‫در‬ ‫علت‬ ‫همین‬ ‫به‬ .‫شوند‬ ‫می‬ ‫داده‬ ‫نمایش‬ ‫بعد‬ ‫و‬ ‫شده‬ ‫تبدیل‬ ‫سیستم‬ ‫کنونی‬ ‫زمانی‬ ‫منطقه‬ ‫به‬
.‫شوند‬ ‫داده‬ ‫نمایش‬ ‫غلط‬ ‫یا‬ ‫و‬ ‫غیرعادی‬ ‫صورت‬ ‫به‬ ‫‌ها‬
‫ه‬‫داد‬ ‫است‬ ‫ممکن‬ ،‫شود‬ ‫عوض‬ ‫سیستم‬ ‫زمانی‬ ‫منطقی‬
‫داده‬ ‫نوع‬
TIMESTAMP
‫برای‬ .‫باشید‬ ‫داشته‬ ‫خودکار‬ ‫مقداردهی‬ ‫یا‬ ‫و‬ ‫اولیه‬ ‫مقداردهی‬ ‫که‬ ‫دارد‬ ‫را‬ ‫قابلیت‬ ‫این‬
‫را‬ ‫نظر‬ ‫مورد‬ ‫فیلد‬ ‫فرض‬ ‫پیش‬ ‫مقدار‬ ‫کافیست‬ ‫اولیه‬ ‫مقداردهی‬
CURRENT_TIMESTAMP
:‫مانند‬ .‫دهید‬ ‫قرار‬
1mysql> CREATE TABLE t (ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP);
‫فیلد‬ ‫در‬ ‫شده‬ ‫ذخیره‬ ‫مقدار‬ ،‫خودکار‬ ‫مقداردهی‬ ‫حالت‬ ‫در‬
TIMESTAMP
( ‫بروزرسانی‬ ‫هنگام‬
UPDATE
‫ردیف‬ ‫یک‬ )
:‫مانند‬ .‫کند‬ ‫می‬ ‫پیدا‬ ‫تغییر‬ ‫بروزرسانی‬ ‫زمان‬ ‫به‬
mysql> CREATE TABLE t (name VARCHAR(100), ts TIMESTAMP DEFAULT
CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
mysql> INSERT INTO t(name) VALUES('Saeid');
mysql> SELECT * FROM t;
+-------+---------------------+
| name | ts |
+-------+---------------------+
| Saeid | 2011-12-22 12:00:26 |
+-------+---------------------+
1 row in set (0.00 sec)
mysql> UPDATE t SET name = 'Alireza';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> SELECT * FROM t;
+---------+---------------------+
| name | ts |
+---------+---------------------+
| Alireza | 2011-12-22 12:01:56 |
+---------+---------------------+
1 row in set (0.00 sec)
‫صفحه‬ ‫به‬ ‫بیشتر‬ ‫اطالعات‬ ‫کسب‬ ‫برای‬
TIMESTAMP Properties
‫سایت‬ ‫در‬
MySQL
.‫نمایید‬ ‫مراجعه‬
‫داده‬ ‫نوع‬
YEAR
‫فرمت‬ ‫با‬ ‫سال‬ ‫سازی‬ ‫ذخیره‬ ‫برای‬ ‫داده‬ ‫نوع‬ ‫این‬
YYYY
‫به‬ ‫را‬ ‫خود‬ ‫نظر‬ ‫مورد‬ ‫سال‬ ‫تواند‬ ‫می‬ ‫شما‬ .‫‌رود‬
‫ی‬‫م‬ ‫کار‬ ‫به‬
‫رقمی‬ ‫دو‬ ‫صورت‬
YEAR(2)
‫یا‬ ‫و‬
۴
‫رقمی‬
YEAR(4)
‫نوع‬ .‫کنید‬ ‫تعریف‬
YEAR
‫سال‬ ‫از‬
1901
‫تا‬
2155
‫و‬
0000
‫را‬
‫صورت‬ ‫به‬ ‫را‬ ‫سال‬ ‫که‬ ‫صورتی‬ ‫در‬ .‫کند‬ ‫می‬ ‫پشتیبانی‬
۲
‫اعداد‬ ،‫باشید‬ ‫کرده‬ ‫تعریف‬ ‫رقمی‬
00
‫تا‬
69
‫قرن‬ ‫در‬
۲۱
‫و‬
‫اعداد‬
70
‫تا‬
99
‫قرن‬ ‫در‬
۲۰
‫مثال‬ .‫شوند‬ ‫می‬ ‫گرفته‬ ‫نظر‬ ‫در‬
45
‫عنوان‬ ‫به‬
2045
‫و‬
80
‫صورت‬ ‫به‬
1980
‫نظر‬ ‫در‬
‫برای‬ ‫منطقی‬ ‫غیر‬ ‫مقادیر‬ ‫تمامی‬ .‫شود‬ ‫می‬ ‫گرفته‬
YEAR
‫صورت‬ ‫به‬
0000
.‫شوند‬ ‫می‬ ‫ذخیره‬
( ‫ها‬ ‫رشته‬
String
)
‫داده‬ ‫نوع‬
String
‫نوع‬ ‫از‬ ‫هایی‬ ‫داده‬ ‫کلی‬ ‫اطالعات‬ ‫زیر‬ ‫در‬ .‫شود‬ ‫می‬ ‫استفاده‬ )‫(متون‬ ‫‌ها‬
‫ه‬‫رشت‬ ‫داری‬ ‫نگه‬ ‫برای‬
String
‫زیر‬ ‫جدول‬ ‫در‬ .‫فرمایید‬ ‫می‬ ‫مشاهده‬ ‫را‬
M
‫و‬ ‫داده‬ ‫برای‬ ‫شده‬ ‫تعریف‬ ‫طول‬ ‫‌دهنده‬
‫ن‬‫نشا‬
L
‫‌دهنده‬
‫ن‬‫نشا‬
.‫باشد‬ ‫می‬ ‫شده‬ ‫داده‬ ‫رشته‬ ‫واقعی‬ ‫طول‬
( ‫‌ها‬
‫ه‬‫رشت‬ ‫داده‬ ‫نوع‬ ‫کلی‬ ‫اطالعات‬
String
)
‫نوع‬
‫مقدار‬
)‫(بایت‬ ‫حافظه‬
CHAR(M) 0 <= M <= 255 M × w ‫بایت‬. w ‫طول‬ ‫حداکثر‬ ‫برای‬ ‫نیاز‬ ‫مورد‬ ‫بایت‬ ‫تعداد‬
‫در‬ ‫شده‬ ‫تعریف‬ ‫کاراکترهای‬ character set ‫باشد‬ ‫می‬ ‫جدول‬.
BINARY(M) 0 <= M <= 255
M ‫بایت‬
VARCHAR(M) 0 <= M <= 65532
L + 1 ‫از‬ ‫کمتر‬ ‫نظر‬ ‫مورد‬ ‫داده‬ ‫اگر‬ ‫بایت‬
۲۵۵
‫داشته‬ ‫نیاز‬ ‫بایت‬
‫باشد‬.
L + 2 ‫از‬ ‫بیشتر‬ ‫نظر‬ ‫مورد‬ ‫داده‬ ‫اگر‬ ‫بایت‬
۲۵۵
‫داشته‬ ‫نیاز‬ ‫بایت‬
‫نوع‬
‫مقدار‬
)‫(بایت‬ ‫حافظه‬
‫باشد‬.
VARBINARY(M) 0 <= M <= 65532
M + 1 ‫از‬ ‫کمتر‬ ‫نظر‬ ‫مورد‬ ‫داده‬ ‫اگر‬ ‫بایت‬
۲۵۵
‫داشته‬ ‫نیاز‬ ‫بایت‬
‫باشد‬.
M + 2 ‫از‬ ‫بیشتر‬ ‫نظر‬ ‫مورد‬ ‫داده‬ ‫اگر‬ ‫بایت‬
۲۵۵
‫داشته‬ ‫نیاز‬ ‫بایت‬
‫باشد‬.
TINYBLOB L < 2
8 L + 1 ‫بایت‬
TINYTEXT L < 2
8 L + 1 ‫بایت‬
BLOB L < 2
16 L + 2 ‫بایت‬
TEXT L < 2
16 L + 2 ‫بایت‬
MEDIUMBLOB L < 2
24 L + 3 ‫بایت‬
MEDIUMTEXT L < 2
24 L + 3 ‫بایت‬
LONGBLOB L < 2
32 L + 4 ‫بایت‬
LONGTEXT L < 2
32 L + 4 ‫بایت‬
ENUM('v1','v2',...) ‫حداکثر‬
۶۵,۵۳۵
‫عضو‬
۱ ‫یا‬
۲
‫بایت‬ .
‫داده‬ ‫مقدار‬ ‫به‬ ‫وابسته‬.
SET('v1','v2',...) ‫حداکثر‬
۶۴
‫عضو‬
۱، ۲، ۳، ۴ ‫یا‬
۸
‫بایت‬
‫شده‬ ‫داده‬ ‫مجموعه‬ ‫به‬ ‫وابسته‬.
‫داده‬ ‫نوع‬
CHAR
‫و‬
VARCHAR
CHAR
‫و‬
VARCHAR
‫بین‬ ‫که‬ ‫تفاوتی‬ ‫‌ترین‬
‫م‬‫مه‬ .‫هستند‬ ‫هم‬ ‫به‬ ‫شبیه‬ ‫بسیار‬
CHAR
‫و‬
VARCHAR
‫دارد‬ ‫وجود‬
‫که‬ ‫را‬ ‫کاراکتری‬ ‫تعداد‬ ‫حداکثر‬ ‫شما‬ ‫‌ها‬
‫ه‬‫داد‬ ‫نوع‬ ‫این‬ ‫تعریف‬ ‫هنگام‬ .‫است‬ ‫اطالعات‬ ‫بازیابی‬ ‫و‬ ‫سازی‬ ‫ذخیره‬ ‫نحوه‬
‫مثال‬ ‫عنوان‬ ‫به‬ .‫نمایید‬ ‫می‬ ‫مشخص‬ ‫را‬ ‫شود‬ ‫ذخیره‬ ‫خواهید‬ ‫می‬
CHAR(30)
‫حداکثر‬ ‫ذخیره‬ ‫برای‬
۳۰
‫کاراکتر‬
.‫شود‬ ‫می‬ ‫تعریف‬
‫نوع‬ ‫از‬ ‫که‬ ‫ستونی‬ ‫طول‬
CHAR
،‫باشد‬ ‫شده‬ ‫تعریف‬ ‫طول‬ ‫از‬ ‫کمتر‬ ‫داده‬ ‫طول‬ ‫که‬ ‫صورتی‬ ‫در‬ .‫است‬ ‫ثابت‬ ‫باشد‬
‫فاصله‬ ‫با‬ ‫باقیمانده‬ ‫فضای‬
(
space
)
‫از‬ ‫قبل‬ ‫خالی‬ ‫فضای‬ ‫این‬ ‫اطالعات‬ ‫بازیابی‬ ‫هنگام‬ .‫‌شود‬
‫ی‬‫م‬ ‫پر‬ ‫راست‬ ‫از‬
‫حالت‬ ‫اینکه‬ ‫مگر‬ ‫‌شود‬
‫ی‬‫م‬ ‫حذف‬ ‫نمایش‬
PAD_CHAR_TO_FULL_LENGTH
.‫باشد‬ ‫شده‬ ‫فعال‬
‫داده‬ ‫نوع‬ ‫در‬
VARCHAR
‫اگر‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫باشد‬ ‫می‬ ‫شده‬ ‫وارد‬ ‫داده‬ ‫مقدار‬ ‫اندازه‬ ‫به‬ ‫شده‬ ‫ذخیره‬ ‫داده‬ ‫طول‬
‫صورت‬ ‫به‬ ‫ستونی‬
VARCHAR(100)
‫شده‬ ‫داده‬ ‫رشته‬ ‫طول‬ ‫ولی‬ ‫باشد‬ ‫شده‬ ‫تعریف‬
50
‫به‬ ‫فقط‬ ،‫باشد‬ ‫کاراکتر‬
.‫است‬ ‫الزم‬ ‫فضا‬ ‫زیر‬ ‫بایت‬ ‫مقدار‬
(50 * ‫کاراکتر‬ ‫هر‬ ‫ذخیره‬ ‫برای‬ ‫الزم‬ ‫فضای‬
) + 2
‫تعریف‬ ‫در‬ ‫که‬ ‫صورتی‬ ‫در‬
VARCHAR(M)
‫مقدار‬
M
‫از‬ ‫بیشتر‬
۶۵,۵۳۵
،‫باشد‬
MySQL
‫ستون‬ ‫نوع‬ ‫خودکار‬ ‫طور‬ ‫به‬
‫از‬ ‫را‬
VARCHAR
‫مانند‬ ‫مناسبی‬ ‫نوع‬ ‫به‬
MEDIUMTEXT
.‫دهد‬ ‫می‬ ‫تغییر‬
‫در‬ ‫را‬ ‫اطالعات‬ ‫ذخیره‬ ‫برای‬ ‫نیاز‬ ‫مورد‬ ‫فضای‬ ‫‌های‬
‫ت‬‫تفاو‬ ‫زیر‬ ‫جدول‬
CHAR
‫و‬
VARCHAR
‫دقت‬ .‫دهد‬ ‫می‬ ‫نمایش‬
‫زیر‬ ‫جدول‬ ‫در‬ ‫که‬ ‫کنید‬
Character Set
‫مانند‬ ‫بایتی‬ ‫تک‬ ‫نظر‬ ‫مورد‬ ‫داده‬
latin1
.‫است‬
‫برای‬ ‫نیاز‬ ‫مورد‬ ‫فضای‬ ‫تفاوت‬ ‫بررسی‬
CHAR(4)
‫و‬
VARCHAR(4)
‫داده‬ CHAR(4) ‫نیاز‬ ‫مورد‬ ‫فضای‬ VARCHAR(4) ‫نیاز‬ ‫مورد‬ ‫فضای‬
'' ' ' ۴ ‫بایت‬ '' ۱ ‫بایت‬
'ab' 'ab ' ۴ ‫بایت‬ 'ab' ۳ ‫بایت‬
'abcd' 'abcd' ۴ ‫بایت‬ 'abcd' ۵ ‫بایت‬
'abcdefgh' 'abcd' ۴ ‫بایت‬ 'abcd' ۵ ‫بایت‬
‫داده‬ ‫نوع‬
BINARY
‫و‬
VARBINARY
‫مانند‬ ‫ها‬ ‫داده‬ ‫نوع‬ ‫این‬
CHAR
‫و‬
VARCHAR
‫‌های‬
‫ه‬‫رشت‬ ‫‌ها‬
‫ه‬‫داد‬ ‫نوع‬ ‫این‬ ‫در‬ ‫که‬ ‫تفاوت‬ ‫این‬ ‫با‬ ‫فقط‬ ‫باشند‬ ‫می‬
‫نتیجه‬ ‫در‬ .‫شود‬ ‫می‬ ‫ذخیره‬ )‫یک‬ ‫و‬ ‫(صفر‬ ‫باینری‬
Character set
‫طرفی‬ ‫از‬ .‫ندارد‬ ‫معنی‬ ‫‌ها‬
‫ه‬‫داد‬ ‫نوع‬ ‫این‬ ‫برای‬
.‫باشد‬ ‫می‬ ‫شده‬ ‫ذخیره‬ ‫باینری‬ ‫رشته‬ ‫عددی‬ ‫مقدار‬ ‫اساس‬ ‫بر‬ ‫مقایسه‬ ‫و‬ ‫‌سازی‬
‫ب‬‫مرت‬
‫داده‬ ‫نوع‬
BLOB
‫و‬
TEXT
‫مانند‬ ‫‌ها‬
‫ه‬‫داد‬ ‫نوع‬ ‫این‬
BINARY
‫و‬
VARBINARY
‫دارای‬ ‫‌ها‬
‫ه‬‫داد‬ ‫این‬ ‫از‬ ‫کدام‬ ‫هر‬ .‫باشند‬ ‫می‬
۴
‫که‬ ‫‌باشند‬
‫ی‬‫م‬ ‫نوع‬
.‫است‬ ‫شدن‬ ‫ذخیره‬ ‫قابل‬ ‫داده‬ ‫طول‬ ‫حداکثر‬ ‫در‬ ‫‌ها‬
‫ن‬‫آ‬ ‫تفاوت‬ ‫تنها‬
‫داده‬ ‫نوع‬
ENUM
‫مجموعه‬ ‫این‬ .‫باشد‬ ‫شده‬ ‫تعریف‬ ‫مجموعه‬ ‫از‬ ‫که‬ ‫دهد‬ ‫می‬ ‫را‬ ‫ای‬ ‫رشته‬ ‫سازی‬ ‫ذخیره‬ ‫امکان‬ ‫فقط‬ ‫داده‬ ‫نوع‬ ‫این‬
:‫زیر‬ ‫جدول‬ ‫مانند‬ .‫شود‬ ‫می‬ ‫تعریف‬ ‫جدول‬ ‫ساخت‬ ‫هنگام‬
1
2
3
CREATE TABLE sizes (
name ENUM('small', 'medium', 'large')
);
‫ستون‬ ‫در‬
name
‫مقادیر‬ ‫از‬ ‫یکی‬ ‫توانید‬ ‫می‬ ‫فقط‬ ‫باال‬ ‫جدول‬ ‫در‬
small، medium
‫یا‬
large
‫در‬ .‫نمایید‬ ‫ذخیره‬ ‫را‬
‫در‬ ‫خالی‬ ‫فضای‬ ،‫شود‬ ‫مجموعه‬ ‫وارد‬ ‫مجموعه‬ ‫از‬ ‫خارج‬ ‫مقداری‬ ‫که‬ ‫صورتی‬
name
‫وارد‬ ‫مقدار‬ ‫نه‬ ،‫شود‬ ‫می‬ ‫ذخیره‬
.‫شده‬
‫داده‬ ‫نوع‬
SET
‫مانند‬ ‫داده‬ ‫نوع‬ ‫این‬
ENUM
‫را‬ ‫شده‬ ‫تعریف‬ ‫مجموعه‬ ‫از‬ ‫عضو‬ ‫چند‬ ‫توانید‬ ‫می‬ ‫شما‬ ‫که‬ ‫تفاوت‬ ‫این‬ ‫با‬ ،‫باشد‬ ‫می‬
‫توجه‬ ‫زیر‬ ‫مثال‬ ‫به‬ .‫شوند‬ ‫می‬ ‫حذف‬ ‫سازی‬ ‫ذخیره‬ ‫از‬ ‫قبل‬ ‫تکراری‬ ‫‌های‬
‫ه‬‫داد‬ ‫یا‬ ‫که‬ ‫نمایید‬ ‫توجه‬ .‫نمایید‬ ‫انتخاب‬
:‫فرمایید‬
1
2
mysql> CREATE TABLE myset (col SET('a', 'b', 'c', 'd'));
Query OK, 0 rows affected (0.05 sec)
mysql> INSERT INTO myset (col) VALUES ('a,d'), ('d,a'), ('a,d,a'), ('a,d,d'), ('d,a,d');
Query OK, 5 rows affected (0.00 sec)
Records: 5 Duplicates: 0 Warnings: 0
mysql> SELECT col FROM myset;
+------+
| col |
+------+
| a,d |
| a,d |
| a,d |
| a,d |
| a,d |
+------+
5 rows in set (0.00 sec)
.‫نمایید‬ ‫خوددداری‬ ‫جدا‬ ',' ‫بعد‬ ‫یا‬ ‫و‬ ‫قبل‬ ‫فاصله‬ ‫قراردادن‬ ‫از‬
‫نماییم؟‬ ‫انتخاب‬ ‫را‬ ‫مناسب‬ ‫داده‬ ‫نوع‬ ‫چطور‬
‫خود‬ ‫ستون‬ ‫برای‬ ‫را‬ ‫داده‬ ‫نوع‬ ‫مختصرترین‬ ‫سپس‬ .‫نمایید‬ ‫معین‬ ‫را‬ ‫خود‬ ‫داده‬ ‫برای‬ ‫نیاز‬ ‫مورد‬ ‫‌ی‬
‫ه‬‫باز‬ ‫چیز‬ ‫هر‬ ‫از‬ ‫قبل‬
‫اعداد‬ ‫بازه‬ ‫برای‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫نمایید‬ ‫انتخاب‬
۰
‫تا‬
۹۹۹۹۹
‫نوع‬
MEDIUMINT UNSIGNED
.‫است‬ ‫گزینه‬ ‫بهترین‬
‫در‬ ‫داده‬ ‫پایگاه‬ ‫در‬ ‫را‬ ‫شمسی‬ ‫تاریخ‬ ‫هرگز‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫است‬ ‫شما‬ ‫داده‬ ‫با‬ ‫مناسب‬ ‫ستون‬ ‫نوع‬ ‫انتخاب‬ ‫دیگر‬ ‫مورد‬
‫(مانند‬ ‫رشته‬ ‫نوع‬ ‫از‬ ‫ستونی‬
CHAR
‫در‬ ‫آن‬ ‫ذخیره‬ ‫و‬ ‫میالی‬ ‫تاریخ‬ ‫به‬ ‫تاریخ‬ ‫تبدیل‬ ‫گزینه‬ ‫بهترین‬ .‫ننمایید‬ ‫ذخیره‬ )
‫نوع‬ ‫از‬ ‫‌ای‬
‫ه‬‫داد‬
DATE
.‫است‬
‫نوع‬ ‫از‬ ‫را‬ ‫خود‬ ‫ستون‬ ،‫دارید‬ ‫الزم‬ ‫را‬ ‫مثبت‬ ‫اعداد‬ ‫فقط‬ ‫که‬ ‫صورتی‬ ‫در‬ ‫عددی‬ ‫‌های‬
‫ه‬‫داد‬ ‫برای‬ ‫ستونی‬ ‫تعریف‬ ‫هنگام‬ ‫در‬
UNSIGNED
‫و‬ ‫اصلی‬ ‫کلید‬ ‫شما‬ ‫عددی‬ ‫ستون‬ ‫اگر‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫نمایید‬ ‫انتخاب‬ ‫را‬ ‫بازه‬ ‫حداقل‬ ‫و‬ ‫نموده‬ ‫انتخاب‬
( ‫است‬ ‫خودکار‬ ‫افزایشی‬
PRIMAY KEY and AUTO_INCREMENT
‫را‬ ‫خود‬ ‫داده‬ ‫نوع‬ ‫حتما‬ )
UNSIGNED
‫نوع‬ .‫شود‬ ‫برابر‬ ‫دو‬ ‫اصلی‬ ‫کلید‬ ‫مقدار‬ ‫حداکثر‬ ‫تا‬ ‫نمایید‬ ‫انتخاب‬
INTEGER SIGNED
‫عدد‬ ‫حداکثر‬
2147483648
‫(حدود‬
۲
‫و‬ )‫میلیارد‬
INTEGER UNSIGNED
‫عدد‬ ‫حداکثر‬
4294967295
‫(حدود‬
۴
‫می‬ ‫پشتیبانی‬ ‫را‬ )‫میلیارد‬
.‫کند‬
‫از‬ ‫استفاده‬ ‫دیگر‬ ‫روش‬
PROCEDURE ANALYSE
.‫است‬ ‫داده‬ ‫پایگاه‬ ‫خود‬ ‫پیشنهاد‬ ‫دریافت‬ ‫منظور‬ ‫به‬
PROCEDURE ANALYSE
‫می‬ ‫ارائه‬ ‫داده‬ ‫نوع‬ ‫کردن‬ ‫بهینه‬ ‫برای‬ ‫را‬ ‫خود‬ ‫پیشنهاد‬ ،‫فعلی‬ ‫‌های‬
‫ه‬‫داد‬ ‫به‬ ‫توجه‬ ‫با‬
،‫باشد‬ ‫بیشتر‬ ‫شما‬ ‫فعلی‬ ‫داده‬ ‫تعداد‬ ‫چه‬ ‫هر‬ ‫که‬ ‫باشید‬ ‫داشته‬ ‫نظر‬ ‫در‬ .‫دهد‬
PROCEDURE ANALYSE
‫پیشنهاد‬
‫از‬ ‫استفاده‬ ‫نحوه‬ .‫دهد‬ ‫می‬ ‫‌تری‬
‫ق‬‫دقی‬ ‫و‬ ‫بهتر‬
PROCEDURE ANALYSE
‫به‬ ‫آن‬ ‫نگارش‬ ‫نحوه‬ .‫است‬ ‫ساده‬ ‫بسیار‬
:‫است‬ ‫زیر‬ ‫صورت‬
1
mysql> SELECT ... FROM ... WHERE ... PROCEDURE ANALYSE([max_elements,
[max_memory]]);
:‫مانند‬
1SELECT col1, col2 FROM table1 PROCEDURE ANALYSE(10, 2000);
‫یا‬
1SELECT * FROM table1 PROCEDURE ANALYSE() G
‫مشابه‬ ‫اسامی‬
‫داده‬ ‫پایگاه‬ ‫در‬
MySQL
‫از‬ ‫یکی‬ .‫باشند‬ ‫می‬ ‫دسترسی‬ ‫قابل‬ ‫نیز‬ ‫دیگری‬ ‫مشابه‬ ‫‌های‬
‫م‬‫نا‬ ‫با‬ ‫‌ها‬
‫ه‬‫داد‬ ‫انواع‬ ‫از‬ ‫برخی‬
‫‌تر‬
‫ت‬‫راح‬ ‫سازی‬ ‫پیاده‬ ‫کار‬ ‫این‬ ‫دالیل‬
SQL
‫می‬ ‫مشاهده‬ ‫را‬ ‫اسامی‬ ‫این‬ ‫زیر‬ ‫در‬ .‫است‬ ‫دیگر‬ ‫‌ی‬
‫ه‬‫داد‬ ‫‌های‬
‫ه‬‫پایگا‬ ‫های‬
.‫نمایید‬
‫در‬ ‫‌ها‬
‫ه‬‫داد‬ ‫نوع‬ ‫برای‬ ‫مشابه‬ ‫اسامی‬
MySQL
‫داده‬ ‫نوع‬ ‫مشابه‬ ‫اسم‬
INTEGER INT
DECIMAL DEC
DECIMAL FIXED
DECIMAL NUMERIC
DOUBLE REAL
TINYINT BOOLEAN
TINYINT BOOL
VARCHAR(M) CHARACTER VARYING(M)
FLOAT FLOAT4
DOUBLE FLOAT8
TINYINT INT1
SMALLINT INT2
MEDIUMINT INT3
INT INT4
BIGINT INT8
MEDIUMBLOB LONG VARBINARY
MEDIUMTEXT LONG VARCHAR
MEDIUMTEXT LONG
MEDIUMINT MIDDLEINT
‫پرفرمنس‬ ‫برای‬ ‫مواردی‬
mariadb / mysql
:
‫کردن‬ ‫فعال‬
InnoDB file-per-table
‫دهیم‬ ‫توضیح‬ ‫که‬ ‫است‬ ‫مهم‬ ‫ابتدا‬ ‫در‬
InnoDB
‫موتور‬ ‫یک‬
storage
( ‫یا‬
storage engine
.‫است‬ )
MySQL/MariaDB
‫موتور‬ ‫عنوان‬ ‫به‬
storage
‫از‬ ‫فرض‬ ‫پیش‬ ‫صورت‬ ‫به‬ ،
InnoDB
‫گذشته‬ ‫در‬ .‫میکند‬ ‫استفاده‬
MySQL
( ‫جداول‬ ‫از‬ ‫نگهداری‬ ‫برای‬
tables
‫و‬ )
index
‫سیستم‬ ‫یک‬ ‫از‬ ‫دیتابیس‬ ‫های‬
tablespace
.‫میکرد‬ ‫استفاده‬
‫دیسک‬ ‫و‬ ‫بود‬ ‫دیتابیس‬ ‫پروسس‬ ‫آنها‬ ‫هدف‬ ‫تنها‬ ‫که‬ ‫سرورهایی‬ ‫برای‬ ‫شیوه‬ ‫این‬
storage
‫هدف‬ ‫هیچ‬ ‫برای‬ ‫آنها‬
.‫داشت‬ ‫معنا‬ ،‫نمیشد‬ ‫استفاده‬ ‫دیگری‬
InnoDB
‫دیتای‬ ‫فایل‬ ‫یک‬ ‫در‬ ‫دیتابیس‬ ‫هر‬ ‫اطالعات‬ ‫و‬ ‫آورده‬ ‫فراهم‬ ‫را‬ ‫تری‬ ‫منعطف‬ ‫شیوه‬
.
ibd
‫هر‬ .‫میشود‬ ‫ذخیره‬
. ‫فایل‬
ibd
‫یک‬
tablespace
‫اصل‬ ‫در‬ .‫میدهد‬ ‫ارائه‬ ‫را‬ ‫خودش‬ ‫از‬
tablespace
‫ایجاد‬ ‫باعث‬ ‫دیتا‬ ‫حذف‬ ‫هنگام‬
‫(یعنی‬ ‫شده‬ ‫سکتورها‬ ‫بین‬ ‫خالی‬ ‫فضای‬
Data Stream Contagency
. ‫داشتن‬ ‫با‬ ‫ولی‬ )‫رفت‬ ‫خواهد‬ ‫بین‬ ‫از‬
idb
‫برای‬ ‫جداگانه‬
table
‫این‬ ‫ها‬
fragmentation
‫آن‬ ‫در‬ ‫که‬ ‫جداولی‬ ‫برای‬ ‫فقط‬
idb
‫این‬ ‫به‬ .‫داد‬ ‫خواهد‬ ‫رخ‬ ‫هستند‬
" ‫مانند‬ ‫دیتابیس‬ ‫عملکردهای‬ ،‫شیوه‬
TRUNCATE
‫در‬ ‫تغییری‬ ‫اینکه‬ ‫بدون‬ ‫جدول‬ ‫یک‬ ‫دیتای‬ ‫کردن‬ ‫حذف‬ ‫(برای‬ "
‫به‬ ‫را‬ ‫نشده‬ ‫استفاده‬ ‫فضای‬ ‫میتوانید‬ ‫شما‬ ‫همچنین‬ ‫و‬ ‫شوند‬ ‫انجام‬ ‫سریعتر‬ ‫میتوانند‬ )‫شود‬ ‫ایجاد‬ ‫جداول‬ ‫ساختار‬
‫هنگام‬
drop
‫یا‬
truncate
.‫کنید‬ ‫اصالح‬ ،‫دیتابیس‬ ‫جدول‬ ‫یک‬ ‫کردن‬
‫در‬ ‫را‬ ‫دیتابیس‬ ‫جداول‬ ‫از‬ ‫یکسری‬ ‫میتوانید‬ ‫شما‬ ‫که‬ ‫است‬ ‫این‬ ‫حقیقت‬ ‫در‬ ‫تنظیمات‬ ‫این‬ ‫دیگر‬ ‫فایده‬
storage
‫لود‬ ‫در‬ ‫عالی‬ ‫بسیار‬ ‫بهبود‬ ‫باعث‬ ‫امر‬ ‫این‬ ‫و‬ ‫دهید‬ ‫قرار‬ ‫مجزا‬
I/O
.‫شود‬ ‫شما‬ ‫دیسک‬ ‫روی‬
innodb_file_per_table
‫اسکیول‬ ‫مای‬ ‫در‬ ‫فرض‬ ‫پیش‬ ‫صورت‬ ‫به‬
5.6
‫در‬ ‫آنرا‬ ‫میتوانید‬ ‫شما‬ .‫است‬ ‫فعال‬ ‫باالتر‬ ‫و‬
‫فایل‬
/
etc/my.cnf
.‫میباشد‬ ‫زیر‬ ‫به‬ ‫شبیه‬ ‫چیزی‬ ‫که‬ .‫کنید‬ ‫اضافه‬
innodb_file_per_table=1
‫دیتابیس‬ ‫دیتای‬ ‫ذخیره‬
MySQL
‫مجزا‬ ‫پارتیشن‬ ‫روی‬
: ‫نکته‬
‫روی‬ ‫تنها‬ ‫تنظیمات‬ ‫این‬
MySQL
‫روی‬ ‫و‬ ‫میکند‬ ‫کار‬
MariaDB
.‫نمیکند‬ ‫کار‬
‫اوقات‬ ‫گاهی‬
read/write
‫میتواند‬ ‫عامل‬ ‫سیستم‬
performace
‫سرور‬
mysql
‫اگر‬ ‫مخصوصا‬ .‫سازد‬ ‫کند‬ ‫را‬ ‫شما‬
‫روی‬
hard drive
‫هارد‬ ‫یک‬ ‫از‬ ‫که‬ ‫میکنم‬ ‫توصیه‬ ‫من‬ ‫مورد‬ ‫این‬ ‫جای‬ ‫به‬ .‫باشد‬ ‫گرفته‬ ‫قرار‬ ‫عامل‬ ‫سیستم‬ ‫با‬ ‫یکسانی‬
‫(ترجیحا‬ ‫مجزا‬ ‫درایو‬
SSD
.‫کنید‬ ‫استفاده‬ ‫اسکیول‬ ‫مای‬ ‫سرویس‬ ‫برای‬ )
‫به‬ ‫را‬ ‫جدیدی‬ ‫درایو‬ ‫که‬ ‫داشت‬ ‫خواهید‬ ‫نیاز‬ ‫شما‬ ‫مورد‬ ‫این‬ ‫انجام‬ ‫برای‬
computer/server
‫در‬ ،‫کنید‬ ‫متصل‬ ‫خود‬
‫تحت‬ ‫جدید‬ ‫درایو‬ ‫که‬ ‫میکنم‬ ‫فرض‬ ‫من‬ ‫مقاله‬ ‫این‬
/
dev/sdb
.‫بود‬ ‫خواهد‬
.‫است‬ ‫جدید‬ ‫درایو‬ ‫سازی‬ ‫آماده‬ ‫بعد‬ ‫مرحله‬
# fdisk /dev/sdb
" ‫جدید‬ ‫پارتیشن‬ ‫ایجاد‬ ‫برای‬ ‫اکنون‬
n
‫را‬ ‫جدید‬ ‫پارتیشن‬ ‫اینکه‬ ‫برای‬ ‫سپس‬ ‫دهید‬ ‫فشار‬ ‫را‬ "
primary
" ،‫کنید‬
p
‫را‬ "
‫از‬ ‫را‬ ‫پارتیشن‬ ‫شماره‬ ‫آن‬ ‫از‬ ‫بعد‬ .‫دهید‬ ‫فشار‬
1
‫تا‬
4
‫و‬ ‫انتخاب‬ ‫را‬ ‫پارتیشن‬ ‫سایز‬ ‫سپس‬ ،‫کنید‬ ‫انتخاب‬
Enter
.‫کنید‬
.‫کنید‬ ‫کانفیگ‬ ‫را‬ ‫پارتیشن‬ ‫سایز‬ ‫که‬ ‫داشت‬ ‫خواهید‬ ‫نیاز‬ ‫بعدی‬ ‫مرحله‬ ‫در‬
‫کنید‬ ‫استفاده‬ ‫را‬ ‫دیسک‬ ‫کل‬ ‫میخواهید‬ ‫شما‬ ‫اگر‬
Enter
‫میتوانید‬ ‫شما‬ ‫اینصورت‬ ‫غیر‬ ‫در‬ ‫دهید‬ ‫فشار‬ ‫دیگر‬ ‫یکبار‬ ‫را‬
‫برای‬ ‫اتمام‬ ‫از‬ ‫بعد‬ .‫کنید‬ ‫تعریف‬ ‫را‬ ‫جدید‬ ‫پارتیشن‬ ‫سایز‬ ‫دستی‬ ‫صورت‬ ‫به‬
write
" ‫تغییرات‬ ‫کردن‬
w
.‫کنید‬ ‫تایپ‬ ‫را‬ "
‫زیر‬ ‫همانند‬ ‫آسانی‬ ‫به‬ ‫کار‬ ‫این‬ .‫کنید‬ ‫ایجاد‬ ‫سیستم‬ ‫فایل‬ ‫جدید‬ ‫پارتیشن‬ ‫برای‬ ‫داشت‬ ‫خواهید‬ ‫نیاز‬ ‫شما‬ ‫سپس‬
.‫میشود‬ ‫انجام‬
# mkfs.ext4 /dev/sdb1
‫فولدر‬ ‫یک‬ ‫در‬ ‫را‬ ‫جدیدمان‬ ‫پارتیشن‬ ‫ما‬ ‫اکنون‬
mount
‫نام‬ ‫من‬ .‫میکنیم‬
folder
‫را‬ ‫خود‬
SSD
‫در‬ ‫آنرا‬ ‫و‬ ‫کردم‬ ‫انتخاب‬
‫دایرکتوری‬
root
.‫ساختم‬
# mkdir /ssd/
‫آماده‬ ‫اکنون‬
mount
.‫کردیم‬ ‫ایجاد‬ ‫جدید‬ ‫فولدر‬ ‫در‬ ‫آنرا‬ ‫که‬ ‫هستیم‬ ‫جدیدی‬ ‫پارتیشن‬ ‫کردن‬
# mount /dev/sdb1 /ssd/
‫میتوانیم‬ ‫ما‬
mount
‫هنگام‬ ‫به‬ ‫را‬ ‫دایرکتوری‬ ‫کردن‬
startup
‫فایل‬ ‫درون‬ ‫زیر‬ ‫خط‬ ‫کردن‬ ‫اضافه‬ ‫با‬ ‫و‬ ‫سیستم‬
/
etc/fstab
.‫کنیم‬ ‫اجرا‬
/dev/sdb1 /ssd ext3 defaults 0 0
‫انتقال‬ ‫آماده‬ ‫شما‬ ‫اکنون‬
MySQL
‫زیر‬ ‫دستور‬ ‫با‬ ‫را‬ ‫اسکیول‬ ‫مای‬ ‫سرویس‬ ‫ابتدا‬ .‫هستید‬ ‫جدید‬ ‫دیسک‬ ‫به‬
stop
.‫کنید‬
# service mysqld stop
‫برای‬ ‫تالش‬ ‫گونه‬ ‫هر‬ ‫از‬ ‫جلوگیری‬ ‫برای‬ ‫که‬ ‫میکنم‬ ‫توصیه‬ ‫شما‬ ‫به‬ ‫من‬
write
‫سرویس‬ ‫ها‬ ‫دیتابیس‬ ‫در‬ ‫دیتا‬ ‫کردن‬
‫های‬
Apache
‫یا‬
Nginx
‫نیز‬ ‫را‬
stop
.‫کنید‬
# service httpd stop
# service nginx stop
‫دایرکتوری‬ ‫کل‬ ‫اکنون‬
MySQL
‫جدید‬ ‫درایو‬ ‫در‬ ‫را‬
copy
.‫کنید‬
# cp /var/lib/mysql /ssd/ -Rp
‫های‬ ‫دیتابیس‬ ‫به‬ ‫توجه‬ ‫با‬ ‫مرحله‬ ‫این‬
MySQL
‫دایرکتوری‬ ‫آن‬ ‫شدن‬ ‫تمام‬ ‫از‬ ‫بعد‬ .‫بکشد‬ ‫طول‬ ‫است‬ ‫ممکن‬ ‫شما‬
mysql
.‫دهید‬ ‫نام‬ ‫تغییر‬ ‫را‬
# mv /var/lib/mysql /var/lib/mysql-backup
‫یک‬ ‫سپس‬
symlink
‫دایرکتوری‬ ‫برای‬
mysql
.‫کرد‬ ‫خواهیم‬ ‫ایجاد‬
# ln -s /ssd/mysql /var/lib/mysql
‫برای‬ ‫آماده‬ ‫شما‬ ‫اکنون‬
start
‫کردن‬
mysql
‫و‬
web
.‫هستید‬ ‫خود‬ ‫سرویس‬
# service mysqld start
# service httpd start
# service nginx start
.‫بود‬ ‫خواهند‬ ‫دسترسی‬ ‫قابل‬ ‫جدید‬ ‫درایو‬ ‫از‬ ‫شما‬ ‫اسکیول‬ ‫مای‬ ‫های‬ ‫دیتابیس‬ ‫بعد‬ ‫به‬ ‫لحظه‬ ‫این‬ ‫از‬
‫سازی‬ ‫بهینه‬
InnoDB buffer pool Usage
‫موتور‬
InnoDB
‫یک‬
buffer pool
‫برای‬
cache
‫و‬ ‫دیتا‬
index
‫در‬ ‫ها‬
memory
‫میتواند‬ ‫که‬ ‫البته‬ ‫مورد‬ ‫این‬ .‫دارد‬
‫که‬ ‫کند‬ ‫کمک‬
query
‫های‬
maysql/mariadb
‫سایز‬ ‫انتخاب‬ ‫اینجا‬ ‫در‬ .‫شوند‬ ‫اجرا‬ ‫سریعتر‬ ‫توجهی‬ ‫قابل‬ ‫طور‬ ‫به‬
‫تان‬ ‫سیستم‬ ‫مموری‬ ‫مصرف‬ ‫درباره‬ ‫را‬ ‫خوبی‬ ‫دانش‬ ‫و‬ ‫مهم‬ ‫تصمیمات‬ ‫یکسری‬ ‫شما‬ ‫که‬ ‫است‬ ‫این‬ ‫نیازمند‬ ‫مناسب‬
.‫باشید‬ ‫داشته‬
: ‫کنید‬ ‫بررسی‬ ‫هست‬ ‫نیاز‬ ‫شما‬ ‫که‬ ‫مواردی‬
•
‫باید‬ ‫شما‬ ‫منظور‬ ‫این‬ ‫برای‬ .‫دارید‬ ‫نیاز‬ ‫مموری‬ ‫مقدار‬ ‫چه‬ ‫دیگر‬ ‫های‬ ‫پروسس‬ ‫برای‬
processes
‫های‬
‫سیستم‬
page tables, socket buffers
.‫بدانید‬ ‫را‬
•
‫برای‬ ‫اختصاصی‬ ‫آیا‬ ‫سرور‬ ‫این‬ ‫اینکه‬
mysql
‫هستند‬ ‫اجرا‬ ‫حال‬ ‫در‬ ‫آن‬ ‫روی‬ ‫دیگری‬ ‫های‬ ‫سرویس‬ ‫یا‬ ‫و‬ ‫است‬
.‫میکنند‬ ‫مصرف‬ ‫مموری‬ ‫که‬
‫حدود‬ ‫که‬ ‫بخواهید‬ ‫است‬ ‫ممکن‬ ‫شما‬ ‫اختصاصی‬ ‫سرور‬ ‫یک‬ ‫روی‬
60/70
‫به‬ ‫را‬ ‫خود‬ ‫مموری‬ ‫از‬ ‫درصد‬
innodb_buffer_pool_size
‫دارید‬ ‫اجرا‬ ‫حال‬ ‫در‬ ‫بیشتری‬ ‫های‬ ‫سرویس‬ ‫سرور‬ ‫روی‬ ‫شما‬ ‫اگر‬ .‫دهید‬ ‫اختصاص‬
‫به‬ ‫که‬ ‫مموری‬ ‫میزان‬ ‫باید‬ ‫شما‬
innodb_buffer_pool_size
.‫کنید‬ ‫بررسی‬ ‫مجدد‬ ‫را‬ ‫میدهید‬ ‫اختصاص‬
‫در‬ ‫باید‬ ‫شما‬ ‫که‬ ‫مقداری‬
my.cnf
: ‫کنید‬ ‫ویرایش‬
innodb_buffer_pool_size
‫از‬ ‫جلوگیری‬
Swap
‫در‬ ‫شدن‬
MySQL
swapping
‫دیسک‬ ‫هارد‬ ‫خالی‬ ‫فضای‬ ‫از‬ ‫خاصی‬ ‫قسمت‬ ‫به‬ ‫را‬ ‫مموری‬ ‫از‬ ‫بخشی‬ ‫سیستم‬ ‫زمانیکه‬ ‫که‬ ‫ایست‬ ‫پروسه‬
" ‫آن‬ ‫به‬ ‫(که‬ ‫شما‬
swap
‫مموری‬ ‫شما‬ ‫سیستم‬ ‫که‬ ‫میدهد‬ ‫رخ‬ ‫زمانی‬ ‫معموال‬ ‫اتفاق‬ ‫این‬ .‫میدهد‬ ‫انتقال‬ )‫میگوییم‬ "
‫کردن‬ ‫خالی‬ ‫جای‬ ‫به‬ ‫و‬ ‫آورد‬ ‫می‬ ‫کم‬ ‫فیزیکی‬
RAM
‫وجود‬ ‫با‬ ‫حتی‬ .‫میدهد‬ ‫قرار‬ ‫دیسک‬ ‫درون‬ ‫را‬ ‫اطالعات‬ ‫سیستم‬
‫از‬ ‫کندتر‬ ‫خیلی‬ ‫دیسک‬ ‫اینکه‬
RAM
.‫باشد‬ ‫شما‬
.‫است‬ ‫فعال‬ ‫آپشنی‬ ‫این‬ ‫فرض‬ ‫پیش‬ ‫صورت‬ ‫به‬
# sysctl vm.swappiness
vm.swappiness = 60
‫کردن‬ ‫فعال‬ ‫غیر‬ ‫برای‬
swapping
: ‫کنید‬ ‫اجرا‬ ‫را‬ ‫زیر‬ ‫دستور‬
# sysctl -w vm.swappiness=0
‫حداکثر‬ ‫تعریف‬
Connection
‫های‬
MySQL
‫قسمت‬
max_connections
‫مقدار‬ ‫چه‬ ‫شما‬ ‫سرور‬ ‫در‬ ‫که‬ ‫میکند‬ ‫مشخص‬
connection
‫مجاز‬ ‫همزمان‬ ‫های‬
‫سرور‬ .‫است‬
MySQL/MariaDB
‫دسترسی‬ ‫سطوح‬ ‫با‬ ‫کاربر‬ ‫برای‬
supper admin
‫از‬ ‫بیشتر‬ ‫یکی‬ ‫مقدار‬
max_connections
( .‫میکند‬ ‫مجاز‬ ‫را‬
max_connections + 1
‫اسکیول‬ ‫مای‬ ‫کوئری‬ ‫زماینکه‬ ‫برای‬ ‫تنها‬ ‫کانکشن‬ )
‫و‬ ‫میشود‬ ‫بسته‬ ‫آن‬ ‫از‬ ‫بعد‬ ،‫است‬ ‫باز‬ ‫اجراست‬ ‫حال‬ ‫در‬
connection
.‫دهند‬ ‫رخ‬ ‫میتوانند‬ ‫جدید‬ ‫های‬
‫از‬ ‫باالیی‬ ‫استفاده‬ ‫میزان‬ ‫میتوان‬ ‫زیاد‬ ‫بسیار‬ ‫های‬ ‫کانکشن‬ ‫که‬ ‫باشید‬ ‫داشته‬ ‫ذهن‬ ‫در‬
ram
‫داشته‬ ‫همراه‬ ‫به‬ ‫را‬
‫سرور‬ ‫شدن‬ ‫قفل‬ ‫به‬ ‫منجر‬ ‫و‬ ‫باشند‬
mysql
‫بین‬ ‫ها‬ ‫کانکشن‬ ‫به‬ ‫نیاز‬ ‫کوچک‬ ‫های‬ ‫سایت‬ ‫معموال‬ .‫شوند‬ ‫شما‬
100
‫تا‬
200
‫به‬ ‫نیاز‬ ‫است‬ ‫ممکن‬ ‫بزرگتر‬ ‫های‬ ‫سایت‬ ‫حالیکه‬ ‫در‬ ‫هستند‬
500
-
800
.‫باشند‬ ‫داشته‬ ‫بیشتر‬ ‫حتی‬ ‫یا‬
‫از‬ ‫استفاده‬ ‫میزان‬ ‫به‬ ‫شدیدا‬ ‫میدهیم‬ ‫قرار‬ ‫اینجا‬ ‫در‬ ‫که‬ ‫مقداری‬
MySQL/MariaDB
.‫دارد‬ ‫شما‬
‫میزان‬ ‫متغییر‬ ‫صورت‬ ‫به‬ ‫میتوانید‬ ‫شما‬
max_connections
‫به‬ ‫نیاز‬ ‫بدون‬ ‫را‬
reset
‫سرویس‬ ‫کردن‬
mysql
‫با‬ ‫را‬
.‫دهید‬ ‫تغییر‬ ‫زیر‬ ‫دستور‬ ‫اجرای‬
# mysql -u root -p
mysql> set global max_connections := 300;
‫کانفیگ‬
thread_cache_size
‫در‬
MySQL
‫بخش‬
thread_cache_size
‫میزان‬
thread
‫باید‬ ‫شما‬ ‫سرور‬ ‫که‬ ‫هایی‬
cach
.‫میکند‬ ‫تعریف‬ ‫را‬ ‫کند‬
‫زمانیکه‬
‫کالینت‬
disconnect
‫میشود‬
thread
‫از‬ ‫کمتر‬ ‫اگر‬ ‫او‬ ‫های‬
thread_cache_size
‫در‬ ،‫باشند‬
cache
‫داده‬ ‫قرار‬
.‫میشود‬
‫از‬ ‫استفاده‬ ‫با‬ ‫بعدی‬ ‫های‬ ‫خواست‬ ‫در‬
thread
‫در‬ ‫شده‬ ‫ذخیره‬ ‫های‬
cache
.‫میشوند‬ ‫کامل‬
‫به‬ ‫بخشیدن‬ ‫بهبود‬ ‫برای‬
performance
‫میتوانید‬ ‫شما‬ ‫خود‬
thread_cache_size
‫بزرگ‬ ‫نسبتا‬ ‫عدد‬ ‫یک‬ ‫به‬ ‫را‬
‫در‬ .‫کنید‬ ‫تعریف‬
cache hit rate
‫مموری‬ ‫از‬ ‫کوچکی‬ ‫فضای‬ ‫در‬ ‫را‬ ‫شده‬ ‫اجرا‬ ‫های‬ ‫کوئری‬ ‫آخرین‬
cache
‫و‬ ‫کرده‬
‫سریعتر‬ ‫لود‬ ‫باعث‬ ‫امر‬ ‫همین‬
query
‫کردن‬ ‫پیدا‬ ‫برای‬ .‫میشود‬ ‫ها‬
thread cache hit rate
‫تکنیک‬ ‫میتوانید‬ ‫شما‬
.‫کنید‬ ‫استفاده‬ ‫را‬ ‫زیر‬ ‫های‬
mysql> show status like 'Threads_created';
mysql> show status like 'Connections';
‫درصد‬ ‫محاسبه‬ ‫برای‬ ‫را‬ ‫زیر‬ ‫فرمول‬ ‫اکنون‬
thread cache hit rate
.‫کنید‬ ‫استفاده‬
100 - ((Threads_created / Connections) * 100)
‫جدید‬ ‫های‬ ‫کانکشن‬ ‫اکثر‬ ‫که‬ ‫معناست‬ ‫بدان‬ ‫این‬ ‫کردید‬ ‫دریافت‬ ‫را‬ ‫کمی‬ ‫عدد‬ ‫شما‬ ‫اگر‬
MySQL
‫شروع‬ ‫حال‬ ‫در‬
‫کردن‬
thread
‫جای‬ ‫به‬ ‫جدید‬
load
‫از‬ ‫آنها‬ ‫کردن‬
cache
‫میخواهید‬ ‫مطمئنا‬ ‫شما‬ ‫مواردی‬ ‫چنین‬ ‫در‬ .‫هستند‬
thread_cache_size
.‫دهید‬ ‫افزایش‬ ‫را‬
‫که‬ ‫است‬ ‫این‬ ‫اینجا‬ ‫در‬ ‫جالب‬ ‫نکته‬
thread_cache_size
‫به‬ ‫نیاز‬ ‫اینکه‬ ‫بدون‬ ‫متغیر‬ ‫صورت‬ ‫به‬ ‫میتوان‬ ‫را‬
restart
‫سرویس‬ ‫کردن‬
mysql
.‫کنید‬ ‫اجرا‬ ‫را‬ ‫زیر‬ ‫دستور‬ ‫میتوانید‬ ‫منظور‬ ‫این‬ ‫برای‬ ‫که‬ ‫داد‬ ‫تغییر‬ ،‫باشید‬ ‫داشته‬
mysql> set global thread_cache_size = 16;
‫کردن‬ ‫فعال‬ ‫غیر‬
Reverse DNS Lookups
‫در‬
MySQL
‫فرض‬ ‫پیش‬ ‫صورت‬ ‫به‬
MySQL/MariaDB
‫یک‬
dns lookup
‫از‬
ip address/Hostname
‫آنها‬ ‫از‬ ‫که‬ ‫کاربرانی‬
‫از‬ ‫یک‬ ‫هر‬ ‫برای‬ .‫میکند‬ ‫اجرا‬ ،‫میکند‬ ‫دریافت‬ ‫کانکشن‬
client connection
،‫ها‬
ip
‫یک‬ ‫برای‬ ‫ها‬ ‫آدرس‬
host name
‫توسط‬
resolve
‫آن‬ ‫از‬ ‫بعد‬ .‫میشود‬ ‫چک‬
hostname
‫پی‬ ‫آی‬ ‫یک‬ ‫به‬
resolve
‫با‬ ‫دو‬ ‫هر‬ ‫که‬ ‫شود‬ ‫بررسی‬ ‫تا‬ ‫میشود‬
‫هم‬
match
.‫شوند‬
‫بد‬ ‫کانفیگ‬ ‫موارد‬ ‫در‬ ‫است‬ ‫ممکن‬ ‫مورد‬ ‫این‬ ‫متاسفانه‬
DNS
‫سرور‬ ‫مشکالت‬ ‫یا‬
DNS
‫این‬ ‫و‬ ،‫شود‬ ‫تاخیر‬ ‫باعث‬
‫میتوانید‬ ‫شما‬ ‫اینکه‬ ‫بر‬ ‫است‬ ‫دلیلی‬
revers dns lookup
‫غیر‬ ‫تان‬ ‫کانفیگ‬ ‫فایل‬ ‫به‬ ‫زیر‬ ‫موارد‬ ‫کردن‬ ‫اضافه‬ ‫با‬ ‫را‬
.‫کنید‬ ‫فعال‬
[mysqld]
# Skip reverse DNS lookup of clients
skip-name-resolve
‫را‬ ‫تان‬ ‫اسکیول‬ ‫مای‬ ‫سرویس‬ ‫باید‬ ‫شما‬ ‫باال‬ ‫تغییرات‬ ‫اعمال‬ ‫از‬ ‫بعد‬
restart
.‫کنید‬
‫کانفیگ‬
query_cache_size
‫در‬
MySQL
‫و‬ ‫دارید‬ ‫تکراری‬ ‫کوئری‬ ‫زیادی‬ ‫تعداد‬ ‫شما‬ ‫اگر‬
data
‫از‬ ‫نمیکند‬ ‫تغییر‬ ‫اغلب‬
query cache
‫افراد‬ .‫کنید‬ ‫استفاده‬
‫پشت‬ ‫مفهوم‬ ‫اغلب‬
query_cache_size
( ‫بایت‬ ‫گیگا‬ ‫به‬ ‫را‬ ‫مقدار‬ ‫این‬ ‫و‬ ‫نمیکنند‬ ‫درک‬ ‫را‬
GB
‫که‬ ‫میکنند‬ ‫تعریف‬ )
.‫بشود‬ ‫کارایی‬ ‫کاهش‬ ‫باعث‬ ‫حقیقت‬ ‫در‬ ‫میتواند‬
‫که‬ ‫است‬ ‫حقیقت‬ ‫این‬ ،‫آن‬ ‫علت‬
thread
‫که‬ ‫دارند‬ ‫نیاز‬ ‫ها‬
cache
.)‫کنند‬ ‫(مسدود‬ ‫ببندند‬ ‫ها‬ ‫آپدیت‬ ‫طول‬ ‫در‬ ‫را‬
‫مقدار‬ ‫معموال‬
200
-
300
MB
‫شما‬ ‫باشد‬ ‫کوچک‬ ‫نسبتا‬ ‫شما‬ ‫سایت‬ ‫وب‬ ‫اگر‬ .‫میباشد‬ ‫کافی‬ ،‫حد‬ ‫از‬ ‫بیشتر‬ ‫حتی‬
‫مقدار‬ ‫میتوانید‬
64
MB
.‫دهید‬ ‫افزایش‬ ‫آنرا‬ ‫مرور‬ ‫به‬ ‫و‬ ‫کنید‬ ‫امتحان‬ ‫را‬
‫کانفیگ‬ ‫فایل‬ ‫به‬ ‫را‬ ‫زیر‬ ‫تنظیمات‬ ‫باید‬ ‫شما‬
MySQL
.‫کنید‬ ‫اضافه‬
query_cache_type = 1
query_cache_limit = 256K
query_cache_min_res_unit = 2k
query_cache_size = 80M
‫تنظیم‬
tmp_table_size
‫و‬
max_heap_table_size
‫جلوگیری‬ ‫دیسک‬ ‫روی‬ ‫رایت‬ ‫از‬ ‫که‬ ‫کرد‬ ‫خواهند‬ ‫کمک‬ ‫شما‬ ‫به‬ ‫و‬ ‫باشند‬ ‫داشته‬ ‫یکسانی‬ ‫سایز‬ ‫باید‬ ‫بخش‬ ‫دو‬ ‫هر‬
.‫شود‬
tmp_table_size
‫و‬ ‫داخلی‬ ‫های‬ ‫جدول‬ ‫سایز‬ ‫مقدار‬ ‫حداکثر‬
in-memory
.‫میباشد‬
MyISAM
‫موقع‬
update
‫یا‬
insert
‫شدن‬ ‫تمام‬ ‫زمان‬ ‫تا‬
transaction
‫کل‬
table
‫را‬
lock
‫ولی‬ ،‫میکند‬
innodb
‫یک‬ ‫فقط‬ ‫میتواند‬
raw
‫را‬
lock
‫دیگر‬ ‫اینکه‬ ‫با‬ ‫همزمان‬ .‫میدهد‬ ‫تغییر‬ ‫یا‬
raw
‫دیگر‬ ‫توسط‬ ‫ها‬
query
‫و‬ ‫اجرا‬ ‫میتوانند‬ ‫ها‬
lock
‫برای‬ ،‫بشوند‬
unlock
‫شدن‬
table
‫بهتر‬ ‫عملکرد‬ ‫باعث‬ ‫امر‬ ‫همین‬ ‫و‬ ‫شده‬ ‫آپدیت‬ ‫مرتب‬ ‫مختلف‬ ‫های‬ ‫کوئری‬ ‫با‬
innodb
‫ولی‬ ،‫میشود‬
MyISAM
‫به‬ ‫نصبت‬
innodb
‫ریکاوری‬ ‫برای‬ ‫بهتری‬ ‫های‬ ‫مکانیزم‬
table
.‫دارد‬ ‫ها‬
‫روی‬ ‫مورد‬ ‫این‬ ‫و‬
performance
.‫گذاشت‬ ‫خواهد‬ ‫تاثیر‬ ‫دیتابیس‬
admin
‫میکنند‬ ‫توصیه‬ ‫معموال‬ ‫سیستم‬ ‫های‬
‫از‬ ‫گیگ‬ ‫هر‬ ‫ازای‬ ‫به‬ ‫که‬
ram
‫مقدار‬ ،‫زیر‬ ‫مقادیر‬ ‫دوی‬ ‫هر‬ ‫برای‬ ‫سرور‬ ‫روی‬
64M
.‫بدهند‬ ‫را‬
[mysqld]
tmp_table_size= 64M
max_heap_table_size= 64M
‫کردن‬ ‫فعال‬
Slow query Logs
‫در‬
MySQL
log
‫کردن‬
query
‫های‬
slow
‫این‬ .‫کند‬ ‫کمک‬ ‫آنها‬ ‫کردن‬ ‫دیباگ‬ ‫و‬ ‫دیتابیس‬ ‫مشکالت‬ ‫تشخیص‬ ‫در‬ ‫شما‬ ‫به‬ ‫میتواند‬
.‫میشود‬ ‫فعال‬ ‫شما‬ ‫اسکیول‬ ‫مای‬ ‫کانفیگ‬ ‫فایل‬ ‫به‬ ‫زیر‬ ‫مقدارهای‬ ‫کردن‬ ‫اضافه‬ ‫با‬ ‫آسانی‬ ‫به‬ ‫مورد‬
slow-query-log = 1
slow-query-log-file = /var/lib/mysql/mysql-slow.log
long_query_time = 1
،‫اول‬ ‫بخش‬
log
‫های‬ ‫کوئری‬
slow
‫سازی‬ ‫ذخیره‬ ‫امکان‬ ‫اسکیول‬ ‫مای‬ ‫به‬ ‫دوم‬ ‫بخش‬ ‫حالیکه‬ ‫در‬ ‫میکند‬ ‫فعال‬ ‫را‬
log
‫از‬ .‫میکند‬ ‫اعالم‬ ‫را‬ ‫واقعی‬ ‫فایل‬
long_query_time
‫طول‬ ‫اسکیول‬ ‫مای‬ ‫کوئری‬ ‫یک‬ ‫زمانیکه‬ ‫مقدار‬ ‫تعریف‬ ‫برای‬
‫برای‬ ‫بکشید‬ ‫طول‬ ‫شده‬ ‫مشخص‬ ‫زمان‬ ‫این‬ ‫از‬ ‫بیشتر‬ ‫کوئری‬ ‫اگر‬ ‫حقیقت‬ ‫در‬ .‫کنید‬ ‫استفاده‬ ‫شود‬ ‫اجرا‬ ‫تا‬ ‫میکشد‬
‫کوئری‬ ‫یک‬ ‫منزله‬ ‫به‬ ‫سیستم‬
slow
.‫میشود‬ ‫تلقی‬
‫برای‬ ‫بررسی‬
Connection
‫آزاد‬ ‫های‬
MySQL
( ‫آزاد‬ ‫های‬ ‫کانکشن‬
idle
‫ممکن‬ ‫صورت‬ ‫در‬ ‫یا‬ ‫متوقف‬ ‫باید‬ ‫و‬ ‫میکنند‬ ‫مصرف‬ ‫را‬ ‫سیستم‬ ‫منابع‬ )
refresh
‫این‬ .‫شوند‬
‫وضعیت‬ ‫در‬ ‫هایی‬ ‫کانکشن‬ ‫چنین‬
sleep
‫باقی‬ ‫حالت‬ ‫همان‬ ‫در‬ ‫طوالنی‬ ‫زمانی‬ ‫مدت‬ ‫برای‬ ‫معموال‬ ‫و‬ ‫میبرند‬ ‫سر‬ ‫به‬
‫کردن‬ ‫پیدا‬ ‫برای‬ .‫میماند‬
connection
.‫کنید‬ ‫اجرا‬ ‫را‬ ‫زیر‬ ‫دستور‬ ‫میتوانید‬ ‫آزاد‬ ‫های‬
# mysqladmin processlist -u root -p | grep “Sleep”
‫وضعیت‬ ‫در‬ ‫که‬ ‫هایی‬ ‫پروسس‬ ‫از‬ ‫لیستی‬ ‫شما‬ ‫به‬ ‫دستور‬ ‫این‬
sleep
‫این‬ .‫داد‬ ‫خواهد‬ ‫نمایش‬ ‫را‬ ‫هستند‬
event
‫هنگامیکه‬ ‫مثال‬ .‫میشود‬ ‫نمایان‬ ‫میکند‬ ‫استفاده‬ ‫دیتابیس‬ ‫به‬ ‫دائمی‬ ‫ارتباط‬ ‫از‬ ‫کد‬ ‫یک‬ ‫زمانیکه‬
php
‫از‬ ‫استفاده‬ ‫با‬
mysql_pconnect
‫را‬ ‫کانکشن‬ ‫و‬ ‫کرد‬ ‫اجرا‬ ‫را‬ ‫هایی‬ ‫کوئری‬ ‫اینکه‬ ‫از‬ ‫بعد‬ ‫میکند‬ ‫باز‬ ‫دیتابیس‬ ‫به‬ ‫را‬ ‫کانکشنی‬ ‫یک‬
‫این‬ ‫کرد‬ ‫رها‬ ‫باز‬ ‫همانطور‬
event
‫هر‬ ‫که‬ ‫میشود‬ ‫باعث‬ ‫مورد‬ ‫این‬ .‫میشود‬ ‫نمایان‬
buffer
‫هر‬ ‫ازای‬ ‫به‬
thread
‫در‬
memory
‫آن‬ ‫زمانیکه‬ ‫تا‬ ‫شود‬ ‫داشته‬ ‫نگه‬
thread
.‫برود‬ ‫بین‬ ‫از‬
‫کردن‬ ‫چک‬ ،‫دهید‬ ‫انجام‬ ‫باید‬ ‫اینجا‬ ‫در‬ ‫شما‬ ‫که‬ ‫چیزی‬ ‫اولین‬
code
‫به‬ ‫اگر‬ .‫میباشد‬ ‫آن‬ ‫اصالح‬ ‫و‬
code
‫بیرون‬
‫بخش‬ ‫میتوانید‬ ،‫ندارید‬ ‫دسترسی‬ ‫سیستم‬
wait_timeout
‫فرض‬ ‫پیش‬ ‫مقدار‬ .‫دهید‬ ‫تغییر‬ ‫را‬
28800
‫است‬ ‫ثانیه‬
‫به‬ ‫شبیه‬ ‫چیزی‬ ‫به‬ ‫راحت‬ ‫خیال‬ ‫با‬ ‫آنرا‬ ‫میتوانید‬ ‫شما‬ ‫که‬
60
.‫دهید‬ ‫کاهش‬
wait_timeout=60
‫برای‬ ‫مناسب‬ ‫سیستم‬ ‫فایل‬ ‫انتخاب‬
MySQL
‫در‬ ‫کنید‬ ‫بررسی‬ ‫دارید‬ ‫نیاز‬ ‫که‬ ‫چیزی‬ ‫ترین‬ ‫مهم‬ .‫است‬ ‫حیاتی‬ ‫شما‬ ‫دیتابیس‬ ‫برای‬ ‫درست‬ ‫سیستم‬ ‫فایل‬ ‫انتخاب‬
.‫است‬ ‫مدیریت‬ ‫در‬ ‫راحتی‬ ‫و‬ ‫کارایی‬ ،‫یکپارچگی‬ ‫اینجا‬
‫های‬ ‫توصیه‬ ‫به‬ ‫توجه‬ ‫با‬
MariaDB
‫ها‬ ‫سیستم‬ ‫فایل‬ ‫بهترین‬
XFS, Ext4
‫و‬
Btrfs
‫فایل‬ ‫آنها‬ ‫همه‬ .‫هستند‬
‫های‬ ‫سیستم‬
enterprise
‫ذخیره‬ ‫برای‬ ‫بزرگ‬ ‫خیلی‬ ‫مقدارهای‬ ‫و‬ ‫بزرگ‬ ‫خیلی‬ ‫های‬ ‫فایل‬ ‫با‬ ‫میتوانند‬ ‫که‬ ‫هستند‬ ‫ی‬
.‫گیرند‬ ‫قرار‬ ‫استفاده‬ ‫مورد‬
.‫کنید‬ ‫مشاهده‬ ‫سیستم‬ ‫فایل‬ ‫سه‬ ‫این‬ ‫درباره‬ ‫مفید‬ ‫اطالعات‬ ‫یکسری‬ ‫میتوانید‬ ‫شما‬ ‫زیر‬ ‫در‬
Btrfs Ext4 XFS Filesystems
16EB 1EB 8EB Maximum filesystem
size
16EB 16TB 8EB Maximum file size
.‫است‬ ‫شده‬ ‫داده‬ ‫توضیح‬ ‫زیر‬ ‫مقاله‬ ‫در‬ ‫مفصل‬ ‫صورت‬ ‫به‬ ‫لینوکسی‬ ‫های‬ ‫سیستم‬ ‫فایل‬ ‫معایب‬ ‫و‬ ‫مزایا‬
: ‫لینوکس‬ ‫سیستم‬ ‫فایل‬
Boot Loading, Disk Partitioning, BIOS, UEFI
‫و‬
File System Types
)‫زودی‬ ‫(به‬
‫تعریف‬
max_allowed_packet
‫در‬
MySQL
( ‫ردیف‬ ‫یک‬ ‫حقیقت‬ ‫در‬ ‫مجزا‬ ‫پکت‬ ‫یک‬ ‫معموال‬ .‫میکند‬ ‫تقسیم‬ ‫ها‬ ‫پکت‬ ‫به‬ ‫را‬ ‫دیتا‬ ‫اسکیول‬ ‫مای‬
row
‫به‬ ‫که‬ ‫است‬ )
‫بخش‬ .‫میشود‬ ‫ارسال‬ ‫کالینت‬ ‫یک‬ ‫سمت‬
max_allowed_packet
‫را‬ ‫شود‬ ‫ارسال‬ ‫میتواند‬ ‫که‬ ‫پکتی‬ ‫سایز‬ ‫حداکثر‬
.‫میکند‬ ‫تعریف‬ ‫و‬ ‫مشخص‬
‫یک‬ ‫که‬ ‫شود‬ ‫باعث‬ ‫میتواند‬ ‫مقدار‬ ‫این‬ ‫کم‬ ‫خیلی‬ ‫تعریف‬
query
‫یک‬ ‫شما‬ ‫و‬ ‫شود‬ ‫متوقف‬
error
‫در‬
error log
‫مای‬
.‫کنید‬ ‫تعریف‬ ‫خود‬ ‫پکت‬ ‫بزرگترین‬ ‫سایز‬ ‫به‬ ‫را‬ ‫مقدار‬ ‫این‬ ‫که‬ ‫میشود‬ ‫توصیه‬ .‫کنید‬ ‫دریافت‬ ‫اسکیول‬
‫تنظیمات‬ ‫کردن‬ ‫بررسی‬
Performance
‫در‬
MySQL
‫گیری‬ ‫اندازه‬
performance
‫در‬
MySQL/MariaDB
‫بررسی‬ ‫مرتبا‬ ‫که‬ ‫اصلی‬ ‫کارهای‬ ‫در‬ ‫باید‬ ‫شما‬ ‫که‬ ‫است‬ ‫موردی‬
‫بهبود‬ ‫به‬ ‫نیاز‬ ‫یا‬ ‫کرد‬ ‫تغییر‬ ‫منابع‬ ‫مصرف‬ ‫میزان‬ ‫در‬ ‫چیزی‬ ‫اگر‬ ‫که‬ ‫میکند‬ ‫کمک‬ ‫شما‬ ‫به‬ ‫مورد‬ ‫این‬ .‫دهید‬ ‫قرار‬ ‫میکنید‬
.‫کنید‬ ‫بررسی‬ ‫آنرا‬ ‫داشت‬
‫را‬ ‫آنها‬ ‫ترین‬ ‫ساده‬ ‫و‬ ‫آسانترین‬ ‫از‬ ‫یکی‬ ‫شما‬ ‫به‬ ‫داریم‬ ‫قصد‬ ‫ما‬ ‫اما‬ ،‫دارند‬ ‫وجود‬ ‫سنجی‬ ‫معیار‬ ‫برای‬ ‫ابزارها‬ ‫از‬ ‫تنوعی‬
‫ابزار‬ ‫این‬ .‫بدهیم‬ ‫پیشنهاد‬ ‫شما‬ ‫به‬
mysqltuner
.‫میشود‬ ‫نامیده‬
.‫کنید‬ ‫استفاده‬ ‫را‬ ‫زیر‬ ‫دستورهای‬ ‫آن‬ ‫اجرای‬ ‫و‬ ‫دانلود‬ ‫برای‬
# wget https://github.com/major/MySQLTuner-perl/tarball/master
# tar xf master
# cd major-MySQLTuner-perl-993bc18/
# ./mysqltuner.pl
‫مصرف‬ ‫میزان‬ ‫درباره‬ ‫جزئیات‬ ‫با‬ ‫گزارش‬ ‫یک‬ ‫شما‬
mysql
‫خواهید‬ ‫دریافت‬ ‫آن‬ ‫برای‬ ‫ترفندهایی‬ ‫همچنین‬ ‫و‬ ‫خود‬
‫فرض‬ ‫پیش‬ ‫و‬ ‫شده‬ ‫نصب‬ ‫سرویس‬ ‫یک‬ ‫از‬ ‫خروجی‬ ‫نمونه‬ ‫یک‬ ‫اینجا‬ ‫در‬ .‫کرد‬
mariadb
.‫میکنید‬ ‫مشاهده‬ ‫را‬
‫جداول‬ ‫تعمیر‬ ‫و‬ ‫سازی‬ ‫بهینه‬
MySQL
‫های‬ ‫جدول‬ ‫اوقات‬ ‫گاهی‬
MySQL/MariaDB
‫سادگی‬ ‫به‬ ‫کامال‬
crashe
‫طور‬ ‫به‬ ‫سرور‬ ‫زمانیکه‬ ‫مخصوصا‬ ،‫میکند‬
‫عملیات‬ ‫طول‬ ‫در‬ ‫حتی‬ ‫یا‬ ‫و‬ ‫کند‬ ‫هنگ‬ ‫ناگهان‬ ‫سیستم‬ ‫فایل‬ ‫یا‬ ‫و‬ ‫شود‬ ‫خاموش‬ ‫ای‬ ‫منتظره‬ ‫غیر‬
copy
‫که‬ ‫هنگامی‬ ،
‫ها‬ ‫جدول‬ ‫است‬ ‫ممکن‬ ‫است‬ ‫دسترس‬ ‫در‬ ‫هنوز‬ ‫دیتابیس‬
crash
‫ابزار‬ ‫یک‬ ‫خوشبختانه‬ .‫کند‬
open source
‫رایگان‬
" ‫نام‬ ‫به‬
mysqlcheck
‫و‬ ‫تعمیر‬ ،‫بررسی‬ ‫را‬ ‫لینوکس‬ ‫در‬ ‫جداول‬ ‫همه‬ ‫دیتابیس‬ ‫اتوماتیک‬ ‫صورت‬ ‫به‬ ‫که‬ ‫دارد‬ ‫وجود‬ "
.‫میکند‬ ‫سازی‬ ‫بهینه‬
# mysqlcheck -u root -p --check --all-databases
# mysqlcheck -u root -p --auto-repair --optimize --all-databases
# mysqlcheck -u root -p --check databasename
# mysqlcheck -u root -p --auto-repair --check --optimize databasename
‫داده‬ ‫پایگاه‬ ‫از‬ ‫تر‬ ‫راحت‬ ‫استفاده‬ ‫زمینه‬ ‫در‬ ‫نکاتی‬
MySQL
‫نتایج‬ ‫عمودی‬ ‫نمایش‬
‫یک‬ ‫نتایج‬ ‫عمومی‬ ‫مشاهده‬ ‫برای‬
query
‫از‬ ; ‫جای‬ ‫به‬

G
:‫مانند‬ .‫کنید‬ ‫استفاده‬ ‫آن‬ ‫انتهای‬ ‫در‬
mysql> select * from PARTITIONS limit 2 G
*************************** 1. row ***************************
TABLE_CATALOG: NULL
TABLE_SCHEMA: information_schema
TABLE_NAME: CHARACTER_SETS
PARTITION_NAME: NULL
SUBPARTITION_NAME: NULL
PARTITION_ORDINAL_POSITION: NULL
SUBPARTITION_ORDINAL_POSITION: NULL
PARTITION_METHOD: NULL
SUBPARTITION_METHOD: NULL
PARTITION_EXPRESSION: NULL
SUBPARTITION_EXPRESSION: NULL
PARTITION_DESCRIPTION: NULL
TABLE_ROWS: 0
AVG_ROW_LENGTH: 384
DATA_LENGTH: 0
MAX_DATA_LENGTH: 16604160
INDEX_LENGTH: 0
DATA_FREE: 0
CREATE_TIME: NULL
UPDATE_TIME: NULL
CHECK_TIME: NULL
CHECKSUM: NULL
PARTITION_COMMENT:
NODEGROUP:
TABLESPACE_NAME: NULL
*************************** 2. row ***************************
TABLE_CATALOG: NULL
TABLE_SCHEMA: information_schema
TABLE_NAME: COLLATIONS
PARTITION_NAME: NULL
SUBPARTITION_NAME: NULL
PARTITION_ORDINAL_POSITION: NULL
SUBPARTITION_ORDINAL_POSITION: NULL
PARTITION_METHOD: NULL
SUBPARTITION_METHOD: NULL
PARTITION_EXPRESSION: NULL
SUBPARTITION_EXPRESSION: NULL
PARTITION_DESCRIPTION: NULL
TABLE_ROWS: 0
AVG_ROW_LENGTH: 231
DATA_LENGTH: 0
MAX_DATA_LENGTH: 16704765
INDEX_LENGTH: 0
DATA_FREE: 0
CREATE_TIME: NULL
UPDATE_TIME: NULL
CHECK_TIME: NULL
CHECKSUM: NULL
PARTITION_COMMENT
:
NODEGROUP
:
TABLESPACE_NAME: NULL
‫از‬ ‫استفاده‬
--
safe-updates
‫پارامتر‬ ‫از‬ ‫استفاده‬ ‫با‬
--
safe-updates
‫معادل‬:(
--
i-am-a-dummy
‫یا‬
-
U
‫امنیتی‬ ‫حصار‬ ‫یک‬ ‫توانید‬ ‫می‬ )
‫برای‬
query
‫به‬ ‫مربوط‬ ‫های‬
update
‫و‬
delete
‫اگر‬ ‫که‬ ‫صورت‬ ‫بدین‬ .‫کنید‬ ‫فعال‬
query
‫شما‬ ‫ویرایش‬ ‫یا‬ ‫حذف‬
where
:‫مانند‬ .‫شود‬ ‫نمی‬ ‫اجرا‬ ،‫باشد‬ ‫نداشته‬
mysql> delete from meta;
ERROR 1175 (HY000): You are using safe update mode and you tried to update a table
without a WHERE that uses a KEY column
‫یا‬
mysql> update meta set meta_key = 'my_key';
ERROR 1175 (HY000): You are using safe update mode and you tried to update a table
without a WHERE that uses a KEY column
‫پارامتر‬ ‫از‬ ‫استفاده‬ ‫جای‬ ‫به‬ ‫توانید‬ ‫می‬ ‫شما‬ ‫همچنین‬
--
safe-updates
‫دستور‬ ‫از‬
SET
‫در‬
MySQL
‫استفاده‬
:‫مانند‬ .‫نمایید‬
mysql> SET sql_safe_updates=1, sql_select_limit=1000, sql_max_join_size=1000000;
‫کردن‬ ‫فعال‬ ‫بر‬ ‫عالوه‬ ‫باال‬ ‫دستور‬
safe updates
‫محدودیت‬ ‫برای‬ ‫نیز‬ ‫حداکثرهایی‬ ،
select
‫انتخاب‬ ‫و‬ ‫ساده‬
.‫کند‬ ‫می‬ ‫اعمال‬ ‫جدولی‬ ‫چندین‬
‫سازی‬ ‫فعال‬
auto complete
‫بروزرسانی‬ ‫و‬
cache
‫آن‬
‫نصب‬ ‫از‬ ‫بعد‬
MySQL
‫قابلیت‬ ‫موارد‬ ‫از‬ ‫بسیاری‬ ‫در‬
auto complete
.‫است‬ ‫فعال‬ »‫خودکار‬ ‫کردن‬ ‫«کامل‬ ‫همان‬ ‫یا‬
‫آن‬ ‫سازی‬ ‫فعال‬ ‫به‬ ‫مربوط‬ ‫پارامتر‬
--
auto-rehash
‫فرمان‬ ‫خط‬ ‫در‬ ‫توانید‬ ‫می‬ ‫شما‬ ‫همچنین‬ .‫باشد‬ ‫می‬
MySQL
‫تایپ‬ ‫با‬
#
‫دیگر‬ ‫کاربرد‬ .‫کنید‬ ‫فعال‬ ‫را‬ ‫قابلیت‬ ‫این‬
#
‫کش‬ ‫بروزرسانی‬
auto completion
‫انجام‬ ‫از‬ ‫بعد‬
.‫باشد‬ ‫می‬ ‫داده‬ ‫پایگاه‬ ‫روی‬ ‫بر‬ ‫تغییرات‬
‫دکمه‬ ‫کافیست‬ ‫خط‬ ‫یک‬ ‫کردن‬ ‫کامل‬ ‫*برای‬
Tab
‫عبارت‬ ‫یک‬ ‫کردن‬ ‫کامل‬ ‫برای‬ ‫نتایج‬ ‫که‬ ‫صورتی‬ ‫در‬ .‫دهید‬ ‫فشار‬ ‫را‬
‫دو‬ ‫زدن‬ ‫با‬ ،‫باشد‬ ‫مورد‬ ‫یک‬ ‫از‬ ‫بیش‬
tab
.‫فرمایید‬ ‫می‬ ‫مشاهده‬ ‫را‬ ‫نتایج‬ ‫این‬ ‫فهرست‬ ،‫هم‬ ‫سر‬ ‫پشت‬
‫اجرا‬ ‫حال‬ ‫در‬ ‫فرایندهای‬ ‫کامل‬ ‫فهرست‬ ‫مشاهده‬
‫دستور‬ ‫کافیست‬ ‫اجرا‬ ‫حال‬ ‫در‬ ‫فرایندهای‬ ‫مشاهده‬ ‫برای‬
show processlist
.‫کنید‬ ‫وارد‬ ‫فرمان‬ ‫خط‬ ‫در‬ ‫را‬
‫کامل‬ ‫نمایش‬ ‫برای‬ ‫همچنین‬
query
‫پارامتر‬ ‫توانید‬ ‫می‬ ‫اجرا‬ ‫حال‬ ‫در‬
full
:‫مانند‬ .‫کنید‬ ‫اضافه‬ ‫دستور‬ ‫این‬ ‫به‬ ‫را‬
mysql> show full processlist;
+------+------+-----------+---------+---------+------+-------+-----------------------+
| Id | User | Host | db | Command | Time | State | Info |
+------+------+-----------+---------+---------+------+-------+-----------------------+
| 3101 | root | localhost | efs_tmp | Query | 0 | NULL | show full processlist |
+------+------+-----------+---------+---------+------+-------+-----------------------+
( ‫کشتن‬
kill
‫فرایند‬ ‫یک‬ )
‫دستور‬ ‫خروجی‬ ‫اول‬ ‫ستون‬ ‫در‬
show processlist
‫برای‬ .‫کردید‬ ‫مشاهده‬ ‫را‬ ‫اجرا‬ ‫حال‬ ‫در‬ ‫فرآیند‬ ‫به‬ ‫مربوط‬ ‫دی‬ ‫آی‬
‫دستور‬ ‫کافیست‬ ‫فرایند‬ ‫این‬ ‫ساختن‬ ‫متوقف‬
kill
:‫کنیم‬ ‫اجرا‬ ‫زیر‬ ‫صورت‬ ‫به‬ ‫را‬
mysql> kill 3101;
‫وضعیت‬ ‫مشاهده‬
MySQL
‫بیشتر‬ ‫اطالعات‬ ‫برخی‬ ‫و‬
‫کلی‬ ‫وضعیت‬ ‫مشاهده‬ ‫برای‬
MySQL
‫دستور‬ ‫از‬ ‫شده‬ ‫فعال‬ ‫های‬ ‫پارامتر‬ ‫و‬ ‫تنظیمات‬ ‫شامل‬
show status
:‫مانند‬ .‫کنیم‬ ‫می‬ ‫استفاده‬
[sql]
mysql> show status;
+-----------------------------------+-----------+
| Variable_name | Value |
+-----------------------------------+-----------+
| Aborted_clients | 3 |
| Aborted_connects | 0 |
| Binlog_cache_disk_use | 0 |
| Binlog_cache_use | 0 |
| Bytes_received | 1346 |
.......…
........
......
...
.
[/sql]
‫وضعیت‬ ‫مشاهده‬ ‫برای‬ ‫همچنین‬ INNODB ‫دستور‬ ‫از‬ SHOW ENGINE INNODB STATUS ‫نمایید‬ ‫استفاده‬.
‫دستور‬ show table status ‫مانند‬ .‫شود‬ ‫می‬ ‫استفاده‬ ‫جداول‬ ‫وضعیت‬ ‫مشاهده‬ ‫برای‬ ‫نیز‬:
mysql> show table status like '%user%' G
*************************** 1. row ***************************
Name: user
Engine: MyISAM
Version: 10
Row_format: Dynamic
Rows: 14
Avg_row_length: 80
Data_length: 1128
Max_data_length: 281474976710655
Index_length: 2048
Data_free: 0
Auto_increment: NULL
Create_time: 2010-11-21 18:07:11
Update_time: 2011-02-27 14:57:28
Check_time: NULL
Collation: utf8_bin
Checksum: NULL
Create_options:
Comment: Users and global privileges
1 row in set (0.00 sec)
[/sql]
‫از‬ *
like
. ‫کرد‬ ‫استفاده‬ ‫میتوان‬ ‫نتایج‬ ‫ساختن‬ ‫محدود‬ ‫برای‬
‫داده‬ ‫پایگاه‬ ‫وضعیت‬ ‫به‬ ‫سریع‬ ‫دسترسی‬
‫دستور‬ ‫کافیست‬ ‫داده‬ ‫پایگاه‬ ‫به‬ ‫سریع‬ ‫دسترسی‬ ‫برای‬

s
‫فرمان‬ ‫خط‬ ‫در‬ ‫را‬
MySQL
:‫نمایید‬ ‫وارد‬
[sql]
mysql> s
--------------
mysql Ver 14.14 Distrib 5.1.49, for debian-linux-gnu (i686) using readline 6.1
Connection id: 3103
Current database: mydb_tmp
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.1.49-1ubuntu8.1 (Ubuntu)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /var/run/mysqld/mysqld.sock
Uptime: 12 hours 39 min 28 sec
Threads: 1 Questions: 27846 Slow queries: 2 Opens: 7711 Flush tables: 1 Open tables: 64
Queries per second avg: 0.611
--------------
[/sql]
‫دستور‬
show create
‫دستور‬ ‫کلی‬ ‫طور‬ ‫به‬
show create
‫می‬ ‫استفاده‬ ...‫و‬ ‫تابع‬ ،‫داده‬ ‫پایگاه‬ ،‫جدول‬ ‫یک‬ ‫ساخت‬ ‫نحوه‬ ‫مشاهده‬ ‫برای‬
:‫مانند‬ .‫شود‬
[sql]
mysql> show create database mysql G
*************************** 1. row ***************************
Database: mysql
Create Database: CREATE DATABASE `mysql` /*!40100 DEFAULT CHARACTER SET utf8 */
[/sql]
‫یا‬
[sql]
mysql> show create table time_zone G
*************************** 1. row ***************************
Table: time_zone
Create Table: CREATE TABLE `time_zone` (
`Time_zone_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Use_leap_seconds` enum('Y','N') NOT NULL DEFAULT 'N',
PRIMARY KEY (`Time_zone_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Time zones'
[/sql]
‫جدول‬ ‫چند‬ ‫ترکیب‬ ‫از‬ ‫جدول‬ ‫یک‬ ‫ساخت‬
‫انواع‬ ‫از‬ ‫یکی‬
engine
‫در‬ ‫موجود‬ ‫های‬
MySQL
‫انجین‬
MERGE
‫یا‬
MRG_MyISAM
‫این‬ .‫باشد‬ ‫می‬
engine
‫برای‬
.‫گیرد‬ ‫می‬ ‫قرار‬ ‫استفاده‬ ‫مورد‬ ‫جدول‬ ‫یک‬ ‫در‬ ‫جدول‬ ‫چندین‬ ‫ترکیب‬
‫انجین‬ ‫با‬ ‫جدول‬ ‫دو‬ ‫ما‬ ‫زیر‬ ‫در‬
MyISAM
‫جدول‬ ‫یک‬ ‫و‬
total
‫انجین‬ ‫با‬
MERGE
‫ساخته‬ ‫اول‬ ‫جدول‬ ‫دو‬ ‫ترکیب‬ ‫از‬
:‫ایم‬
[sql]
mysql> CREATE TABLE t1 (
-> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
-> message CHAR(20)) ENGINE=MyISAM;
mysql> CREATE TABLE t2 (
-> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
-> message CHAR(20)) ENGINE=MyISAM;
mysql> CREATE TABLE total (
-> a INT NOT NULL AUTO_INCREMENT,
-> message CHAR(20), INDEX(a))
-> ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;
[/sql]
‫به‬ ‫اطالعات‬ ‫کردن‬ ‫وارد‬ ‫صورت‬ ‫در‬
t1
‫و‬
t
‫طریق‬ ‫از‬ ‫اطالعات‬ ‫به‬ ‫دستیابی‬ ‫امکان‬ ،‫ها‬ ‫آن‬ ‫اطالعات‬ ‫بروزرسانی‬ ‫ویا‬
‫جدول‬
total
:‫مانند‬ .‫دارد‬ ‫وجود‬
[sql]
mysql> INSERT INTO t1 (message) VALUES ('Testing'),('table'),('t1');
mysql> INSERT INTO t2 (message) VALUES ('Testing'),('table'),('t2');
mysql> SELECT * FROM total;
+---+---------+
| a | message |
+---+---------+
| 1 | Testing |
| 2 | table |
| 3 | t1 |
| 1 | Testing |
| 2 | table |
| 3 | t2 |
+---+---------+
[/sql]
‫دستور‬
mysqlshow
‫اطالعات‬ ‫فهرست‬ ‫به‬ ‫سریع‬ ‫دسترسی‬ ‫برای‬
‫دستور‬ ‫از‬ ‫آنها‬ ‫های‬ ‫ستون‬ ‫و‬ ‫جداول‬ ،‫داده‬ ‫های‬ ‫پایگاه‬ ‫فهرست‬ ‫به‬ ‫سریع‬ ‫دسترسی‬ ‫برای‬ ‫توانید‬ ‫می‬ ‫شما‬
mysqlshow
:‫مانند‬ .‫نمایید‬ ‫استفاده‬
[sql]$ mysqlshow -uroot
+--------------------+
| Databases |
+--------------------+
| information_schema |
| mydb_tmp |
| mydb |
| mysql |
| radius |
| security |
+--------------------+
[/sql]
‫یا‬
[sql]$ mysqlshow -uroot mysql
Database: mysql
+---------------------------+
| Tables |
+---------------------------+
| columns_priv |
| db |
| event |
| func |
| general_log |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| servers |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
[/sql]
‫یا‬
[sql]$ mysqlshow -uroot mysql servers
Database: mysql Table: servers
+-------------+----------+-----------------+------+-----+---------+-------
+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+-------------+----------+-----------------+------+-----+---------+-------
+---------------------------------+---------+
| Server_name | char(64) | utf8_general_ci | NO | PRI | | | select,insert,update,references | |
| Host | char(64) | utf8_general_ci | NO | | | | select,insert,update,references | |
| Db | char(64) | utf8_general_ci | NO | | | | select,insert,update,references | |
| Username | char(64) | utf8_general_ci | NO | | | | select,insert,update,references | |
| Password | char(64) | utf8_general_ci | NO | | | | select,insert,update,references | |
| Port | int(4) | | NO | | 0 | | select,insert,update,references | |
| Socket | char(64) | utf8_general_ci | NO | | | | select,insert,update,references | |
| Wrapper | char(64) | utf8_general_ci | NO | | | | select,insert,update,references | |
| Owner | char(64) | utf8_general_ci | NO | | | | select,insert,update,references | |
+-------------+----------+-----------------+------+-----+---------+-------
+---------------------------------+---------+
[/sql]
‫ارجحیت‬ ‫با‬ ‫همراه‬ ‫سازی‬ ‫مرتب‬
‫یک‬ ‫سازی‬ ‫مرتب‬ ‫بر‬ ‫عالوه‬ ‫دارید‬ ‫قصد‬ ‫که‬ ‫صورتی‬ ‫در‬
query
‫آن‬ ‫های‬ ‫ریف‬ ‫از‬ ‫بعضی‬ ‫به‬ ‫نیز‬ ‫ارجحیتی‬ ،‫انتخاب‬
‫ترکیب‬ ‫از‬ ‫کافیست‬ ،‫بدهید‬
IN
)(
‫و‬
order by
‫ستون‬ ‫اساس‬ ‫بر‬ ‫سازی‬ ‫مرتب‬ ‫بر‬ ‫عالوه‬ ‫زیر‬ ‫مثال‬ ‫در‬ .‫کنید‬ ‫استفاده‬
iso_code
‫های‬ ‫ردیف‬ ‫به‬
IR
‫و‬
US
:‫ایم‬ ‫داده‬ ‫باالتری‬ ‫وزن‬ ‫و‬ ‫ارجحیت‬
[sql]
mysql>SELECT * FROM countries ORDER by iso_code IN ('IR', 'US') desc;
+----------+----------------------------------------+
| iso_code | name |
+----------+----------------------------------------+
| IR | IRAN |
| US | United States |
| AF | Afghanistan |
| AL | Albania |
| DZ | Algeria |
| AS | American Samoa |
+----------+----------------------------------------+
[/sql]
‫داده‬ ‫پایگاه‬ ‫به‬ ‫فایل‬ ‫از‬ ‫اطالعات‬ ‫کردن‬ ‫وارد‬
MySQL
‫داده‬ ‫پایگاه‬ ‫به‬ ‫فایل‬ ‫یک‬ ‫از‬ ‫اطالعات‬ ‫کردن‬ ‫وارد‬ ‫برای‬
MySQL
` ‫دستور‬ ‫از‬
LOAD DATA INFILE
‫می‬ ‫استفاده‬ `
:‫است‬ ‫زیر‬ ‫صورت‬ ‫به‬ ‫دستور‬ ‫این‬ ‫کلی‬ ‫شکل‬ .‫کنیم‬
mysql> LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name'
[REPLACE | IGNORE]
INTO TABLE tbl_name
[CHARACTER SET charset_name]
[{FIELDS | COLUMNS}
[TERMINATED BY 'string']
[[OPTIONALLY] ENCLOSED BY 'char']
[ESCAPED BY 'char']
]
[LINES
[STARTING BY 'string']
[TERMINATED BY 'string']
]
[IGNORE number LINES]
[(col_name_or_user_var,...)]
[SET col_name = expr,...]
:‫باشد‬ ‫می‬ ‫زیر‬ ‫شکل‬ ‫به‬ ‫دستور‬ ‫این‬ ‫از‬ ‫استفاده‬ ‫شکل‬ ‫ترین‬ ‫ساده‬
mysql> LOAD DATA INFILE 'data.txt' INTO TABLE my_db.my_table;
( ‫ها‬ ‫فیلد‬ ‫جداکننده‬ ‫که‬ ‫صورتی‬ ‫در‬
FIELDS TERMINATED
،‫نکنید‬ ‫مشخص‬ ‫را‬ )
MySQL
 ‫فرض‬ ‫پیش‬ ‫مقدار‬
t
( ‫تب‬ ‫همان‬ ‫که‬
Tab
 ‫خطوط‬ ‫جداکننده‬ ‫فرض‬ ‫پیش‬ ‫مقدار‬ ‫همچنین‬ .‫گیرد‬ ‫می‬ ‫نظر‬ ‫در‬ ‫را‬ ‫هست‬ )
n
‫خط‬ ‫همان‬ ‫که‬
( ‫جدید‬
New Line
.‫گیرد‬ ‫می‬ ‫نظر‬ ‫در‬ ‫را‬ ‫باشد‬ ‫می‬ )
‫نکته‬
‫کاراکترهای‬ ‫دارای‬ ‫شما‬ ‫فایل‬ ‫که‬ ‫صورتی‬ ‫در‬
UTF8
‫جدول‬ ‫تعریف‬ ‫بر‬ ‫عالوه‬ ،‫باشد‬ ‫می‬
my_table
‫با‬
encoding
‫به‬ ‫مربوط‬
UTF8
‫نوع‬ ‫باید‬ ،
encoding
‫دستور‬ ‫در‬ ‫نیز‬ ‫را‬
LOAD DATE
:‫صورت‬ ‫به‬ .‫بنویسید‬
LOAD DATA INFILE 'data.txt' INTO TABLE my_db.my_table character set UTF8;
‫فایل‬ ‫یک‬ ‫اطالعات‬ ‫واردکردن‬ ‫مورد‬ ‫در‬ ‫عملی‬ ‫مثال‬ ‫یک‬ ‫بررسی‬ ‫به‬ ‫ادامه‬ ‫در‬
CSV
.‫پردازیم‬ ‫می‬
‫عملی‬ ‫مثال‬ ‫یک‬ ‫بررسی‬
‫نام‬ ‫به‬ ‫فایلی‬ ‫کنید‬ ‫فرض‬
ip-list.csv
:‫دارید‬ ‫زیر‬ ‫محتوای‬ ‫با‬
"1.0.0.0","1.0.0.255","16777216","16777471","AU","Australia"
"1.0.1.0","1.0.3.255","16777472","16778239","CN","China"
"1.0.4.0","1.0.7.255","16778240","16779263","AU","Australia"
"1.0.8.0","1.0.15.255","16779264","16781311","CN","China"
"1.0.16.0","1.0.31.255","16781312","16785407","JP","Japan"
"1.0.32.0","1.0.63.255","16785408","16793599","CN","China"
"1.0.64.0","1.0.127.255","16793600","16809983","JP","Japan"
"1.0.128.0","1.0.255.255","16809984","16842751","TH","Thailand"
"1.1.0.0","1.1.0.255","16842752","16843007","CN","China"
"1.1.1.0","1.1.1.255","16843008","16843263","AU","Australia"
"1.1.2.0","1.1.63.255","16843264","16859135","CN","China"
"1.1.64.0","1.1.127.255","16859136","16875519","JP","Japan"
‫داده‬ ‫پایگاه‬ ‫به‬ ‫اطالعات‬ ‫این‬ ‫کردن‬ ‫وارد‬ ‫برای‬ .‫دهد‬ ‫می‬ ‫نمایش‬ ‫را‬ ‫‌ها‬
‫ن‬‫آ‬ ‫با‬ ‫متناظر‬ ‫کشور‬ ‫و‬ ‫‌پی‬
‫ی‬‫آ‬ ‫تعدادی‬ ‫فایل‬ ‫این‬
MySQL
‫به‬ ‫توانید‬ ‫می‬ ‫داده‬ ‫مناسب‬ ‫نوع‬ ‫انتخاب‬ ‫با‬ ‫آشنایی‬ ‫برای‬ .‫بسازیم‬ ‫‌ها‬
‫ه‬‫داد‬ ‫این‬ ‫با‬ ‫مناسب‬ ‫جدولی‬ ‫باید‬ ‫ابتدا‬
‫در‬ ‫داده‬ ‫انواع‬ ‫مطلب‬
MySQL
‫نام‬ ‫به‬ ‫جدول‬ ‫یک‬ ‫زیر‬ ‫دستور‬ .‫نمایید‬ ‫مراجعه‬
geoip
:‫کند‬ ‫می‬ ‫ایجاد‬
mysql> CREATE TABLE `geoip` (
`begin_ip` varchar(15) NOT NULL,
`end_ip` varchar(15) NOT NULL,
`begin_num` int(11) unsigned NOT NULL,
`end_num` int(11) unsigned NOT NULL,
`country` char(2) NOT NULL,
`name` varchar(50) NOT NULL
) ENGINE=MyISAM;
‫فایل‬ ‫از‬ ‫را‬ ‫اطالعات‬ ‫این‬ ‫زیر‬ ‫دستور‬
ip-list.csv
‫جدول‬ ‫به‬
geoip
‫صحیح‬ ‫آدرس‬ ‫باید‬ ‫نیاز‬ ‫صورت‬ ‫در‬ .‫‌کند‬
‫ی‬‫م‬ ‫وارد‬
.‫کنید‬ ‫درج‬ ‫آن‬ ‫نام‬ ‫کنار‬ ‫در‬ ‫نیز‬ ‫را‬ ‫فایل‬
mysql> LOAD DATA INFILE 'ip-list.csv'
INTO TABLE geoip
FIELDS TERMINATED BY "," ENCLOSED BY '"';
Query OK, 12 rows affected (0.23 sec)
Records: 12 Deleted: 0 Skipped: 0 Warnings: 0
.‫دارد‬ ‫قرار‬ " ‫دو‬ ‫داخل‬ ‫در‬ ‫نیز‬ ‫ستون‬ ‫هر‬ ‫محتوای‬ ‫و‬ ‫شده‬ ‫جدا‬ "," ‫با‬ ‫‌ها‬
‫ن‬‫ستو‬ ‫که‬ ‫ایم‬ ‫کرده‬ ‫مشخص‬ ‫باال‬ ‫دستور‬ ‫در‬
‫دیتابیس‬ ‫در‬ ‫شده‬ ‫ثبت‬ ‫دی‬ ‫آی‬ ‫آخرین‬ ‫آوردن‬ ‫بدست‬ ‫روش‬
.‫آورید‬ ‫بدست‬ ‫را‬ ‫دیتابیس‬ ‫در‬ ‫شده‬ ‫ثبت‬ ‫رکورد‬ ‫آخرین‬ ‫دی‬ ‫آی‬ ‫تا‬ ‫دارید‬ ‫نیاز‬ ‫زمانی‬
:‫کار‬ ‫این‬ ‫برای‬
mysql> SELECT LAST_INSERT_ID();
مرجع oracle mysql |mariadb
‫فصل‬
backup
‫در‬
Following are some major key features of “phpMyBackupPro“.
1. Single or Multiple database backup support with or without data, table structure.
2. Three level of compression supported are no compression, gzip or zip compression.
3. Create scheduled backups without cron jobs using small PHP script.
4. Upload backups directly onto FTP server and posting of backups by email.
5. Only Apache and PHP needed to run on platforms like Linux, Mac or Windows.
6. Shell interface to take backups manually or by using cron script.
7. Whole File directory backup and move them to any FTP server.
8. Take databases backup from different accounts on several MySQL servers.
9. Two security authentication methods supported HTTP or HTML login authentication.
10.Friendly interface and very easy to install and setup.
11.Multiple language supported.
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
‫فصل‬
‫مانیتورینگ‬ ‫های‬ ‫ابزار‬
mytop
mtop -u root –prompt
Innotop (MySQL Monitoring)
مرجع oracle mysql |mariadb
‫فصل‬
‫اتصال‬ ‫برای‬ ‫ثانویه‬ ‫های‬ ‫برنامه‬
‫به‬
sqldeveloper
sqldeveloper
‫داده‬ ‫پایگاه‬ ‫به‬ ‫اتصال‬ ‫برای‬ ‫برنامه‬ ‫یک‬
oracle
‫کردن‬ ‫اضافه‬ ‫با‬ . ‫باشد‬ ‫می‬
jdbc
‫به‬ ‫مربوط‬
mysql
. ‫کرد‬ ‫استفاده‬ ‫برنامه‬ ‫این‬ ‫قابلیت‬ ‫از‬ ‫میتوان‬
مرجع oracle mysql |mariadb
: ‫نکته‬
sqldeveloper
‫هست‬ ‫اوراکل‬ ‫داده‬ ‫پایگاه‬ ‫با‬ ‫ارتباط‬ ‫و‬ ‫مدیریت‬ ‫برای‬ ‫ابزار‬ ‫یه‬
.
‫دستورات‬ ‫میشه‬ ‫که‬
sql
‫و‬
pl/sql
‫کرد‬ ‫استفاده‬ ‫رو‬
.
‫گنو‬ ‫تو‬ ‫ابزار‬ ‫این‬ ‫کردن‬ ‫اجرا‬ ‫با‬ ‫شاید‬ ‫دوستان‬ ‫از‬ ‫بعضی‬
/
‫اس‬ ‫بی‬ – ‫سوالریس‬ – ‫لینوکس‬
‫میدم‬ ‫قرار‬ ‫اینجا‬ ‫رو‬ ‫راهکار‬ ‫من‬ ‫که‬ ‫باشن‬ ‫داشته‬ ‫مشکل‬ ‫مک‬ – ‫دی‬
.
‫برنامه‬ ‫این‬ ‫اجرای‬ ‫برای‬
.
‫این‬ ‫تنظیمات‬ ‫در‬
‫میکنیم‬ ‫اضافه‬ ‫رو‬ ‫پارامتر‬
.
SetSkipJ2SDKCheck true
‫فایل‬ ‫در‬ ‫باید‬ ‫پارامتر‬ ‫این‬
sqldeveloper.conf
‫بشه‬ ‫اضافه‬
.
‫فایل‬ ‫این‬ ‫مسیر‬
:
../sqldeveloper/bin/sqldeveloper.conf
‫هست‬
.
Mysql workbench
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
‫بوسیله‬ ‫اتصال‬ ‫به‬ ‫حال‬ ‫پرداختیم‬ ‫فرمان‬ ‫خط‬ ‫تحت‬ ‫داده‬ ‫پایگاه‬ ‫با‬ ‫ارتباط‬ ‫پیرامون‬ ‫قبلی‬ ‫مباحث‬ ‫در‬
. ‫پرداخت‬ ‫خواهیم‬ ‫گرافیکی‬ ‫های‬ ‫ابزار‬
‫در‬ ‫فایل‬ ‫جستجوی‬ ‫به‬ ‫میتوان‬ ‫چطور‬ ‫حال‬ . ‫است‬ ‫آن‬ ‫از‬ ‫استفاده‬ ‫و‬ ‫برنامه‬ ‫نصب‬ ‫گام‬ ‫اولین‬
‫؟‬ ‫پرداخت‬ ‫مخازن‬
‫دستور‬ ‫بواسطه‬
apt-cache search
‫آن‬ ‫نصب‬ ‫و‬ ‫انتخاب‬ ‫و‬ ‫‌ها‬
‫ه‬‫برنام‬ ‫میان‬ ‫جستجو‬ ‫به‬ .
. ‫پرداخت‬
Sudo apt-cache search mysql |grep admin
‫دستور‬ ‫با‬ ‫گفتیم‬ ‫که‬ ‫همانطور‬
apt-cache search
‫و‬ ‫پرداخت‬ ‫‌ها‬
‫ه‬‫برنام‬ ‫جستجوی‬ ‫به‬ ‫میتوان‬
‫بادستور‬
grep
. ‫نمود‬ ‫خروجی‬ ‫فیلتر‬ ‫به‬ ‫اقدام‬
‫جدیدتر‬ ‫نسخه‬ : ‫نکته‬
mysql-workbench
. ‫دارد‬ ‫نام‬
‫بسته‬ ‫حال‬
mysql-admin
: ‫میدهیم‬ ‫انجام‬ ‫را‬ ‫زیر‬ ‫مراحل‬ ‫اینکار‬ ‫برای‬ . ‫میکنیم‬ ‫نصب‬ ‫را‬
sudo apt-get install mysql-admin
‫پورت‬ ‫بجز‬ . ‫است‬ ‫بسته‬ ‫داده‬ ‫پایگاه‬ ‫با‬ ‫ارتباط‬ ‫برای‬ ‫ها‬ ‫پورت‬ ‫تمامی‬
3306
‫تونل‬ ‫بواسطه‬ ‫ما‬ ‫حال‬
. ‫میکنیم‬ ‫وصل‬ ‫پورت‬ ‫این‬ ‫به‬ ‫را‬ ‫دیگر‬ ‫پورت‬ ‫زنی‬
: ‫اینکار‬ ‫برای‬
ssh -L 8888:localhost:3306 root@mysql-server
‫از‬ ‫که‬ ‫پورتی‬ ‫هر‬ ‫کار‬ ‫این‬ ‫با‬
8888
‫پورت‬ ‫به‬ ‫میکند‬ ‫استفاده‬
3306
. ‫‌شود‬
‫ی‬‫م‬ ‫وصل‬
‫دستورات‬ ‫از‬ ‫میتوان‬ ‫باز‬ ‫های‬ ‫پورت‬ ‫دانستن‬ ‫برای‬
netstat , iptraf
‫در‬ ‫ما‬ . ‫نمود‬ ‫استفاده‬ … ,
‫دستور‬ ‫از‬ ‫اینجا‬
netstat
. ‫میکنیم‬ ‫استفاده‬
Netstat -tapn
‫نامه‬ ‫بر‬ ‫حال‬
mysql admin
. ‫میکنیم‬ ‫اجرا‬ ‫را‬
‫قسمت‬ ‫در‬
server name
‫و‬ ‫کرده‬ ‫وارد‬ ‫را‬ ‫پورت‬ ‫شماره‬ ‫پورت‬ ‫قسمت‬ ‫در‬ ‫و‬ ‫سرور‬ ‫نام‬
. ‫مینویسیم‬ ‫را‬ ‫عبور‬ ‫رمز‬ ‫و‬ ‫کاربری‬ ‫نام‬
‫مواجه‬ ‫زیر‬ ‫خطا‬ ‫کادر‬ ‫با‬ ‫کنیم‬ ‫وارد‬ ‫اشتباه‬ ‫را‬ ‫سرور‬ ‫نام‬ ‫یا‬ ‫عبور‬ ‫رمز‬ ‫یا‬ ‫پورت‬ ‫شماره‬ ‫اگر‬
. ‫‌شویم‬
‫ی‬‫م‬
. ‫دهیم‬ ‫انجام‬ ‫نیز‬ ‫را‬ ‫پینگ‬ ‫عمل‬ ‫میتوانیم‬ ‫که‬
‫مدیریت‬ ‫قسمت‬ ‫وارد‬ ‫خطا‬ ‫بدون‬ ‫باشیم‬ ‫کرده‬ ‫وارد‬ ‫درست‬ ‫را‬ ‫ها‬ ‫ایتم‬ ‫تمام‬ ‫اگر‬
. ‫‌شویم‬
‫ی‬‫م‬
. ‫میبینیم‬ ‫را‬ ‫شده‬ ‫وصل‬ ‫کالینت‬ ‫و‬ ‫سرور‬ ‫مشخصات‬ ‫ایجا‬ ‫در‬
.‫پرداخت‬ ‫داده‬ ‫پایگاه‬ ‫سرویس‬ ‫کردن‬ ‫خاموش‬ ‫و‬ ‫روشن‬ ‫به‬ ‫میتوان‬ ‫قسمت‬ ‫این‬ ‫در‬
.‫نمود‬ ‫ویرایش‬ ‫را‬ ‫کاربران‬ ‫یا‬ ‫کرد‬ ‫کاربر‬ ‫ساختن‬ ‫به‬ ‫اقدام‬ ‫میتوان‬ ‫اینجا‬ ‫در‬
. ‫نمود‬ ‫مشاهده‬ ‫را‬ ‫اتصال‬ ) ‫های‬ ‫(ریسمان‬ ‫تردها‬ ‫میتوان‬ ‫اینجا‬ ‫در‬
. ‫پرداخت‬ ‫داده‬ ‫پایگاه‬ ‫مختلف‬ ‫‌های‬
‫ت‬‫وضعی‬ ‫مشاهده‬ ‫و‬ ‫آنالیز‬ ‫به‬ ‫میتوان‬ ‫اینجا‬ ‫در‬
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
. ‫نمود‬ ‫مشاهده‬ ‫را‬ ‫داده‬ ‫پایگاه‬ ‫به‬ ‫مربوط‬ ‫خطای‬ ‫‌های‬
‫م‬‫پیا‬ ‫‌توان‬
‫ی‬‫م‬ ‫قسمت‬ ‫این‬ ‫در‬
. ‫پرداخت‬ ‫داده‬ ‫پایگاه‬ ‫از‬ ‫گیری‬ ‫اپ‬ ‫بک‬ ‫به‬ ‫اقدام‬ ‫میتوان‬ ‫اینجا‬ ‫در‬
. ‫کرد‬ ‫ویرایش‬ ‫و‬ ‫نمود‬ ‫مشاهده‬ ‫را‬ ‫جداول‬ ‫به‬ ‫مربوط‬ ‫اطالعات‬ ‫میتوان‬ ‫اینجا‬ ‫در‬
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
‫ساختار‬ ‫و‬ ‫شما‬ ‫ایجاد‬ ‫نحوه‬
erp
‫از‬
dump
‫فایل‬
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
مرجع oracle mysql |mariadb
‫فصل‬
‫ها‬ ‫نکته‬
mysql_error_1045
systemctl stop mysql
mkdir -p /var/run/mysqld
chown mysql:mysql /var/run/mysqld
sudo mysqld --skip-grant-tables
mysql -u root or mycli -u root
use mysql ;
SELECT * from `user` ;
TRUNCATE table `user` ;
SELECT * from `user` ;
flush PRIVILEGES ;
GRANT all PRIVILEGES on *.* to 'root'@'localhost' IDENTIFIED by 'pass' with grant OPTION ;
pgrep mysqld
kill -KILL mysqld#
systemctl start mysql
mysql_tzinfo_to_sql /usr/share/zoneinfo/ |mysql -u root -p mysql
---------------------------------------------------------------------------------------
GRANT SELECT ON mysql. time_zone_name TO 'cacti'@'localhost' IDENTIFIED BY
'password';
flush privileges;
مرجع oracle mysql |mariadb
benchmark
‫بنچمارک‬ ‫برای‬ ‫مختلفی‬ ‫ابزارهای‬
mysql
. ‫اسکریپت‬ ‫نوشتن‬ ‫تا‬ ‫ای‬ ‫حرفه‬ ‫ابزارهای‬ ‫از‬ . ‫است‬ ‫موجود‬
: ‫پرداخت‬ ‫خواهیم‬ ‫نمونه‬ ‫چند‬ ‫بررسی‬ ‫به‬ ‫زیر‬ ‫در‬
#!/bin/sh
INTERVAL=5
PREFIX=$INTERVAL-sec-status
RUNFILE=/home/benchmarks/running
mysql -e 'SHOW GLOBAL VARIABLES' >> mysql-variables
while test -e $RUNFILE; do
file=$(date +%F_%I)
sleep=$(date +%s.%N | awk "{print $INTERVAL - ($1 % $INTERVAL)}")
sleep $sleep
ts="$(date +"TS %s.%N %F %T")"
loadavg="$(uptime)"
echo "$ts $loadavg" >> $PREFIX-${file}-status
mysql -e 'SHOW GLOBAL STATUS' >> $PREFIX-${file}-status &
echo "$ts $loadavg" >> $PREFIX-${file}-innodbstatus
mysql -e 'SHOW ENGINE INNODB STATUSG' >> $PREFIX-${file}-innodbstatus &
echo "$ts $loadavg" >> $PREFIX-${file}-processlist
mysql -e 'SHOW FULL PROCESSLISTG' >> $PREFIX-${file}-processlist &
echo $ts
done
echo Exiting because $RUNFILE does not exist.
---------------------------------------------------------------------
#!/bin/sh
# This script converts SHOW GLOBAL STATUS into a tabulated format, one line
# per sample in the input, with the metrics divided by the time elapsed
# between samples.
awk '
BEGIN {
printf "#ts date time load QPS";
fmt = " %.2f";
}
/^TS/ { # The timestamp lines begin with TS.
ts
= substr($2, 1, index($2, ".") - 1);
load
= NF - 2;
diff
= ts - prev_ts;
prev_ts = ts;
printf "n%s %s %s %s", ts, $3, $4, substr($load, 1, length($load)-1);
}
/Queries/ {
printf fmt, ($2-Queries)/diff;
Queries=$2
}
' "$@"
--------------------------------------------------------
./analyze 5-sec-status-2011-03-20
#ts date time load QPS
1300642150 2011-03-20 17:29:10 0.00 0.62
1300642155 2011-03-20 17:29:15 0.00 1311.60
1300642160 2011-03-20 17:29:20 0.00 1770.60
1300642165 2011-03-20 17:29:25 0.00 1756.60
1300642170 2011-03-20 17:29:30 0.00 1752.40
1300642175 2011-03-20 17:29:35 0.00 1735.00
1300642180 2011-03-20 17:29:40 0.00 1713.00
1300642185 2011-03-20 17:29:45 0.00 1788.00
1300642190 2011-03-20 17:29:50 0.00 1596.40
-------------------------------------------------------------
gnuplot> plot "QPS-per-5-seconds" using 5 w lines title "QPS"
مرجع oracle mysql |mariadb
mysqlslap
‫فرایند‬ ‫برای‬ ‫قدرتمند‬ ‫ابزاری‬
benchmark
:
مرجع oracle mysql |mariadb
‫طریق‬ ‫از‬ ‫بنچمارک‬
select
:
sysbench
‫قدرتمند‬ ‫و‬ ‫حریف‬ ‫فن‬ ‫همه‬ ‫ابزار‬ ‫یک‬
sysbench --test=fileio --file-total-size=150G prepare
sysbench --test=fileio --file-total-size=150G --file-test-mode=rndrw/
--init-rng=on --max-time=300 --max-requests=0 run
federated engine
‫حقیقت‬ ‫در‬
federate engine
‫از‬ ‫استفاده‬ ‫با‬ . ‫باشیم‬ ‫داشته‬ ‫سرور‬ ‫لینک‬ ‫یک‬ ‫میخواهیم‬ ‫ما‬ ‫که‬ ‫زمانی‬
federate engine
‫به‬ ‫اقدام‬ ‫توانیم‬ ‫می‬
. ‫کنیم‬ ‫کار‬ ‫این‬
‫سرور‬ ‫چندین‬ ‫از‬ ‫منطقی‬ ‫‌داده‬
‫ه‬‫پایگا‬ ‫یک‬ ‫ایجاد‬ ‫برای‬ ‫مجزا‬ ‫‌کیوال‬
‫س‬‫‌ا‬
‫ی‬‫ما‬ ‫سرور‬ ‫چندین‬ ‫زدن‬ ‫پیوند‬ ‫برای‬ ‫واقع‬ ‫در‬
. ‫کنیم‬ ‫استفاده‬ ‫میتوانیم‬ ‫فیزیکی‬
: ‫داریم‬ ‫قابلیت‬ ‫این‬ ‫کردم‬ ‫فعال‬ ‫برای‬
install plugin federated soname 'ha_federated.so'
or
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
federated
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
For example:
Server – A108 (Remote MySQL Server)
Server – B108 (Local MySQL Server)
We need to execute the SELECT command from Server B108 and fetching data from
Server A108.
Here, Server A108 is a remote server and Server B108 is a local server.
Now create a sample table in Server A108.
1
2
3
4
5
6
CREATE TABLE tbl_RemoteTable
(
ID integer
,Name VARCHAR(255)
)
ENGINE=InnoDB;
Now, create a FEDERATED table in Server B108 to SELECT data from Server A108.
You have to specify FEDERATED engine with remote CONNECTION information.
1
2
3
4
5
6
7
CREATE TABLE tbl_RemoteTable
(
ID integer
,Name VARCHAR(255)
)
ENGINE=FEDERATED
CONNECTION='mysql://
root:root@localhost:3306/B108/
tbl_RemoteTable';
As you can see, I created FEDERATED table into Local Server B108 using the connection
information of Remote Server A108.
You can access this table like any other table, and if any data insert or delete in remote Table, it
automatically updates here because this is a virtual table.
Below are different format of connection strings:
1
2
3
CONNECTION='mysql://username:password@hostname:port/database/tablename'
CONNECTION='mysql://username@hostname/database/tablename'
CONNECTION='mysql://username:password@hostname/database/tablename'
The remote server must be a MySQL Server.
• You can replicate the FEDERATED table to other slaves, but ensure that slave server is able to
use defined connection string.
• You can create nested FEDERATED tables.
• The FEDERATED table does not support indexes because of its virtual nature.
• The FEDERATED storage engine supports SELECT, INSERT, UPDATE, DELETE,
TRUNCATE TABLE.
• The FEDERATED also supports INSERT ON DUPLICATE KEY UPDATE statements.
• The FEDERATED table does not support Transaction.
• The FEDERATED table can also perform bulk-insertion.
• Any DROP TABLE statement issued against a FEDERATED table drops only the local table,
not the remote table.
• The FEDERATED tables do not work with the query cache.
In this post, I am showing to create the Connection Server and use that Server detail with
multiple FEDERATED Table of MySQL.
Without a Connection server, we need to write the connection string in every FEDERATED
table so when we have a multiple FEDERATED table and which are using same remote
connection information, create Connection Server once and use with all tables.
Below is a small demonstration.
First Create a Server:
1
2
3
CREATE SERVER FederatedConnectionServer
FOREIGN DATA WRAPPER mysql
OPTIONS (USER 'UserName',password
'Password', HOST 'localhost', PORT 3306,
DATABASE 'TestDB');
Now use this server information to create Remote FEDERATED Table:
1
2
3
4
5
6
7
CREATE TABLE tbl_RemoteTable
(
ID integer
,Name VARCHAR(255)
)
ENGINE=FEDERATED
CONNECTION='FederatedConnecti
onServer/tbl_RemoteTable';
‫در‬ ‫ها‬ ‫پالگین‬
mysq |mariadb
: ‫نمونه‬ ‫برای‬ . ‫کنیم‬ ‫فعال‬ ‫را‬ ‫زیادی‬ ‫های‬ ‫پالگین‬ . ‫میتوانیم‬ ‫ما‬
INSTALL PLUGIN sphinx SONAME 'ha_sphinx.so';
INSTALL PLUGIN innodb SONAME 'ha_xtradb';
replication
(
MySQL Replication
‫چیست؟‬ )
‫‌آپ‬
‫ک‬‫ب‬ ‫‌صورت‬
‫ه‬‫ب‬ ‫و‬ ‫گرفت‬ ‫کپی‬ ‫اتوماتیک‬ ‫صورت‬ ‫به‬ ‫دیتابیس‬ ‫اطالعات‬ ‫از‬ ‫‌توان‬
‫ی‬‫م‬ ‫آن‬ ‫‌کمک‬
‫ه‬‫ب‬ ‫که‬ ‫است‬ ‫فرآیندی‬
‫با‬ ‫بحث‬ ‫این‬ ‫در‬ .‫نباشد‬ ‫نیاز‬ ‫اصلی‬ ‫دیتابیس‬ ‫به‬ ‫رجوع‬ ‫تا‬ ‫‌شود‬
‫ی‬‫م‬ ‫سبب‬ ‫اطالعات‬ ‫نسخه‬ ‫این‬ ‫از‬ ‫استفاده‬ .‫کرد‬ ‫ذخیره‬
( ‫آدرس‬ ‫به‬ ‫توجه‬
IP
( .‫‌کنیم‬
‫ی‬‫م‬ ‫بررسی‬ ‫را‬ ‫فرآیند‬ ‫این‬ ‫از‬ ‫نمونه‬ ‫چند‬ ‫زیر‬ ‫)های‬
Master Slave Replication
( ‫در‬ )
MySQL
.‫است‬ ‫زیر‬ ‫شرح‬ ‫به‬ )
12.34.56.789- Master Database
12.23.34.456- Slave Database
‫تنظیمات‬
( ‫دسترسی‬ ‫از‬ ‫شروع‬ ‫از‬ ‫پیش‬
Sudo
( ‫نصب‬ ‫همچنین‬ ‫و‬ )
MySQL
( ‫اگر‬ .‫شوید‬ ‫مطمئن‬ ‫‌عامل‬
‫م‬‫سیست‬ ‫روی‬ ‫بر‬ )
MySQL
.‫کنید‬ ‫نصب‬ ‫را‬ ‫آن‬ ‫زیر‬ ‫دستور‬ ‫با‬ ،‫نیست‬ ‫نصب‬ )
sudo apt-get install mysql-server mysql-client
:‫اول‬ ‫گام‬
( ‫تنظیمات‬
Master Database
)
( ‫فایل‬ ‫تنظیمات‬
Mysql
.‫کنید‬ ‫باز‬ ‫سرور‬ ‫در‬ ‫را‬ )
sudo nano /etc/mysql/my.cnf
.‫‌کنیم‬
‫ی‬‫م‬ ‫پیدا‬ ‫را‬ ‫باشد‬ ‫زیر‬ ‫عبارت‬ ‫شامل‬ ‫که‬ ‫قسمتی‬ ‫ابتدا‬ ،‫بدهیم‬ ‫تغییر‬ ‫کمی‬ ‫باید‬ ‫را‬ ‫فایل‬ ‫این‬
bind-address = 127.0.0.1
( ‫به‬ ‫را‬ ‫آن‬ ‫آدرس‬ ‫و‬
12.34.56.789
( ‫تغییر‬ ،‫دهیم‬ ‫انجام‬ ‫‌بایست‬
‫ی‬‫م‬ ‫که‬ ‫بعدی‬ ‫تنظیمات‬ .‫‌دهیم‬
‫ی‬‫م‬ ‫تغییر‬ )
server-id
‫با‬ ‫عدد‬ ‫آن‬ ‫است‬ ‫بهتر‬ ‫اما‬ ‫دهید‬ ‫اختصاص‬ ‫آن‬ ‫به‬ ‫‌توانید‬
‫ی‬‫م‬ ‫را‬ ‫عددی‬ ‫هر‬ ‫شما‬ .‫است‬ )
1
‫اما‬ ،‫شود‬ ‫آغاز‬
( ‫هیچ‬ ‫با‬ ‫و‬ ‫باشد‬ ‫‌فرد‬
‫ه‬‫منحصرب‬ ‫‌بایست‬
‫ی‬‫م‬ ‫عدد‬ ‫آن‬ ‫که‬ ‫باشید‬ ‫داشته‬ ‫توجه‬
server-id
‫یکسان‬ ‫گروه‬ ‫در‬ ‫دیگری‬ )
‫عدد‬ ‫‌جا‬‫این‬ ‫در‬ ‫ما‬ .‫نباشد‬
۱
.‫‌دهیم‬
‫ی‬‫م‬ ‫اختصاص‬ ‫آن‬ ‫به‬ ‫را‬
Server-id = 1
( ‫فایل‬
log_bin
( .‫‌شود‬
‫ی‬‫م‬ ‫نگهداری‬ ‫کپی‬ ‫‌های‬
‫ه‬‫نسخ‬ ‫جزئیات‬ ‫آن‬ ‫در‬ ‫که‬ ‫است‬ ‫فایلی‬ )
Slave
‫آن‬ ‫روی‬ ‫که‬ ‫اطالعاتی‬ ‫تمام‬ )
( ‫حالت‬ ‫از‬ ‫را‬ ‫زیر‬ ‫خط‬ ‫تا‬ ‫‌ست‬
‫ی‬‫کاف‬ ‫گام‬ ‫این‬ ‫در‬ .‫‌کند‬
‫ی‬‫م‬ ‫کپی‬ ‫را‬ ‫هست‬
comment
‫از‬ ‫را‬ #‫(عالمت‬ ‫کنیم‬ ‫حذف‬ )
.)‫کنیم‬ ‫حذف‬ ‫خط‬ ‫ابتدای‬
log_bin = /var/log/mysql/mysql-bin.log
‫دوباره‬ ‫دستور‬ ‫این‬ ‫تکرار‬ ‫باشید‬ ‫داشته‬ ‫توجه‬ .‫کرد‬ ‫استفاده‬ ‫‌توان‬
‫ی‬‫م‬ ‫زیر‬ ‫دستور‬ ‫از‬ ‫‌ها‬
‫ل‬‫فای‬ ‫کردن‬ ‫کپی‬ ‫برای‬ ‫حال‬
.‫‌کند‬
‫ی‬‫م‬ ‫کپی‬ ‫بیشتر‬ ‫تعداد‬ ‫در‬ ‫را‬ ‫فایل‬
binlog_do_db = newdatabase
‫یک‬ ‫فقط‬ ‫است‬ ‫‌ذکر‬
‫ه‬‫ب‬ ‫الزم‬ .‫کنیم‬ ‫مشخص‬ ‫را‬ ‫‌شود‬
‫ی‬‫م‬ ‫تهیه‬ ‫کپی‬ ‫نسخه‬ ‫آن‬ ‫از‬ ‫که‬ ‫را‬ ‫سروری‬ ‫‌بایست‬
‫ی‬‫م‬ ً‫نهایتا‬
.‫کرد‬ ‫تعیین‬ ‫و‬ ‫گرفت‬ ‫نظر‬ ‫در‬ ‫را‬ ‫دیتابیس‬ ‫چند‬ ‫‌توان‬
‫ی‬‫م‬ ،‫نیست‬ ‫الزم‬ ‫دیتابیس‬
binlog_do_db = newdatabase
( ‫و‬ ‫شده‬ ‫خارج‬ ‫آن‬ ‫از‬ ،‫تنظیمات‬ ‫انجام‬ ‫از‬ ‫پس‬
Mysql
( ‫را‬ )
restart
.‫‌کنیم‬
‫ی‬‫م‬ )
sudo service mysql restart
( ‫محیط‬ ‫در‬ ‫تنظیماتی‬ ‫بعدی‬ ‫قدم‬
shell
( .‫است‬ ‫دیتابیس‬ )
MySQL Shell
.‫کنید‬ ‫باز‬ ‫را‬ )
mysql -u root -p
( ‫برای‬ ‫تا‬ ‫است‬ ‫نیاز‬
slave
.‫کنیم‬ ‫مشخص‬ ‫عبور‬ ‫رمز‬ ‫و‬ ‫نام‬ ،)
GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
( ‫یک‬ ‫در‬ ‫تا‬ ‫است‬ ‫نیاز‬ ‫فرآیند‬ ‫این‬ ‫کردن‬ ‫کامل‬ ‫برای‬
tab
.‫کنید‬ ‫وارد‬ ‫را‬ ‫زیر‬ ‫دستورات‬ ‫جدید‬ ‫پنجره‬ ‫یا‬ )
USE newdatabase;
FLUSH TABLES WITH READ LOCK;
:‫کنید‬ ‫وارد‬ ‫نیز‬ ‫را‬ ‫زیر‬ ‫دستور‬ ‫آن‬ ‫در‬
SHOW MASTER STATUS;
:‫‌شود‬
‫ی‬‫م‬ ‫داده‬ ‫نمایش‬ ‫زیر‬ ‫همانند‬ ‫جدولی‬ ‫آن‬ ‫از‬ ‫پس‬
mysql> SHOW MASTER STATUS;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000001 | 107 | newdatabase | |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
( ‫که‬ ‫است‬ ‫این‬ ‫بیانگر‬ ‫جدول‬ ‫این‬
slave
‫را‬ ‫اعداد‬ ‫این‬ ‫است‬ ‫بهتر‬ .‫‌کند‬
‫ی‬‫م‬ ‫برداری‬ ‫کپی‬ ‫به‬ ‫شروع‬ ‫دیتابیس‬ ‫کدام‬ ‫از‬ )
.‫داشت‬ ‫خواهید‬ ‫نیاز‬ ‫‌ها‬
‫ن‬‫آ‬ ‫به‬ ‫ادامه‬ ‫در‬ .‫دارید‬ ‫نگه‬ ‫خود‬ ‫پیش‬
( ‫یا‬ ‫پنجره‬ ‫در‬ ‫تغییری‬ ‫شما‬ ‫اگر‬
tab
( ‫اتوماتیک‬ ‫طور‬ ‫به‬ ‫دیتابیس‬ ،‫بدهید‬ ‫دیگری‬ )
unblock
‫‌همین‬
‫ه‬‫ب‬ .‫‌شود‬
‫ی‬‫م‬ )
.‫دهید‬ ‫ادامه‬ ‫را‬ ‫مراحل‬ ‫فقط‬ ‫جدید‬ ‫پنجره‬ ‫کردن‬ ‫باز‬ ‫از‬ ‫بعد‬ ‫دلیل‬
( ‫محیط‬ ‫یک‬ ‫در‬ ‫را‬ ‫عمل‬ ‫این‬ ‫است‬ ‫تذکر‬ ‫به‬ ‫الزم‬ .‫کنید‬ ‫کپی‬ ‫جدید‬ ‫دیتابیس‬ ‫در‬ ‫را‬ ‫اطالعات‬ ‫و‬ ‫دیتا‬ ‫زیر‬ ‫دستور‬ ‫با‬
shell
.‫دهید‬ ‫انجام‬ ‫جداگانه‬ )
mysqldump -u root -p --opt newdatabase > newdatabase.sql
.‫برسانید‬ ‫پایان‬ ‫به‬ ‫را‬ ‫مراحل‬ ‫و‬ ‫بازگردید‬ ‫خود‬ ‫کار‬ ‫اصلی‬ ‫پنجره‬ ‫به‬ ‫اکنون‬
UNLOCK TABLES;
QUIT;
:‫دوم‬ ‫گام‬
( ‫تنظیمات‬
Slave Database
)
( ‫تنظیمات‬ ‫اول‬ ‫گام‬ ‫در‬ ‫که‬ ‌
‫ن‬‫آ‬ ‫از‬ ‫پس‬
master database
( ‫تنظیم‬ ‫به‬ ‫نوبت‬ ،‫دادیم‬ ‫انجام‬ ‫را‬ )
Slave
‫وارد‬ .‫است‬ )
( ‫سرور‬
Slave
( ‫و‬ ‫شوید‬ )
MySQL shell
.‫ببندید‬ ‫را‬ ‫آن‬ ‫سپس‬ ‫و‬ ‫کنید‬ ‫ایجاد‬ ‫جدید‬ ‫دیتابیس‬ ‫یک‬ .‫کنید‬ ‫باز‬ ‫را‬ )
CREATE DATABASE newdatabase;
EXIT;
( ‫دیتابیس‬ ‫از‬ ‫که‬ ‫را‬ ‫دیتابیسی‬
master
.‫کنید‬ ‫وارد‬ ‫آن‬ ‫در‬ ‫را‬ ‫بودید‬ ‫کرده‬ ‫خارج‬ )
mysql -u root -p newdatabase < /path/to/newdatabase.sql
( ‫به‬ ‫مربوط‬ ‫تنظیمات‬ ‫حال‬
slave
:‫‌دهیم‬
‫ی‬‫م‬ ‫انجام‬ ‫را‬ )
sudo nano /etc/mysql/my.cnf
( ‫تا‬ ‫است‬ ‫نیاز‬ ‫نیز‬ ‫جا‬ ‫این‬ ‫در‬
server-id
‫باید‬ ‫نام‬ ‫این‬ ،‫شد‬ ‫گفته‬ ‫باال‬ ‫در‬ ‫که‬ ‫‌طور‬
‫ن‬‫هما‬ .‫دهید‬ ‫تغییر‬ ‫را‬ )
.‫باشد‬ ‫‌فرد‬
‫ه‬‫منحصرب‬
server-id = 2
.‫کنید‬ ‫کامل‬ ‫را‬ ‫‌ها‬
‫ن‬‫آ‬ ‫و‬ ‫کنید‬ ‫طی‬ ‫را‬ ‫مراحل‬ ‫زیر‬ ‫شرح‬ ‫به‬ ‫سپس‬
relay-log = /var/log/mysql/mysql-relay-bin.log
log_bi = /var/log/mysql/mysql-bin.log
binlog_do_db = newdatabase
( ‫را‬ ‫مراحل‬ ‫دیتابیس‬ ‫ایجاد‬ ‫از‬ ‫پس‬
save
.‫شوید‬ ‫خارج‬ ‫آن‬ ‫از‬ ‫سپس‬ ‫و‬ ‫کرده‬ )
‫دوباره‬ (MySQL) ‫را‬ (restart) ‫کنید‬.
sudo service mysql restart
( ‫کردن‬ ‫فعال‬ ‫بعدی‬ ‫قدم‬
Replication
( ‫محیط‬ ‫در‬ )
MySQL shell
‫در‬ ‫را‬ ‫زیر‬ ‫جزئیات‬ ‫و‬ ‫کنید‬ ‫باز‬ ‫دوباره‬ ‫را‬ ‫آن‬ .‫است‬ )
:‫کنید‬ ‫وارد‬ ‫آن‬
CHANGE MASTER TO MASTER_HOST='12.34.56.789',MASTER_USER='slave_user',
MASTER_PASSWORD='password', MASTER_LOG_FILE='mysql-bin.000001',
MASTER_LOG_POS= 107;
:‫‌گردد‬
‫ی‬‫م‬ ‫زیر‬ ‫تغییرات‬ ‫ایجاد‬ ‫باعث‬ ‫دستور‬ ‫این‬
•
( ‫‌عنوان‬
‫ه‬‫ب‬ ‫را‬ ‫فعلی‬ ‫سرور‬ ‫عمل‬ ‫این‬
slave
( ‫برای‬ )
master
.‫‌دهد‬
‫ی‬‫م‬ ‫قرار‬ )
•
( ‫سنجی‬ ‫اعتبار‬
login
.‫‌شود‬
‫ی‬‫م‬ ‫انجام‬ ‫درست‬ ‫سرور‬ ‫در‬ ‫‌)ها‬
•
( ‫سرور‬ ‫به‬ ،‫آخر‬ ‫در‬
slave
‫که‬ ‫عددهایی‬ ‫همان‬ ‫(طبق‬ .‫کند‬ ‫آغاز‬ ‫را‬ ‫برداری‬ ‫کپی‬ ‫عمل‬ ‫کجا‬ ‫از‬ ‫تا‬ ‫‌کند‬
‫ی‬‫م‬ ‫اعالم‬ )
)‫کردیم‬ ‫مشخص‬ ‫‌ها‬
‫ن‬‫آ‬ ‫برای‬
( ‫سرور‬ ،‫تنظیمات‬ ‫اتمام‬ ‫از‬ ‫پس‬
slave
:‫‌کنیم‬
‫ی‬‫م‬ ‫فعال‬ ‫را‬ )
START SLAVE;
:‫‌کنیم‬
‫ی‬‫م‬ ‫استفاده‬ ‫زیر‬ ‫دستور‬ ‫از‬ ‫نیز‬ ‫آن‬ ‫جزئیات‬ ‫مشاهده‬ ‫برای‬
SHOW SLAVE STATUSG
:‫کرد‬ ‫استفاده‬ ‫‌توان‬
‫ی‬‫م‬ ‫نیز‬ ‫زیر‬ ‫دستور‬ ‫از‬ ،‫شود‬ ‫وصل‬ ‫نتوانست‬ ‫و‬ ‫آمد‬ ‫پیش‬ ‫مشکلی‬ ‫ارتباط‬ ‫برقراری‬ ‫برای‬ ‫اگر‬
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; SLAVE START;
‫سرور‬ ‫ودر‬ ‫کرده‬ ‫وارد‬ ‫مقداری‬ ‫جدول‬ ‫یک‬ ‫در‬ ‫آخر‬ ‫در‬
slave
. ‫نه‬ ‫یا‬ ‫شده‬ ‫انجام‬ ‫درستی‬ ‫به‬ ‫فرایند‬ ‫میکنیم‬ ‫بررسی‬
List of Server System Variables
alter_algorithm
• Description: The implied ALGORITHM for ALTER TABLE if no ALGORITHM clause is
specified. The deprecated variable old_alter_table is an alias for this.
• COPY corresponds to the pre-MySQL 5.1 approach of creating an intermediate table,
copying data one row at a time, and renaming and dropping tables.
• INPLACE requests that the operation be refused if it cannot be done natively inside a the
storage engine.
• DEFAULT (the default) chooses INPLACE if available, and falls back to COPY.
• NOCOPY refuses to copy a table.
• INSTANT refuses an operation that would involve any other than metadata changes.
• Commandline: --alter-algorithm=default
• Scope: Global, Session
• Dynamic: Yes
• Data Type: enumerated
• Default Value: DEFAULT
• Introduced: MariaDB 10.3.7
• Valid Values: DEFAULT, COPY, INPLACE, NOCOPY, INSTANT
autocommit
• Description: If set to 1, the default, all queries are committed immediately. The LOCK IN
SHARE MODE and FOR UPDATE clauses therefore have no effect. If set to 0, they are only
committed upon a COMMIT statement, or rolled back with a ROLLBACK statement. If
autocommit is set to 0, and then changed to 1, all open transactions are immediately committed.
• Commandline: --autocommit[=#]
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: 1
automatic_sp_privileges
• Description: When set to 1, the default, when a stored routine is created, the creator is
automatically granted permission to ALTER (which includes dropping) and to EXECUTE the
routine. If set to 0, the creator is not automatically granted these privileges.
• Commandline: --automatic-sp-privileges, --skip-automatic-sp-
privileges
• Scope: Global
• Dynamic: Yes
• Data Type: boolean
• Default Value: 1
back_log
• Description: Connections take a small amount of time to start, and this setting determines the
number of outstanding connection requests MariaDB can have, or the size of the listen queue
for incoming TCP/IP requests. Requests beyond this will be refused. Increase if you expect
short bursts of connections. Cannot be set higher than the operating system limit (see the Unix
listen() man page). If not set, set to 0, or the --autoset-back-log option is used, will be
autoset to the lower of 900 and (50 + max_connections/5) (>= MariaDB 10.1.7).
• Commandline: --back-log=#
• Scope: Global
• Dynamic: No
• Type: number
• Default Value:
• The lower of 900 and (50 + max_connections/5) (>= MariaDB 10.1.7)
• The lower of 150 or the value of max_connections (beween MariaDB 10.0.8 and
MariaDB 10.1.7)
• 50 (<= MariaDB 10.0.8)
basedir
• Description: Path to the MariaDB installation directory. Other paths are usually resolved
relative to this base directory.
• Commandline: --basedir=path or -b path
• Scope: Global
• Dynamic: No
• Type: directory name
big_tables
• Description: Old variable, which if set to 1, allows large result sets by saving all temporary sets
to disk, avoiding 'table full' errors. No longer needed, as the server now handles this
automatically. sql_big_tables is a synonym.
• Commandline: --big-tables
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: 0
bind_address
• Description: By default, the MariaDB server listens for TCP/IP connections on a network
socket bound to a single address, 0.0.0.0. You can specify an alternative when the server starts
using this option; either a host name, an IPv4 or an IPv6 address. In Debian and Ubuntu, the
default bind_address is 127.0.0.1, which binds the server to listen on localhost only. Has always
been available as a mysqld option, from MariaDB 10.3.3 also available as a system variable.
• Commandline: --bind-address=addr
• Scope: Global
• Dynamic: No
• Data Type: string
• Valid Values: Host name, IPv4, IPv6 (>= MariaDB 5.5)
• Introduced: MariaDB 10.3.3 (as a system variable)
bulk_insert_buffer_size
• Description: Size in bytes of the per-thread cache tree used to speed up bulk inserts into
MyISAM and Aria tables. A value of 0 disables the cache tree.
• Commandline: --bulk-insert-buffer-size=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 8388608
• Range - 32 bit: 0 to 4294967295
• Range - 64 bit: 0 to 18446744073709547520
character_set_client
• Description: Determines the character set for queries arriving from the client. It can be set per
session by the client, although the server can be configured to ignore client requests with the --
skip-character-set-client-handshake option. If the client does not request a
character set, or requests a character set that the server does not support, the global value will be
used. utf16, utf32 and ucs2 cannot be used as client character sets.
• Scope: Global, Session
• Dynamic: Yes
• Data Type: string
• Default Value: utf8 (>= MariaDB 5.5)
character_set_connection
• Description: Character set used for number to string conversion, as well as for literals that don't
have a character set introducer.
• Scope: Global, Session
• Dynamic: Yes
• Data Type: string
• Default Value: utf8 (>= MariaDB 5.5)
character_set_database
• Description: Character set used by the default database, and set by the server whenever the
default database is changed. If there's no default database, character_set_database contains the
same value as character_set_server. This variable is dynamic, but should not be set manually,
only by the server.
• Scope: Global, Session
• Dynamic: Yes
• Data Type: string
• Default Value: latin1
character_set_filesystem
• Description: The character set for the filesystem. Used for converting file names specified as a
string literal from character_set_client to character_set_filesystem before opening the file. By
default set to binary, so no conversion takes place. This could be useful for statements such
as LOAD_FILE() or LOAD DATA INFILE on system where multi-byte file names are use.
• Commandline: --character-set-filesystem=name
• Scope: Global, Session
• Dynamic: Yes
• Data Type: string
• Default Value: binary
character_set_results
• Description: Character set used for results and error messages returned to the client.
• Scope: Global, Session
• Dynamic: Yes
• Data Type: string
• Default Value: utf8
character_set_server
• Description: Default character set used by the server. See character_set_database for character
sets used by the default database. Defaults may be different on some systems, see for example
Differences in MariaDB in Debian.
• Commandline: --character-set-server
• Scope: Global, Session
• Dynamic: Yes
• Data Type: string
• Default Value: latin1
character_set_system
• Description: Character set used by the server to store identifiers, always set to utf8.
• Scope: Global
• Dynamic: No
• Data Type: string
• Default Value: utf8
character_sets_dir
• Description: Directory where the character sets are installed.
• Commandline: --character-sets-dir=path
• Scope: Global
• Dynamic: No
• Type: directory name
check_constraint_checks
• Description: If set to 0, will disable constraint checks, for example when loading a table that
violates some constraints that you plan to fix later.
• Commandline: --check-constraint-checks=[0|1]
• Scope: Global, Session
• Dynamic: Yes
• Type: boolean
• Default: ON
• Introduced: MariaDB 10.2.1
collation_connection
• Description: Collation used for the connection character set.
• Scope: Global, Session
• Dynamic: Yes
• Data Type: string
collation_database
• Description: Collation used for the default database. Set by the server if the default database
changes, if there is no default database the value from the collation_server variable is
used. This variable is dynamic, but should not be set manually, only by the server.
• Scope: Global, Session
• Dynamic: Yes
• Data Type: string
collation_server
• Description: Default collation used by the server. This is set to the default collation for a given
character set automatically when character_set_server is changed, but it can also be set
manually. Defaults may be different on some systems, see for example Differences in MariaDB
in Debian.
• Commandline: --collation-server=name
• Scope: Global, Session
• Dynamic: Yes
• Data Type: string
• Default Value: latin1_swedish_ci
completion_type
• Description: The transaction completion type. If set to NO_CHAIN or 0 (the default), there is
no effect on commits and rollbacks. If set to CHAIN or 1, a COMMIT statement is equivalent to
COMMIT AND CHAIN, while a ROLLBACK is equivalent to ROLLBACK AND CHAIN, so
a new transaction starts straight away with the same isolation level as transaction that's just
finished. If set to RELEASE or 2, a COMMIT statement is equivalent to COMMIT RELEASE,
while a ROLLBACK is equivalent to ROLLBACK RELEASE, so the server will disconnect
after the transaction completes. Note that the transaction completion type only applies to
explicit commits, not implicit commits.
• Commandline: --completion-type=name
• Scope: Global, Session
• Dynamic: Yes
• Data Type: enumerated (>=MariaDB/MySQL 5.5.3), numeric (<= MariaDB/MySQL
5.5.2)
• Default Value: NO_CHAIN (>=MariaDB/MySQL 5.5.3), 0 (<= MariaDB/MySQL 5.5.2)
• Valid Values: 0, 1, 2 (All versions), NO_CHAIN, CHAIN, RELEASE (>=MariaDB/MySQL
5.5.3)
concurrent_insert
• Description: If set to AUTO or 1, the default, MariaDB allows concurrent INSERTs and
SELECTs for MyISAM tables with no free blocks in the data. If set to NEVER or 0, concurrent
inserts are disabled. If set to ALWAYS or 2, concurrent inserts are permitted for all MyISAM
tables, even those with holes, in which case new rows are added at the end of a table if the table
is being used by another thread. If the --skip-new option is used when starting the server,
concurrent_insert is set to NEVER.
• Commandline: --concurrent-insert[=name]
• Scope: Global
• Dynamic: Yes
• Data Type: enumerated (>=MariaDB/MySQL 5.5.3), numeric (<= MariaDB/MySQL
5.5.2)
• Default Value: AUTO (>=MariaDB/MySQL 5.5.3), 1 (<= MariaDB/MySQL 5.5.2)
• Valid Values: 0, 1, 2 (All versions), AUTO, NEVER, ALWAYS (>=MariaDB/MySQL 5.5.3)
• Documentation: concurrent-inserts
• Notes: Changing the variable only affects new opened tables. Use FLUSH TABLES If you
want it to affect also cached tables.
connect_timeout
• Description: Time in seconds that the server waits for a connect packet before returning a 'Bad
handshake'. Increasing may help if clients regularly encounter 'Lost connection to MySQL
server at 'X', system error: error_number' type-errors
• Commandline: --connect-timeout=#
• Scope: Global
• Dynamic: Yes
• Type: numeric
• Default Value: 10
datadir
• Description: Directory where the data is stored.
• Commandline: --datadir=path or -h path
• Scope: Global
• Dynamic: No
• Type: directory name
date_format
• Description: Unused.
datetime_format
• Description: Unused.
debug
• Description: Used in debugging to write to a trace file. MariaDB needs to be configured with -
SWITH_DEBUG=1 to enable this option.
• Commandline: --debug[=debug_options]
• Scope: Global, Session
• Dynamic: Yes
• Data Type: string
• Default Value: d:t:i:o,/tmp/mysqld.trace (Unix) or d:t:i:O,mysqld.trace
(Windows)
debug_no_thread_alarm
• Description: Disable system thread alarm calls. Disabling it may be useful in debugging or
testing, never do it in production.
• Commandline: --debug-no-thead-alarm=#
• Scope: Global
• Dynamic: No
• Data Type: boolean
• Default Value: OFF
• Introduced: MariaDB
debug_sync
• Description: Used in debugging to show the interface to the Debug Sync facility. MariaDB
needs to be configured with -DENABLE_DEBUG_SYNC=1 for this variable to be available.
• Scope: Session
• Dynamic: Yes
• Data Type: string
• Default Value: OFF or ON - current signal signal name
default_regex_flags
• Description: Introduced to address remaining incompatibilities between PCRE and the old
regex library. Accepts a comma-separated list of zero or more of the following values:
Commandline: --default-regex-flags=value
• Scope: Global, Session
• Dynamic: Yes
• Default Value: empty
• Valid Values: DOTALL, DUPNAMES, EXTENDED, EXTRA, MULTILINE, UNGREEDY
• Introduced: MariaDB 10.0.11
default_storage_engine
• Description: The default storage engine. The default storage engine must be enabled at server
startup or the server won't start.
• Commandline: --default-storage-engine=name
• Scope: Global, Session
• Dynamic: Yes
• Type: enumeration
• Default Value: InnoDB (>= MariaDB 5.5), MyISAM (<MariaDB 5.3)
• Introduced: MariaDB 5.5 (previously storage_engine)
default_table_type
• Description: A synonym for default_storage_engine. Removed in MariaDB 5.5.
• Commandline: --default-table-type=name
• Scope: Global, Session
• Dynamic: Yes
• Removed: MariaDB/MySQL 5.5
default_tmp_storage_engine
• Description: Default storage engine that will be used for tables created with CREATE
TEMPORARY TABLE where no engine is specified. For internal temporary tables see
aria_used_for_temp_tables). The storage engine used must be active or the server will not start.
See default_storage_engine for the default for non-temporary tables. Defaults to NULL, in
which case the value from default_storage_engine is used.
• Commandline: --default-tmp-storage-engine=name
• Scope: Global, Session
• Dynamic: Yes
• Data Type: enumeration
• Default Value: NULL
• Introduced: MariaDB 10.1.0
default_week_format
• Description: Default mode for the WEEK() function. See that page for details on the different
modes
• Commandline: --default-week-format=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 0
• Range: 0 to 7
delay_key_write
• Description: Specifies how MyISAM tables handles CREATE TABLE
DELAY_KEY_WRITE. If set to ON, the default, any DELAY KEY WRITEs are honored. The
key buffer is then flushed only when the table closes, speeding up writes. MyISAM tables
should be automatically checked upon startup in this case, and --external locking should not be
used, as it can lead to index corruption. If set to OFF, DELAY KEY WRITEs are ignored, while
if set to ALL, all new opened tables are treated as if created with DELAY KEY WRITEs
enabled.
• Commandline: --delay-key-write[=name]
• Scope: Global
• Dynamic: Yes
• Data Type: enumeration
• Default Value: ON
• Valid Values: ON, OFF, ALL
delayed_insert_limit
• Description: After this many rows have been inserted with INSERT DELAYED, the handler
will check for and execute any waiting SELECT statements.
• Commandline: --delayed-insert-limit=#
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 100
• Range: 1 to 4294967295
delayed_insert_timeout
• Description: Time in seconds that the INSERT DELAYED handler will wait for INSERTs
before terminating.
• Commandline: --delayed-insert-timeout=#
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 300
delayed_queue_size
• Description: Number of rows, per table, that can be queued when performing INSERT
DELAYED statements. If the queue becomes full, clients attempting to perform INSERT
DELAYED's will wait until the queue has room available again.
• Commandline: --delayed-queue-size=#
• Scope: Global
• Dynamic: Yes
• Type: numeric
• Default Value: 1000
• Range: 1 to 4294967295
div_precision_increment
• Description: Number of digits to be returned after the decimal point in division operations. By
default 4, so SELECT 2/15 would return 0.1333. After setting div_precision_increment to 6,
for example, the same operation would return 0.133333.
• Commandline: --div-precision-increment=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 4
• Range: 0 to 30
encrypt_tmp_disk_tables
• Description: Encrypt tmp disk tables (created as part of query execution). See Table and
Tablespace Encryption.
• Commandline: --encrypt-tmp-disk-tables[={0|1}]
• Scope: Global
• Dynamic: Yes
• Data Type: boolean
• Default Value: OFF
• Introduced: 10.1.3
encrypt_tmp_files
• Description: Encrypt temporary files (created for filesort, binary log cache, etc). See Table and
Tablespace Encryption.
• Commandline: --encrypt-tmp-files[={0|1}]
• Scope: Global
• Dynamic: No
• Data Type: boolean
• Default Value: OFF (>= MariaDB 10.1.7), ON (<= MariaDB 10.1.6)
• Introduced: MariaDB 10.1.5
encryption_algorithm
• Description: Which encryption algorithm to use for table encryption. aes_cbc is the
recommended one. See Table and Tablespace Encryption.
• Commandline: --encryption-algorithm=value
• Scope: Global
• Dynamic: No
• Data Type: enum
• Default Value: none
• Valid Values: none, aes_ecb, aes_cbc, aes_ctr
• Introduced: MariaDB 10.1.3
• Removed: MariaDB 10.1.4
enforce_storage_engine
• Description: Force the use of a particular storage engine for new tables. Used to avoid
unwanted creation of tables using another engine. For example, setting to InnoDB will prevent
any MyISAM tables from being created. If another engine is specified in a CREATE TABLE
statement, the outcome depends on whether the NO_ENGINE_SUBSTITUTION SQL_MODE
has been set or not. If set (the default from MariaDB 10.1.7), the query will fail, while if not set,
a warning will be returned and the table created according to the engine specified by this
variable. The variable has a session scope, but is only modifiable by a user with the SUPER
privilege.
• Commandline: None
• Scope: Session
• Dynamic: Yes
• Data Type: string
• Default Value: none
• Introduced: MariaDB 10.1.4
engine_condition_pushdown
• Description: Deprecated in MariaDB 5.5 and removed and replaced by the optimizer_switch
engine_condition_pushdown={on|off} flag in MariaDB 10.0.. Specifies whether
the engine condition pushdown optimization is enabled. Since MariaDB 10.1.1, engine
condition pushdown is enabled for all engines that support it.
• Commandline: --engine-condition-pushdown
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value:
• OFF (MariaDB 5.5)
• ON (<= MariaDB 5.3)
• Deprecated: MariaDB 5.5
• Removed: MariaDB 10.0
error_count
• Description: Read-only variable denoting the number of errors from the most recent statement
in the current session that generated errors. See SHOW_ERRORS().
• Scope: Session
• Dynamic: Yes
• Data Type: numeric
event_scheduler
• Description: Status of the Event Scheduler. Can be set to ON or OFF, while DISABLED means
it cannot be set at runtime. Setting the variable will cause a load of events if they were not
loaded at startup.
• Commandline: --event-scheduler[=value]
• Scope: Global
• Dynamic: Yes
• Data Type: enumeration
• Default Value: OFF
• Valid Values: ON (or 1), OFF (or 0), DISABLED
expensive_subquery_limit
• Description: Number of rows to be examined for a query to be considered expensive, that is,
maximum number of rows a subquery may examine in order to be executed during optimization
and used for constant optimization.
• Commandline: --expensive-subquery-limit=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 100
• Range: 0 upwards
• Introduced: MariaDB 5.5.25
explicit_defaults_for_timestamp
• Description: This option causes CREATE TABLE to create all TIMESTAMP columns as
NULL with the DEFAULT NULL attribute, Without this option, TIMESTAMP columns are
NOT NULL and have implicit DEFAULT clauses. The old behavior is deprecated.
• Commandline: --explicit-defaults-for-timestamp=[={0|1}]
• Scope: Global
• Dynamic: No
• Data Type: bolean
• Default Value: OFF
• Introduced: MariaDB 10.1.8
external_user
• Description: External user name set by the plugin used to authenticate the client. NULL if
native MariaDB authentication is used.
• Scope: Session
• Dynamic: No
• Data Type: string
• Default Value: NULL
• Introduced: MariaDB 5.5
flush
• Description: Usually, MariaDB writes changes to disk after each SQL statement, and the
operating system handles synchronizing (flushing) it to disk. If set to ON, the server will
synchronize all changes to disk after each statement.
• Commandline: --flush
• Scope: Global
• Dynamic: Yes
• Data Type: boolean
• Default Value: OFF
flush_time
• Description: Interval in seconds that tables are closed to synchronize (flush) data to disk and
free up resources. If set to 0, the default, there is no automatic synchronizing tables and closing
of tables. This option should not be necessary on systems with sufficient resources.
• Commandline: --flush_time=#
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 0
foreign_key_checks
• Description: If set to 1 (the default) foreign key constraints (including ON UPDATE and ON
DELETE behavior) InnoDB tables are checked, while if set to 0, they are not checked. 0 is not
recommended for normal use, though it can be useful in situations where you know the data is
consistent, but want to reload data in a different order from that that specified by parent/child
relationships. Setting this variable to 1 does not retrospectively check for inconsistencies
introduced while set to 0.
• Commandline: None
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: 1
ft_boolean_syntax
• Description: List of operators supported by an IN BOOLEAN MODE full-text search. If you
wish to change, note that each character must be ASCII and non-alphanumeric, the full string
must be 14 characters and the first or second character must be a space. Positions 10, 13 and 14
are reserved for future extensions. Also, no duplicates are permitted except for the phrase
quoting characters in positions 11 and 12, which may be the same.
• Commandline: --ft-boolean-syntax=name
• Scope: Global
• Dynamic: Yes
• Data Type: string
• Default Value: + -><()*:""&|
ft_max_word_len
• Description: Maximum length for a word to be included in the MyISAM full-text index. If this
variable is changed, the full-text index must be rebuilt. The quickest way to do this is by issuing
a REPAIR TABLE table_name QUICK statement. See innodb_ft_max_token_size for the
InnoDB equivalent.
• Commandline: --ft-max-word-len=#
• Scope: Global
• Dynamic: No
• Data Type: numeric
• Default Value: 84
• Minimum Value: 10
ft_min_word_len
• Description: Minimum length for a word to be included in the MyISAM full-text index. If this
variable is changed, the full-text index must be rebuilt. The quickest way to do this is by issuing
a REPAIR TABLE table_name QUICK statement. See innodb_ft_min_token_size for the
InnoDB equivalent.
• Commandline: --ft-min-word-len=#
• Scope: Global
• Dynamic: No
• Data Type: numeric
• Default Value: 4
• Minimum Value: 1
ft_query_expansion_limit
• Description: For full-text searches, denotes the numer of top matches when using WITH
QUERY EXPANSION.
• Commandline: --ft-query-expansion-limit=#
• Scope: Global
• Dynamic: No
• Data Type: numeric
• Default Value: 20
• Range: 0 to 1000
ft_stopword_file
• Description: File containing a list of stopwords for use in MyISAM full-text searches. Unless
an absolute path is specified the file will be looked for in the data directory. The file is not
parsed for comments, so all words found become stopwords. By default, a built-in list of words
(built from storage/myisam/ft_static.c file) is used. Stopwords can be disabled
by setting this variable to '' (an empty string). If this variable is changed, the full-text index
must be rebuilt. The quickest way to do this is by issuing a REPAIR TABLE table_name
QUICK statement. See innodb_ft_server_stopword_table for the InnoDB equivalent.
• Commandline: --ft-stopword-file=file_name
• Scope: Global
• Dynamic: No
• Data Type: file name
• Default Value: (built-in)
general_log
• Description: If set to 0, the default unless the --general-log option is used, the general query log
is disabled, while if set to 1, the general query log is enabled. See log_output for how log files
are written. If that variable is set to NONE, no logs will be written even if general_query_log is
set to 1.
• Commandline: --general-log
• Scope: Global
• Dynamic: Yes
• Data Type: boolean
• Default Value: 0
general_log_file
• Description: Name of the general query log file. If this is not specified, the name is taken from
the log-basename setting or from your system hostname with .log as a suffix.
• Commandline: --general-log-file=file_name
• Scope: Global
• Dynamic: Yes
• Data Type: file name
• Default Value: host_name.log
group_concat_max_len
• Description: Maximum length in bytes of the returned result for a GROUP_CONCAT()
function.
• Commandline: --group-concat-max-len=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value:
• 1048576 (1M) >= MariaDB 10.2.4
• 1024 (1K) <= MariaDB 10.2.3
• Range - 32-bit: 4 to 4294967295
• Range - 64-bit: 4 to 18446744073709547520
.
have_compress
• Description: If the zlib compression library is accessible to the server, this will be set to YES,
otherwise it will be NO. The COMPRESS() and UNCOMPRESS() functions will only be
available if set to YES.
• Scope: Global
• Dynamic: No
have_crypt
• Description: If the crypt() system call is available this variable will be set to YES, otherwise it
will be set to NO. If set to NO, the ENCRYPT() function cannot be used.
• Scope: Global
• Dynamic: No
have_csv
• Description: If the server supports CSV tables, will be set to YES, otherwise will be set to NO.
Removed in MariaDB 10.0, use the Information Schema PLUGINS table or SHOW ENGINES
instead.
• Scope: Global
• Dynamic: No
• Removed: MariaDB 10.0
have_dynamic_loading
• Description: If the server supports dynamic loading of plugins, will be set to YES, otherwise
will be set to NO.
• Scope: Global
• Dynamic: No
have_geometry
• Description: If the server supports spatial data types, will be set to YES, otherwise will be set to
NO.
• Scope: Global
• Dynamic: No
have_ndbcluster
• Description: If the server supports NDBCluster (disabled in MariaDB).
• Scope: Global
• Dynamic: No
• Removed: MariaDB 10.0
have_partitioning
• Description: If the server supports partitioning, will be set to YES, unless the --skip-
partition option is used, in which case will be set to DISABLED. Will be set to NO
otherwise. Removed in MariaDB 10.0 - SHOW PLUGINS should be used instead.
• Scope: Global
• Dynamic: No
• Removed: MariaDB 10.0
have_profiling
• Description: If statement profiling is available, will be set to YES, otherwise will be set to NO.
See SHOW PROFILES() and SHOW PROFILE().
• Scope: Global
• Dynamic: No
have_query_cache
• Description: If the server supports the query cache, will be set to YES, otherwise will be set to
NO.
• Scope: Global
• Dynamic: No
have_rtree_keys
• Description: If RTREE indexes (used for spatial indexes) are available, will be set to YES,
otherwise will be set to NO.
• Scope: Global
• Dynamic: No
have_symlink
• Description: If symbolic link support is enabled, will be set to YES, otherwise will be set to NO.
Required for the INDEX DIRECTORY and DATA DIRECTORY table options (see CREATE
TABLE) and Windows symlink support. Will be set to DISABLED if the server is started with
the --skip-symbolic-links option.
• Scope: Global
• Dynamic: No
histogram_size
• Description: Number of bytes used for a histogram. If set to 0, no histograms are created by
ANALYZE.
• Commandline: --histogram-size=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 0
• Range: 0 to 255
• Introduced: MariaDB 10.0.2
histogram_type
• Description: Specifies the type of histograms created by ANALYZE.
• SINGLE_PREC_HB - single precision height-balanced.
• DOUBLE_PREC_HB - double precision height-balanced.
• Commandline: --histogram-type=value
• Scope: Global, Session
• Dynamic: Yes
• Data Type: enumeration
• Default Value: SINGLE_PREC_HB
• Valid Values: SINGLE_PREC_HB, DOUBLE_PREC_HB
• Introduced: MariaDB 10.0.2
host_cache_size
• Description: Number of host names that will be cached to avoid resolving. Setting to 0 disables
the cache. Changing the value while the server is running causes an implicit FLUSH HOSTS,
clearing the host cache and truncating the performance_schema.host_cache table. If you are
connecting from a lot of different machines you should consider increasing.
• Commandline: --host-cache-size=#.
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 128
• Range: 0 to 65536
• Introduced: MariaDB 10.0
hostname
• Description: When the server starts, this variable is set to the server host name.
• Scope: Global
• Dynamic: No
• Data Type: string
identity
• Description: A synonym for last_insert_id variable.
idle_readonly_transaction_timeout
• Description: Time in seconds that the server waits for idle read-only transactions before killing
the connection. If set to 0, the default, connections are never killed. See also
idle_transaction_timeout, idle_write_transaction_timeout and Transaction Timeouts.
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 0
• Range: 0 to 31536000
• Introduced: MariaDB 10.3.0
idle_transaction_timeout
• Description: Time in seconds that the server waits for idle transactions before killing the
connection. If set to 0, the default, connections are never killed. See also
idle_readonly_transaction_timeout, idle_write_transaction_timeout and Transaction Timeouts.
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 0
• Range: 0 to 31536000
• Introduced: MariaDB 10.3.0
idle_write_transaction_timeout
• Description: Time in seconds that the server waits for idle read-write transactions before killing
the connection. If set to 0, the default, connections are never killed. See also
idle_transaction_timeout, idle_readonly_transaction_timeout and Transaction Timeouts. Called
idle_readwrite_transaction_timeout until MariaDB 10.3.2.
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 0
• Range: 0 to 31536000
• Introduced: MariaDB 10.3.0
ignore_db_dirs
• Description: Comma-delimited list of directories in the data directory that are not considered as
database directories. Set from --ignore-db-dir at startup.
• Scope: Global
• Dynamic: No
• Data Type: string
• Introduced: MariaDB 5.5
in_transaction
• Description: Session-only and read-only variable that is set to 1 if you are in a transaction, and
0 if not.
• Commandline: No
• Scope: Session
• Dynamic: No
• Data Type: boolean
• Default Value: 0
• Introduced: MariaDB 5.3
init_connect
• Description: String containing one or more SQL statements, separated by semicolons, that will
be executed by the server for each client connecting. If there's a syntax error in the one of the
statements, the client will fail to connect. For this reason, the statements are not executed for
users with the SUPER privilege, who can then still connect and correct the error. See also
init_file.
• Commandline: --init-connect=name
• Scope: Global
• Dynamic: Yes
• Data Type: string
init_file
• Description: Name of a file containing SQL statements that will be executed by the server on
startup. Each statement should be on a new line, and end with a semicolon. See also
init_connect.
• Commandline: init-file=file_name
• Scope: Global
• Dynamic: No
• Data Type: file name
insert_id
• Description: Value to be used for the next statement inserting a new AUTO_INCREMENT
value.
• Scope: Session
• Dynamic: Yes
• Data Type: numeric
interactive_timeout
• Description: Time in seconds that the server waits for an interactive connection (one that
connects with the mysql_real_connect() CLIENT_INTERACTIVE option) to become active
before closing it. See also wait_timeout.
• Commandline: --interactive-timeout=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 28800
• Range: (Windows): 1 to 2147483
• Range: (Other): 1 to 31536000
join_buffer_size
• Description: Minimum size in bytes of the buffer used for queries that cannot use an index, and
instead perform a full table scan. Increase to get faster full joins when adding indexes is not
possible, although be aware of memory issues, since joins will always allocate the minimum
size. Best left low globally and set high in sessions that require large full joins. In 64-bit
platforms, Windows truncates values above 4GB to 4GB with a warning.
• Commandline: --join-buffer-size=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 262144 (256kB) (>=MariaDB 10.1.7), 131072 (128kB) (<=MariaDB 10.1.6)
• Range (>=MariaDB/MySQL 5.5): 128 to 18446744073709547520
• Range (<=MariaDB/MySQL 5.3, Windows): 8228 to 18446744073709547520
join_buffer_space_limit
• Description: Maximum size in bytes of the query buffer, By default 1024*128*10. See Block-
based join algorithms.
• Commandline: --join-buffer-space-limit=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 2097152
• Range: 2048 to 99999999997952
• Introduced: MariaDB 5.3
join_cache_level
• Description: Controls which of the eight block-based algorithms can be used for join
operations. See Block-based join algorithms for more information.
• 1 – flat (Block Nested Loop) BNL
• 2 – incremental BNL
• 3 – flat Block Nested Loop Hash (BNLH)
• 4 – incremental BNLH
• 5 – flat Batch Key Access (BKA)
• 6 – incremental BKA
• 7 – flat Batch Key Access Hash (BKAH)
• 8 – incremental BKAH
• Commandline: --join-cache-level=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 2
• Range: 0 to 8
• Introduced: MariaDB 5.3
keep_files_on_create
• Description: If a MyISAM table is created with no DATA DIRECTORY option, the .MYD file
is stored in the database directory. When set to 0, the default, if MariaDB finds another .MYD
file in the database directory it will overwrite it. Setting this variable to 1 means that MariaDB
will return an error instead, just as it usually does in the same situation outside of the database
directory. The same applies for .MYI files and no INDEX DIRECTORY option.
• Commandline: --keep-files-on-create=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: OFF
language
• Description: Language to use for the server error messages. Either just the language name, or
the directory where the error messages are stored. An alternative is to use lc_messages_dir and
lc_messages instead. See Setting the language for error messages.
• Commandline: --language=name, -L
• Scope: Global
• Dynamic: No
• Data Type: directory name
• Default Value: /usr/local/mysql/share/mysql/english/
large_files_support
• Description: ON if the server if was compiled with large file support or not, else OFF
• Scope: Global
• Dynamic: No
• Introduced: MySQL 3.23.28
large_page_size
• Description: Indicates the size of memory page if large page support (Linux only) is enabled.
The page size is determined from the Hugepagesize setting in /proc/meminfo. See
large_pages.
• Scope: Global
• Dynamic: No
• Data Type: numeric
• Default Value: Autosized (see description)
large_pages
• Description: Indicates whether large page support (Linux only - called huge pages) is used.
This is set with --large-pages or disabled with --skip-large-pages. Large pages
are used for the innodb buffer pool and for online DDL (of size 3* innodb_sort_buffer_size (or
6 when encryption is used)). To use large pages, the Linux sysctl variable
kernel.shmmax must be large than the llocation. Also the sysctl variable
vm.nr_hugepages multipled by large-page) must be larger than the usage. The ulimit for
locked memory must be sufficient to cover the amount used (ulimit -l and equalivent in
/etc/security/limits.conf / or in systemd LimitMEMLOCK). If these operating system controls
or insufficient free huge pages are available, the allocation of large pages will fall back to
conventional memory allocation and a warning will appear in the logs. Only allocations of the
default Hugepagesize currently occur (see /proc/meminfo).
• Commandline: --large-pages, --skip-large-pages
• Scope: Global
• Dynamic: No
• Data Type: boolean
• Default Value: OFF
last_insert_id
• Description: Contains the same value as that returned by LAST_INSERT_ID(). Note that
setting this variable doen't update the value returned by the underlying function.
• Scope: Session
• Dynamic: Yes
• Data Type: numeric
lc_messages
• Description: Locale to use for error messages. This will be converted to a language name and
along with lc_messages_dir will produce the location for the error message file. See locales for
a list of available locales and their related languages.
• Commandline: --lc-messages=name
• Scope: Global, Session
• Dynamic: Yes
• Data Type: string
• Default Value: en_us
• Introduced: MariaDB 5.5
lc_messages_dir
• Description: Directory where the error messages are located. Together with lc_messages will
produce the location for the error message file.
• Commandline: --lc-messages-dir=path
• Scope: Global
• Dynamic: No
• Data Type: directory name
• Introduced: MariaDB 5.5
lc_time_names
• Description: The locale that determines the language used for the date and time functions
DAYNAME(), MONTHNAME() and DATE_FORMAT(). Locale names are language and
region subtags, for example 'en_ZA' (English - South Africa) or 'es_US: Spanish - United
States'. The default is always 'en-US' regardless of the system's locale setting. See server locale
for a full list of supported locales.
• Commandline: --lc-time-names=name
• Scope: Global, Session
• Dynamic: Yes
• Data Type: string
• Default Value: en_US
license
• Description: Server license, for example GPL.
• Scope: Global
• Dynamic: No
• Data Type: string
local_infile
• Description: If set to 1, LOCAL is supported for LOAD DATA INFILE statements. If set to 0,
usually for security reasons, attempts to perform a LOAD DATA LOCAL will fail with an error
message.
• Commandline: --local-infile=#
• Scope: Global
• Dynamic: Yes
• Data Type: boolean
• Default Value: ON
lock_wait_timeout
• Description: Timeout in seconds for attempts to acquire metadata locks. Statements using
metadata locks include FLUSH TABLES WITH READ LOCK, LOCK TABLES, HANDLER
and DML and DDL operations on tables, stored procedures and functions, and views. The
timeout is separate for each attempt, of which there may be multiple in a single statement. 0
(from MariaDB 10.3.0) means no wait. See WAIT and NOWAIT.
• Commandline: --lock-wait-timeout=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value:
• 86400 (1 day) >= MariaDB 10.2.4
• 31536000 (1 year) <= MariaDB 10.2.3
• Range:
• 0 to 31536000 (>= MariaDB 10.3)
• 1 to 31536000 (<= MariaDB 10.2)
• Introduced: MariaDB 5.5
locked_in_memory
• Description: Indicates whether --memlock was used to lock mysqld in memory.
• Commandline: --memlock
• Scope: Global
• Dynamic: No
• Data Type: boolean
• Default Value: OFF
log
• Description: Deprecated and removed in MariaDB 10.0, use general_log instead.
• Commandline: -l [filename] or --log[=filename]
• Scope: Global
• Dynamic: Yes
• Data Type: string
• Default Value: OFF
• Deprecated: MySQL 5.1.29 and replaced by general_log
• Removed: MariaDB 10.0
log_disabled_statements
• Description: If set, the specified type of statements (slave or stored procedure statements) will
not be logged to the general log.
• Commandline: --log-disabled_statements=value
• Scope: Global, Session
• Dynamic: No
• Data Type: set
• Default Value: (empty string)
• Valid Vales: slave and/or sp
• Introduced: MariaDB 10.3.1
log_error
• Description: Specifies the name of the error log. If --console is specified later in the
configuration (Windows only) or this option isn't specified, errors will be logged to stderr. If no
name is provided, errors will still be logged to hostname.err.
• Commandline: --log-error[=name]
• Scope: Global
• Dynamic: No
• Data Type: file name
• Default Value: (empty string)
log_output
• Description: How the output for the general query log and the slow query log is stored. By
default written to file (FILE), it can also be stored in the general_log and slow_log tables in the
mysql database (TABLE), or not stored at all (NONE). More than one option can be chosen at the
same time, with NONE taking precedence if present. Logs will not be written if logging is not
enabled. See Writing logs into tables, and the slow_query_log and general_log server system
variables.
• Commandline: --log-output=name
• Scope: Global
• Dynamic: Yes
• Data Type: set
• Default Value: FILE
• Valid Values: TABLE, FILE or NONE
log_queries_not_using_indexes
• Description: Queries that don't use an index, or that perform a full index scan where the index
doesn't limit the number of rows, will be logged to the slow query log (regardless of time
taken). The slow query log needs to be enabled for this to have an effect.
• Commandline: --log-queries-not-using-indexes
• Scope: Global
• Dynamic: Yes
• Data Type: boolean
• Default Value: OFF
log_slow_admin_statements
• Description: Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to
the slow log if it is open. Before MariaDB 10.1.13, this was only available as a mysqld option,
not a server variable. See also log_slow_disabled_statements and log_slow_filter.
• Commandline: --log-slow-admin-statements
• Scope: Global
• Dynamic: Yes
• Data Type: boolean
• Default Value:
• ON (>= MariaDB 10.2.4)
• OFF (<= MariaDB 10.2.3)
• Introduced: MariaDB 10.1.13 (variable)
log_slow_disabled_statements
• Description: If set, the specified type of statements will not be logged to the slow query log.
See also log_slow_admin_statements and log_slow_filter.
• Commandline: --log-slow-disabled_statements=value
• Scope: Global, Session
• Dynamic: No
• Data Type: set
• Default Value: sp
• Valid Vales: admin, call, slave and/or sp
• Introduced: MariaDB 10.3.1
log_slow_filter
• Description: Comma-delimited string containing one or more settings for filtering what is
logged to the slow query log. If a query matches one of the types listed in the filter, and takes
longer than long_query_time, it will be logged. Sets log-slow-admin-statements to ON. See also
log_slow_disabled_statements.
• admin log administrative queries (create, optimize, drop etc...)
• filesort logs queries that use a filesort.
• filesort_on_disk logs queries that perform a a filesort on disk.
• filesort_priority_queue (from MariaDB 10.3.2)
• full_join logs queries that perform a join without indexes.
• full_scan logs queries that perform full table scans.
• query_cache log queries that are resolved by the query cache .
• query_cache_miss logs queries that are not found in the query cache.
• tmp_table logs queries that create an implicit temporary table.
• tmp_table_on_disk logs queries that create a temporary table on disk.
• Commandline: log-slow-filter=value1[,value2...]
• Scope: Global, Session
• Dynamic: Yes
• Data Type: enumeration
• Default Value:
• admin, filesort, filesort_on_disk, full_join, full_scan,
query_cache, query_cache_miss, tmp_table, tmp_table_on_disk (<=
MariaDB 10.3.0)
• admin, filesort, filesort_on_disk, filsort_priority_queue,
full_join, full_scan, query_cache, query_cache_miss, tmp_table,
tmp_table_on_disk (>= MariaDB 10.3.1)
• Valid Values: admin, filesort, filesort_on_disk, filsort_priority_queue,
full_join, full_scan, query_cache, query_cache_miss, tmp_table,
tmp_table_on_disk
log_slow_queries
• Description: Deprecated and removed in MariaDB 10.0, use slow_query_log instead.
• Commandline: --log-slow-queries[=name]
• Scope: Global
• Dynamic: Yes
• Data Type: boolean
• Default Value: OFF
• Deprecated: MySQL 5.1.29
• Removed: MariaDB 10.0/MySQL 5.6.1
log_slow_rate_limit
• Description: The slow query log will log every this many queries. The default is 1, or every
query, while setting it to 20 would log every 20 queries, or five percent. Aims to reduce I/O
usage and excessively large slow query logs. See also Slow Query Log Extended Statistics.
• Commandline: log-slow-rate-limit=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 1
• Range: 1 upwards
• Introduced: MariaDB 5.1
log_slow_verbosity
• Description: Controls information to be added to the slow query log. Options are added in a
comma-delimited string. See also Slow Query Log Extended Statistics.
• query_plan logs query execution plan information
• innodb an unused Percona XtraDB option for logging XtraDB/InnoDB statistics.
• explain prints EXPLAIN output in the slow query log. See EXPLAIN in the Slow
Query Log. (added in MariaDB 10.0.5)
• Commandline: log-slow-verbosity=value1[,value2...]
• Scope: Global, Session
• Dynamic: Yes
• Data Type: enumeration
• Default Value: (Empty)
• Valid Values: (Empty), query_plan, innodb, explain (from MariaDB 10.0.5)
• Introduced: MariaDB 5.1
log_tc_size
• Description: Size in bytes of the transaction coordinator log, defined in multiples of 4096.
Always available as a commandline option, but added as a variable in MariaDB 10.1.3
• Commandline: log-tc-size=#
• Scope: Global
• Dynamic: No
• Data Type: numeric
• Default Value: 24576
• Range: 12288 to 18446744073709551615
• Introduced: MariaDB 10.1.3 (variable)
log_warnings
• Description: If set to 1, the default, all critical warnings are logged to the error log. Slave
servers also log status information, including the binary log and relay log co-ordinates where
they start replicating from, reconnects after a disconnect and when the slave switches to a new
relay-log. If set to 0, warnings are not logged. If set to a number greater than 1, aborted
connections and access-denied errors are also logged. Specifically, the following are logged:
• log_warnings >= 1
• Events_scheduler info and warnings
• Access denied errors
• Connections that were forced to be closed or aborted
• System signals
• Wrong usage of --user
• Failed setrlimit() and mlockall()
• Changed limits
• Wrong values of lower_case_table_names and stack_size
• Wrong values for command line options
• Start log position and some master information when starting slaves
• Slave reconnects
• Killed slaves
• Error reading relay logs
• Before MariaDB 10.0.14: Statements that were unsafe to log as statement-based
(when BINLOG_FLAG_UNSAFE_STMT_PRINTED is also set)
• Disabled plugins that one tried to enable or use
• UDF files that didn't include the required init functions.
• log_warnings >= 2
• Table handler errors
• Starting from MariaDB 10.0.14: Statements that were unsafe to log as statement-
based (when BINLOG_FLAG_UNSAFE_STMT_PRINTED is also set)
• log_warnings >= 3
• All errors and warnings during MyISAM repair and auto recover.
• log_warnings >=4
• Too many connections errors.
• Commandline: -W [level] or --log-warnings[=level]
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value:
• 2 (>= MariaDB 10.2.4)
• 1 (<= MariaDB 10.2.3)
• Range: 0 to 4294967295
long_query_time
• Description: If a query takes longer than this many seconds to execute (microseconds can be
specified too), the Slow_queries status variable is incremented and, if enabled, the query is
logged to the slow query log.
• Commandline: --long-query-time=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 10.000000 >= MariaDB 10.1.13, 10 <= MariaDB 10.1.12
• Range: 0 upwards
low_priority_updates
• Description: If set to 1 (0 is the default), for storage engines that use only table-level locking
(Aria, MyISAM, MEMORY and MERGE), all INSERTs, UPDATEs, DELETEs and LOCK
TABLE WRITEs will wait until there are no more SELECTs or LOCK TABLE READs pending
on the relevant tables. Set this to 1 if reads are prioritized over writes. Previously named
sql_low_priority_updates, which is still a synonym.
• Commandline: --low-priority-updates
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: 0
lower_case_file_system
• Description: Read-only variable describing whether the file system is case-sensitive. If set to
OFF, file names are case-sensitive. If set to ON, they are not case-sensitive.
• Scope: Global
• Dynamic: No
• Data Type: boolean
• Default Value: ##
lower_case_table_names
• Description: If set to 0 (the default on Unix-based systems), table names and aliases and
database names are compared in a case-sensitive manner. If set to 1 (the default on Windows),
names are stored in lowercase and not compared in a case-sensitive manner. If set to 2 (the
default on Mac OS X), names are stored as declared, but compared in lowercase.
• Commandline: --lower-case-table-names[=#]
• Scope: Global
• Dynamic: No
• Data Type: numeric
• Default Value: 0 (Unix), 1 (Windows), 2 (Mac OS X)
• Range: 0 to 2
max_allowed_packet
• Description: Maximum size in bytes of a packet or a generated/intermediate string. The packet
message buffer is initialized with the value from net_buffer_length, but can grow up to
max_allowed_packet bytes. Set as large as the largest BLOB, in multiples of 1024. If this value
is changed, it should be changed on the client side as well. See slave_max_allowed_packet for a
specific limit for replication purposes.
• Commandline: --max-allowed-packet=#
• Scope: Global, Session
• Dynamic: Yes (Global), No (Session)
• Data Type: numeric
• Default Value:
• 16777216 (16M) >= MariaDB 10.2.4
• 4194304 (4M) >= MariaDB 10.1.7
• 1048576 (1MB) <= MariaDB 10.1.6
• 1073741824 (1GB) (client-side)
• Range: 1024 to 1073741824
max_connect_errors
• Description: Limit to the number of successive failed connects from a host before the host is
blocked from making further connections. The count for a host is reset to zero if they
successfully connect. To unblock, flush the host cache with a FLUSH HOSTS statement or
mysqladmin flush-hosts.
• Commandline: --max-connect-errors=#
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 100 (from MariaDB 10.0), 10 (before MariaDB 10.0)
max_connections
• Description: The maximum number of simultaneous client connections. See also Handling Too
Many Connections. Note that this value affects the number of file descriptors required on the
operating system.
• Commandline: --max-connections=#
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 151
• Range: 1 to 100000
max_delayed_threads
• Description: Limits to the number of INSERT DELAYED threads. Once this limit is reached,
the insert is handled as if there was no DELAYED attribute. If set to 0, DELAYED is ignored
entirely. The session value can only be set to 0 or to the same as the global value.
• Commandline: --max-delayed-threads=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 20
• Range: 0 to 16384
max_digest_length
• Description: Maximum length considered for computing a statement digest, such as used by the
Performance Schema and query rewrite plugins. Statements that differ after this many bytes
produce the same digest, and are aggregated for statistics purposes. The variable is allocated per
session. Increasing will allow longer statements to be distinguished from each other, but
increase memory use, while decreasing will reduce memory use, but more statements may
become indistinguishable.
• Commandline: --max-digest-length=#
• Scope: Global,
• Dynamic: Yes
• Data Type: numeric
• Default Value: 1024
• Range: 0 to 1048576
• Introduced: MariaDB 10.1.5
max_error_count
• Description: Specifies the maximum number of messages stored for display by SHOW
ERRORS and SHOW WARNINGS statements.
• Commandline: --max-error-count=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 64
• Range: 0 to 65535
max_heap_table_size
• Description: Maximum size in bytes for user-created MEMORY tables. Setting the variable
while the server is active has no effect on existing tables unless they are recreated or altered.
The smaller of max_heap_table_size and tmp_table_size also limits internal in-memory tables.
When the maximum size is reached, any further attempts to insert data will receive a "table ... is
full" error. Temporary tables created with CREATE TEMPORARY will not be converted to
Aria, as occurs with internal temporary tables, but will also receive a table full error.
• Commandline: --max-heap-table-size=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 16777216
• Range : 16384 to 4294966272
max_insert_delayed_threads
• Description: Synonym for max_delayed_threads.
max_join_size
• Description: Statements will not be performed if they are likely to need to examine more than
this number of rows, row combinations or do more disk seeks. Can prevent poorly-formatted
queries from taking server resources. Changing this value to anything other the default will reset
sql_big_selects to 0. If sql_big_selects is set again, max_join_size will be ignored. This limit is
also ignored if the query result is sitting in the query cache. Previously named
sql_max_join_size, which is still a synonym.
• Commandline: --max-join-size=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 18446744073709551615 (>= MariaDB/MySQL 5.5.0), 4294967295 (<
MariaDB/MySQL 5.5.0)
• Range: 1 to 18446744073709551615 (>= MariaDB/MySQL 5.5.0), 1 to 4294967295 (<
MariaDB/MySQL 5.5.0)
max_length_for_sort_data
• Description: Used to decide which algorithm to choose when sorting rows. If the total size of
the column data, not including columns that are part of the sort, is less than
max_length_for_sort_data, then we add these to the sort key. This can speed up the
sort as we don't have to re-read the same row again later. Setting the value too high can slow
things down as there will be a higher disk activity for doing the sort.
• Commandline: --max-length-for-sort-data=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 1024
• Range: 4 to 8388608
max_long_data_size
• Description: Maximum size for parameter values sent with mysql_stmt_send_long_data(). If
not set, will default to the value of max_allowed_packet. Deprecated; use max_allowed_packet
instead.
• Commandline: --max-long-data-size=#
• Scope: Global
• Dynamic: No
• Data Type: numeric
• Default Value:
• 16777216 (16M) >= MariaDB 10.2.4
• 4194304 (4M) <= MariaDB 10.2.3, >= MariaDB 10.1.7
• 1048576 (1M) <= MariaDB 10.1.6
• Range: 1024 to 4294967295
• Introduced: MariaDB 5.5
• Deprecated: MariaDB 5.5
max_prepared_stmt_count
• Description: Maximum number of prepared statements on the server. Can help prevent certain
forms of denial-of-service attacks. If set to 0, no prepared statements are permitted on the
server.
• Commandline: --max-prepared-stmt-count=#
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 16382
• Range: 0 to 4294967295 (>= MariaDB 10.3.6), 0 to 1048576 (<= MariaDB 10.3.5)
max_recursive_iterations
• Description: Maximum number of iterations when executing recursive queries.
• Commandline: --max-recursive-iterations=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 4294967295
• Range: 0 to 4294967295
• Introduced: MariaDB 10.2.2
max_seeks_for_key
• Description: The optimizer assumes that the number specified here is the most key seeks
required when searching with an index, regardless of the actual index cardinality. If this value is
set lower than its default and maximum, indexes will tend to be preferred over table scans.
• Commandline: --max-seeks-for-key=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 4294967295
• Range: 1 to 4294967295
max_session_mem_used
• Description: Amount of memory a single user session is allowed to allocate. This limits the
value of the session variable MEM_USED.
• Commandline: --max-session-mem-used=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 9223372036854775807 (8.6GB)
• Range: 8192 to 18446744073709551615
• Introduced: MariaDB 10.1.21
max_sort_length
• Description: Maximum size in bytes used for sorting data values - anything exceeding this is
ignored.
• Commandline: --max-sort-length=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 1024
• Range: 4 to 8388608
max_sp_recursion_depth
• Description: Permitted number of recursive calls for a stored procedure. 0, the default, no
recursion is permitted. Increasing this value increases the thread stack requirements, so you may
need to increase thread_stack as well. This limit doesn't apply to stored functions.
• Commandline: --max-sp-recursion-depth[=#]
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 0
• Range: 0 to 255
max_statement_time
• Description: Maximum time in seconds that a query can execute before being aborted. This
includes all queries, not just SELECT statements, but excludes statements in stored procedures.
If set to 0, no limit is applied. See Aborting statements that take longer than a certain time to
execute. Useful when combined with SET STATEMENT for limiting the execution times of
individual queries.
• Commandline: --max-statement-time[=#]
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 0.000000 >= MariaDB 10.1.13, 0 <= MariaDB 10.1.12
• Range: 0 upwards
• Introduced: MariaDB 10.1.1
max_tmp_tables
• Description: Unused.
max_user_connections
• Description: Maximum simultaneous connections permitted for each user account. When set to
0, there is no per user limit. From MariaDB 5.3, setting it to -1 stops users without the SUPER
privilege from connecting to the server. The session variable is always read-only and only
privileged users can modify user limits. The session variable defaults to the global
max_user_connections variable, unless the user's specific MAX_USER_CONNECTIONS
resource option is non-zero. When both global variable and the user resource option are set, the
user's MAX_USER_CONNECTIONS is used. Note: This variable does not affect users with the
SUPER privilege.
• Commandline: --max-user-connections=#
• Scope: Global, Session
• Dynamic: Yes, (except when globally set to 0 or -1)
• Data Type: numeric
• Default Value: 0
• Range: -1 to 4294967295
max_write_lock_count
• Description: Read lock requests will be permitted for processing after this many write locks.
Applies only to storage engines that use table level locks (thr_lock), so no effect with
InnoDB/XtraDB or Archive.
• Commandline: --max-write-lock-count=#
• Scope: Global
• Dynamic: No
• Data Type: numeric
• Default Value: 4294967295
• Range: 0-4294967295
metadata_locks_cache_size
• Description: Size of the metadata locks cache, used for reducing the need to create and destroy
synchronization objects. It is particularly helpful on systems where this process is inefficient,
such as Windows XP.
• Commandline: --metadata-locks-cache-size=#
• Scope: Global
• Dynamic: No
• Data Type: numeric
• Default Value: 1024
• Range: 1 to 1048576
• Introduced: MariaDB 5.5
metadata_locks_hash_instances
• Description: Number of hashes used by the set of metadata locks. The metadata locks are
partitioned into separate hashes in order to reduce contention.
• Commandline: --metadata-locks-hash-instances=#
• Scope: Global
• Dynamic: No
• Data Type: numeric
• Default Value: 8
• Range: 1 to 1024
• Introduced: MariaDB 10.0
min_examined_row_limit
• Description: If a query examines more than this number of rows, it is logged to the slow-query-
log. If set to 0, the default, no row limit is used.
• Commandline: --min-examined-row-limit=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 0
• Range: 0-4294967295
mrr_buffer_size
• Description: Size of buffer to use when using multi-range read with range access. See Multi
Range Read optimization for more information.
• Commandline: --mrr-buffer-size=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 262144
• Range 8192 to 2147483648
• Introduced: MariaDB 5.3
multi_range_count
• Description: Deprecated in 5.1 and ignored from MariaDB 5.3. Use mrr_buffer_size instead.
• Default Value: 256
• Deprecated: MariaDB 5.1
mysql56_temporal_format
• Description: If set (the default), MariaDB uses the MySQL 5.6 low level formats for TIME,
DATETIME and TIMESTAMP instead of the MariaDB 5.3 version. The version MySQL
introduced in 5.6 requires more storage, but potentially allows negative dates and has some
advantages in replication. There should be no reason to revert to the old MariaDB 5.3
microsecond format. See also MDEV-10723.
• Commandline: --mysql56-temporal-format
• Scope: Global
• Dynamic: No
• Data Type: boolean
• Default Value: ON
• Introduced: MariaDB 10.1.2
named_pipe
• Description: On Windows systems, determines whether connections over named pipes are
permitted.
• Commandline: --enable-named-pipe
• Scope: Global
• Dynamic: No
• Data Type: boolean
• Default Value: OFF
net_buffer_length
• Description: The starting size, in bytes, for the connection and thread buffers for each client
thread. The size can grow to max_allowed_packet. This variable's session value is read-only.
Can be set to the expected length of client statements if memory is a limitation.
• Commandline: --net-buffer-length=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 16384
• Range: 1024 to 1048576
net_read_timeout
• Description: Time in seconds the server will wait for a client connection to send more data
before aborting the read. See also net_write_timeout and slave_net_timeout
• Commandline: --net-read-timeout=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 30
• Range: 1 upwards
net_retry_count
• Description: Permit this many retries before aborting when attempting to read or write on a
communication port. On FreeBSD systems should be set higher as threads are sent internal
interrupts..
• Commandline: --net-retry-count=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 10
• Range: 1 to 4294967295
net_write_timeout
• Description: Time in seconds to wait on writing a block to a connection before aborting the
write. See also net_read_timeout and slave_net_timeout.
• Commandline: --net-write-timeout=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 60
• Range: 1 upwards
old
• Description: Disabled by default, enabling it reverts index hints to those used before MySQL
5.1.17. Enabling may lead to replication errors. Being replaced by old_mode. Before MariaDB
5.5, the variable was read-only and global in scope only.
• Commandline: --old
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: OFF
old_alter_table
• Description: From MariaDB 10.3.7, an alias for alter_algorithm. Prior to that, if set to 1 (0 is
default), MariaDB reverts to the non-optimized, pre-MySQL 5.1, method of processing ALTER
TABLE statements. A temporary table is created, the data is copied over, and then the temporary
table is renamed to the original.
• Commandline: --old-alter-table
• Scope: Global, Session
• Dynamic: Yes
• Data Type: enumerated (>=MariaDB 10.3.7), boolean (<= MariaDB 10.3.6)
• Default Value: See alter_algorithm (>= MariaDB 10.3.7), 0 (<= MariaDB 10.3.6)
• Valid Values: See alter_algorithm for the full list.
• Deprecated: MariaDB 10.3.7 (superceded by alter_algorithm)
old_mode
• Description: Used for getting MariaDB to emulate behavior from an old version of MySQL or
MariaDB. See OLD Mode. Will be used to replace the old variable over time.
• Commandline: --old-mode
• Scope: Global, Session
• Dynamic: Yes
• Data Type: string
• Default Value: (empty string)
• Introduced: MariaDB 5.5.35
• Valid Values: See OLD Mode for the full list.
old_passwords
• Description: If set to 1 (0 is default), MariaDB reverts to the pre-MySQL 4.1 form of password
hashing.
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: OFF
open_files_limit
• Description: The number of file descriptors available to mysqld. Increase if you are getting the
Too many open files error. If set to 0, then mysqld will reserve max_connections*5 or
max_connections + table_open_cache*2 (whichever is larger) number of files. Note that
MariaDB cannot set this to exceed the hard limit imposed by the operating system, and you may
need to change this. For example, by adding the following lines to
/etc/security/limits.conf
mysql soft nofile 65535
mysql hard nofile 65535
rebooting, and then create /etc/systemd/system/mysqld.service.d/filelimit.conf
or /etc/systemd/system/mariadb.service.d/filelimit.conf (corresponding to the
service name).
[Service]
LimitNOFILE=infinity
• Commandline: --open-files-limit=count
• Scope: Global
• Dynamic: No
• Data Type: numeric
• Default Value: Autosized (see description)
• Range: 0 to 4294967295
optimizer_prune_level
• Description: If set to 1, the default, the optimizer will use heuristics to prune less-promising
partial plans from the optimizer search space. If set to 0, heuristics are disabled and an
exhaustive search is performed.
• Commandline: --optimizer-prune-level[=#]
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: 1
optimizer_search_depth
• Description: Maximum search depth by the query optimizer. Smaller values lead to less time
spent on execution plans, but potentially less optimal results. If set to 0, MariaDB will
automatically choose a reasonable value. Since the better results from more optimal planning
usually offset the longer time spent on planning, this is set as high as possible by default. 63 is a
valid value, but its effects (switching to the original find_best search) are deprecated.
• Commandline: --optimizer-search-depth[=#]
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 62
• Range: 0 to 63
optimizer_selectivity_sampling_limit
• Description: Controls number of record samples to check condition selectivity
• Commandline: optimizer-selectivity-sampling-limit[=#]
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 100
• Range: 10 upwards
• Introduced: MariaDB 10.0
optimizer_switch
• Description: A series of flags for controlling the query optimizer. See Optimizer Switch for
defaults, and a comparison to MySQL.
• Commandline: --optimizer-switch=value
• Scope: Global, Session
• Dynamic: Yes
• Data Type: string
• Valid Values:
• condition_pushdown_for_derived={on|off} (>=MariaDB 10.2.2)
• default - set all optimizations to their default values.
• derived_merge={on|off} (>=MariaDB 5.3) - see Derived table merge
optimization
• derived_with_keys={on|off} (>=MariaDB 5.3) - see Derived table with key
optimization
• engine_condition_pushdown={on|off} (>=MariaDB 5.5). Deprecated in
MariaDB 10.1.1 as engine condition pushdown is now automatically enabled for all
engines that support it.
• exists_to_in={on|off} (>=MariaDB 10.0) - see EXISTS-to-IN optimization
• extended_keys={on|off} (>= MariaDB 5.5) - see Extended Keys
• firstmatch={on|off} (>=MariaDB 5.3) - see First Match Strategy
• index_condition_pushdown={on|off} (>=MariaDB 5.3) - see Index
Condition Pushdown
• index_merge={on|off}
• index_merge_intersection={on|off}
• index_merge_sort_intersection={on|off} (>=MariaDB 5.3) - more
details
• index_merge_sort_union={on|off}
• index_merge_union={on|off}
• in_to_exists={on|off} (>=MariaDB 5.3) - see IN-TO-EXISTS transformation
• join_cache_bka={on|off} (>=MariaDB 5.3) - see Block-Based Join Algorithms
• join_cache_hashed={on|off} (>=MariaDB 5.3) - see Block-Based Join
Algorithms
• join_cache_incremental={on|off} (>=MariaDB 5.3) - see Block-Based Join
Algorithms
• loosescan={on|off} (>=MariaDB 5.3) - see LooseScan strategy
• materialization={on|off} (>=MariaDB 5.3) - Semi-join and non semi-join
materialization.
• mrr={on|off} (>=MariaDB 5.3) - see Multi Range Read optimization
• mrr_cost_based={on|off} (>=MariaDB 5.3) - see Multi Range Read
optimization
• mrr_sort_keys={on|off} (>=MariaDB 5.3) - see Multi Range Read optimization
• optimize_join_buffer_size={on|off} (>=MariaDB 5.3) - see Block-Based
Join Algorithms
• orderby_uses_equalities={on|off} (>= MariaDB 10.1.15, MariaDB 10.2.1)
- if not set, the optimizer ignores equality propagation. See MDEV-8989.
• outer_join_with_cache={on|off} (>=MariaDB 5.3) - see Block-Based Join
Algorithms
• partial_match_rowid_merge={on|off} (>= MariaDB 5.3) - see Non-semi-
join subquery optimizations
• partial_match_table_scan={on|off} (>= MariaDB 5.3) - see Non-semi-join
subquery optimizations
• semijoin={on|off} (>=MariaDB 5.3) - see Semi-join subquery optimizations
• semijoin_with_cache={on|off} (>=MariaDB 5.3) - see Block-Based Join
Algorithms
• subquery_cache={on|off} (>=MariaDB 5.5) - see subquery cache.
• table_elimination={on|off} (>=MariaDB 5.3) - see Table Elimination User
Interface
optimizer_use_condition_selectivity
• Description: Controls which statistics can be used by the optimizer when looking for the best
query execution plan.
• 1 Use selectivity of predicates as in MariaDB 5.5.
• 2 Use selectivity of all range predicates supported by indexes.
• 3 Use selectivity of all range predicates estimated without histogram.
• 4 Use selectivity of all range predicates estimated with histogram.
• 5 Additionally use selectivity of certain non-range predicates calculated on record
sample.
• Commandline: --optimizer-use-condition-selectivity=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 1
• Range: 1 to 5
• Introduced: MariaDB 10.0
pam_use_cleartext_plugin
• Description: Use mysql_cleartext_plugin on the client side instead of the dialog plugin. This
may be needed for compatibility reasons, but it only supports simple PAM policies that don't
require anything besides a password. See PAM Authentication Plugin.
• Commandline: <<code>>--pam-use-cleartext-plugin</code>>
• Scope: Global
• Dynamic: No
• Data Type: boolean
• Default Value: OFF
• Introduced: MariaDB 10.1.3 (default)
pid_file
• Description: Full path of the process ID file.
• Commandline: --pid-file=file_name
• Scope: Global
• Dynamic: No
• Data Type: file name
plugin_dir
• Description: Path to the plugin directory. For security reasons, either make sure this directory
can only be read by the server, or set secure_file_priv.
• Commandline: --plugin-dir=path
• Scope: Global
• Dynamic: No
• Data Type: directory name
• Default Value: BASEDIR/lib/plugin
• Introduced: MariaDB 5.5
plugin_maturity
• Description: The lowest acceptable plugin maturity. MariaDB will not load plugins less mature
than that.
• Commandline: --plugin-maturity=level
• Scope: Global
• Dynamic: No
• Type: enum
• Default Value: One less than the server maturity (>= MariaDB 10.3.3), unknown (<=
MariaDB 10.3.2)
• Valid Values: unknown, experimental, alpha, beta, gamma, stable
• Introduced: MariaDB 5.2.1
port
• Description: Port to listen for TCP/IP connections. If set to 0, will default to, in order of
preference, my.cnf, the MYSQL_TCP_PORT environment variable, /etc/services, built-in
default (3306).
• Commandline: --port=#, -P
• Scope: Global
• Dynamic: No
• Data Type: numeric
• Default Value: 3306
• Range: 0 to 65535
preload_buffer_size
• Description: Size in bytes of the buffer allocated when indexes are preloaded.
• Commandline: --preload-buffer-size=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 32768
• Range: 1024 to 1073741824
profiling
• Description: If set to 1 (0 is default), statement profiling will be enabled. See SHOW
PROFILES() and SHOW PROFILE().
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: OFF
profiling_history_size
• Description: Number of statements about which profiling information is maintained. If set to 0,
no profiles are stored. See SHOW PROFILES.
• Commandline: --profiling-history-size=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 15
• Range: 0 to 100
progress_report_time
• Description: Time in seconds between sending progress reports to the client for time-
consuming statements. If set to 0, progress reporting will be disabled.
• Commandline: --progress-report-time=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 56 before MariaDB 5.5.39 and MariaDB 10.0.10, 5 as of MariaDB 5.5.40 and
MariaDB 10.0.11
• Range: 0 to 4294967295
• Introduced: MariaDB 5.3
protocol_version
• Description: The version of the client/server protocol used by the MariaDB server.
• Commandline: None
• Scope: Global
• Dynamic: No
• Data Type: numeric
• Default Value: 10
• Range: 0 to 4294967295
proxy_protocol_networks
• Description: Enable proxy protocol for these source networks. The syntax is a comma
separated list of IPv4 and IPv6 networks. If the network doesn't contain a mask, it is considered
to be a single host. "*" represents all networks and must be the only directive on the line. String
"localhost" represents non-TCP local connections (Unix domain socket, Windows named pipe
or shared memory). See Proxy Protocol Support.
• Commandline: --proxy-protocol-networks=value
• Scope: Global
• Dynamic: Yes (>= MariaDB 10.3.6), No (<= MariaDB 10.3.5)
• Data Type: string
• Default Value: (empty)
• Introduced: MariaDB 10.3.1
proxy_user
• Description: Set to the proxy user account name if the current client is a proxy, else NULL.
• Scope: Session
• Dynamic: No
• Data Type: string
• Introduced: MariaDB 5.5.20
pseudo_slave_mode
• Description: For internal use by the server.
• Scope: Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: OFF
• Introduced: MariaDB/MySQL 5.5.30
pseudo_thread_id
• Description: For internal use only.
• Scope: Session
• Dynamic: Yes
• Data Type: numeric
query_alloc_block_size
• Description: Size in bytes of the extra blocks allocated during query parsing and execution
(after query_prealloc_size is used up).
• Commandline: --query-alloc-block-size=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 16384 (from MariaDB 10.1.2), 8192 (before MariaDB 10.1.2)
• Range: 1024 to 4294967295
query_cache_limit
• Description: Size in bytes for which results larger than this are not stored in the query cache.
• Commandline: --query-cache-limit=#
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 1048576 (1MB)
• Range: 0 to 4294967295
query_cache_min_res_unit
• Description: Minimum size in bytes of the blocks allocated for query cache results.
• Commandline: --query-cache-min-res-unit=#
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 4096 (4KB)
• Range: 0 to 4294967295
query_cache_size
• Description: Size in bytes available to the query cache. About 40KB is needed for query cache
structures, so setting a size lower than this will result in a warning. 0, the default before
MariaDB 10.1.7, effectively disables the query cache. Starting from MariaDB 10.1.7,
query_cache_type is automatically set to ON if the server is started with the query_cache_size
set to a non-zero (and non-default) value.
• Commandline: --query-cache-size=#
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 1M (>= MariaDB 10.1.7), 0 (<= MariaDB 10.1.6) (although frequently given a
default value in some setups)
• Valid Values: 0 upwards in units of 1024.
query_cache_strip_comments
• Description: If set to 1 (0 is default), the server will strip any comments from the query before
searching to see if it exists in the query cache. Multiple space, line feeds, tab and other white
space characters will also be removed.
• Commandline: query-cache-strip-comments
• Scope: Session (from MariaDB 5.5.20), Global
• Dynamic: Yes
• Data Type: boolean
• Default Value: OFF
query_cache_type
• Description: If set to 0, the query cache is disabled (although a buffer of query_cache_size
bytes is still allocated). If set to 1 all SELECT queries will be cached unless SQL_NO_CACHE
is specified. If set to 2 (or DEMAND), only queries with the SQL CACHE clause will be cached.
Note that if the server is started with the query cache disabled, it cannot be enabled at runtime.
Starting from MariaDB 10.1.7, query_cache_type is automatically set to ON if the server is
started with the query_cache_size set to a non-zero (and non-default) value.
• Commandline: --query-cache-type=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: enumeration
• Default Value: OFF (>= MariaDB 10.1.7), ON (<= MariaDB 10.1.6)
• Valid Values: 0 or OFF, 1 or ON, 2 or DEMAND
query_cache_wlock_invalidate
• Description: If set to 0, the default, results present in the query cache will be returned even if
there's a write lock on the table. If set to 1, the client will first have to wait for the lock to be
released.
• Commandline: --query-cache-wlock-invalidate
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: OFF
query_prealloc_size
• Description: Size in bytes of the persistent buffer for query parsing and execution, allocated on
connect and freed on disconnect. Increasing may be useful if complex queries are being run, as
this will reduce the need for more memory allocations during query operation. See also
query_alloc_block_size.
• Commandline: --query-prealloc-size=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 24576 (from MariaDB 10.1.2) 8192 (before MariaDB 10.1.2)
• Range: 1024 to 4294967295 (from MariaDB 10.1.2), 8192 to 4294967295 (before
MariaDB 10.1.2)
rand_seed1
• Description: rand_seed1 and rand_seed2 facilitate replication of the RAND() function.
The master passes the value of these to the slaves so that the random number generator is
seeded in the same way, and generates the same value, on the slave as on the master. Until
MariaDB 10.1.4, the variable value could not be viewed, with the SHOW VARIABLES output
always displaying zero.
• Commandline: None
• Scope: Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: Varies
• Range: 0 to 18446744073709551615
rand_seed2
• Description: See rand_seed1.
range_alloc_block_size
• Description: Size in bytes of blocks allocated during range optimization. The unit size in 1024.
• Commandline: --range-alloc-block-size=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 4096
• Range - 32 bit: 4096 to 4294967295
read_buffer_size
• Description: Each thread performing a sequential scan (for MyISAM, Aria and MERGE tables)
allocates a buffer of this size in bytes for each table scanned. Increase if you perform many
sequential scans. If not in a multiple of 4KB, will be rounded down to the nearest multiple. Also
used in ORDER BY's for caching indexes in a temporary file (not temporary table), for caching
results of nested queries, for bulk inserts into partitions, and to determine the memory block size
of MEMORY tables.
• Commandline: --read-buffer-size=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 131072
• Range: 8200 to 2147479552
read_only
• Description: When set to 1 (0 is default), no updates are permitted except from users with the
SUPER privilege or slave servers updating from a master. The read_only variable is useful
for slave servers to ensure no updates are accidentally made outside of what are performed on
the master. Inserting rows to log tables, updates to temporary tables and OPTIMIZE or
ANALYZE TABLE statements are excluded from this limitation. From MariaDB 5.5, if
read_only is set to 1, SET PASSWORD is limited only to users with the SUPER privilege.
Attempting to set this variable to 1 will fail if the current session has table locks or transactions
pending, while if other sessions hold table locks, the statement will wait until these locks are
released before completing. While the attempt to set read_only is waiting, other requests for
table locks or transactions will also wait until read_only has been set.
• Commandline: --read-only
• Scope: Global
• Dynamic: Yes
• Data Type: boolean
• Default Value: OFF
read_rnd_buffer_size
• Description: Size in bytes of the buffer used when reading rows from a MyISAM table in
sorted order after a key sort. Larger values improve ORDER BY performance, although rather
increase the size by SESSION where the need arises to avoid excessive memory use.
• Commandline: --read-rnd-buffer-size=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 262144
• Range: 8200 to 2147483647
-
-
rowid_merge_buff_size
• Description: The maximum size in bytes of the memory available to the Rowid-merge strategy.
See Non-semi-join subquery optimizations for more information.
• Commandline: --rowid-merge-buff-size=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 8388608
• Range: 0 to 2147483647
• Introduced: MariaDB 5.3.0
rpl_recovery_rank
• Description: Unused.
• Removed: MariaDB 10.1.2
safe_show_database
• Description: This variable was removed in MariaDB 5.5, and has been replaced by the more
flexible SHOW DATABASES privilege.
• Commandline: --safe-show-database (until MySQL 4.1.1)
• Scope: Global
• Dynamic: Yes
• Data Type: boolean
• Removed: MariaDB 5.5
secure_auth
• Description: Connections will be blocked unless clients use the current password format. Prior
to MySQL 4.1 passwords used an old, less secure format.. For the mysql client, the --
secure-auth option blocks connections to servers requiring the old format. The server will
also fail to start if the privilege tables are in the old, pre-MySQL 4.1 format.
• Commandline: --secure-auth
• Scope: Global
• Dynamic: Yes
• Data Type: boolean
• Default Value: ON (>= MariaDB 10.1.7), OFF (<= MariaDB 10.1.6)
secure_file_priv
• Description: LOAD DATA, SELECT ... INTO and LOAD FILE() will only work with files in
the specified path. If not set, the default, the statements will work with any files that can be
accessed.
• Commandline: --secure-file-priv=path
• Scope: Global
• Dynamic: No
• Data Type: path name
• Default Value: None
secure_timestamp
• Description: Restricts direct setting of a session timestamp. Possible levels are:
• YES - timestamp cannot deviate from the system clock
• REPLICATION - replication thread can adjust timestamp to match the master's
• SUPER - a user with this privilege and a replication thread can adjust timestamp
• NO - historical behavior, anyone can modify session timestamp
• Commandline: --secure-timestamp=value
• Scope: Global
• Dynamic: No
• Data Type: enum
• Default Value: NO
• Introduced: MariaDB 10.3.7
session_track_schema
• Description: Whether to track changes to the default schema within the current session.
• Commandline: --session-track-schema={0|1}
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: ON
• Introduced: MariaDB 10.2.2
session_track_state_change
• Description: Whether to track changes to the session state.
• Commandline: --session-track-state-change={0|1}
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: OFF
• Introduced: MariaDB 10.2.2
session_track_system_variables
• Description: Comma-separated list of session system variables for which to track changes. In
MariaDB 10.2, by default no variables are tracked. For compatibility with MySQL defaults, this
variable should be set to "autocommit, character_set_client, character_set_connection,
character_set_results, time_zone" (the default from MariaDB 10.3.1). The * character tracks all
session variables.
• Commandline: --session-track-system-variables=value
• Scope: Global, Session
• Dynamic: Yes
• Data Type: string
• Default Value: autocommit, character_set_client,
character_set_connection, character_set_results, time_zone (>=
MariaDB 10.3.1), empty string (<= MariaDB 10.3.0)
• Introduced: MariaDB 10.2.2
session_track_transaction_info
• Description: Track changes to the transaction attributes. OFF to disable; STATE to track just
transaction state (Is there an active transaction? Does it have any data? etc.);
CHARACTERISTICS to track transaction state and report all statements needed to start a
transaction with the same characteristics (isolation level, read only/read write,snapshot - but not
any work done / data modified within the transaction).
• Commandline: --session-track-transaction-info=value
• Scope: Global, Session
• Dynamic: Yes
• Data Type: enum
• Default Value: OFF
• Valid Values: OFF, STATE, CHARACTERISTICS
• Introduced: MariaDB 10.2.2
shared_memory
• Description: Windows only, determines whether the server permits shared memory
connections. See also shared_memory_base_name.
• Scope: Global
• Dynamic: No
shared_memory_base_name
• Description: Windows only, specifies the name of the shared memory to use for shared
memory connection. Mainly used when running more than one instance on the same physical
machine. By default the name is MYSQL and is case sensitive. See also shared_memory.
• Scope: Global
• Dynamic: No
• Data Type: string
• Default Value: MYSQL
skip_external_locking
• Description: If set, external locking for MyISAM tables is disabled.
• Commandline: --skip-external-locking
• Scope: Global
• Dynamic: No
• Data Type: boolean
• Default Value: 1
skip_name_resolve
• Description: If set to 1 (0 is the default), only IP addresses are used for connections. Host
names are not resolved. All host values in the GRANT tables must be IP addresses (or
localhost).
• Commandline: --skip-name-resolve
• Scope: Global
• Dynamic: No
• Data Type: boolean
• Default Value: 0
skip_networking
• Description: If set to 1, (0 is the default), the server does not listen for TCP/IP connections. All
interaction with the server by be through socket files (Unix) or named pipes or shared memory
(Windows). It's recommended to use this option if only local clients are permitted to connect to
the server. Enabling this option also prevents a server from functioning as a replication client.
• Commandline: --skip-networking
• Scope: Global
• Dynamic: No
• Data Type: boolean
• Default Value: 0
skip_show_database
• Description: If set to 1, (0 is the default), only users with the SHOW DATABASES privilege
can use the SHOW DATABASES statement to see all database names.
• Commandline: --skip-show-database
• Scope: Global
• Dynamic: No
• Data Type: boolean
• Default Value: 0
slow_launch_time
• Description: Time in seconds. If a thread takes longer than this to launch, the
slow_launch_threads server status variable is incremented.
• Commandline: --slow-launch-time=#
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 2
slow_query_log
• Description: If set to 0, the default unless the --slow-query-log option is used, the slow query
log is disabled, while if set to 1 (both global and session variables), the slow query log is
enabled. MariaDB 10.1 added support for session variables.
• Commandline: --slow-query-log
• Scope: Global, Session (MariaDB 10.1)
• Dynamic: Yes
• Data Type: boolean
• Default Value: 0
• See also: See log_output to see how log files are written. If that variable is set to NONE, no logs
will be written even if slow_query_log is set to 1.
slow_query_log_file
• Description: Name of the slow query log file.
• Commandline: --slow-query-log-file=file_name
• Scope: Global
• Dynamic: Yes
• Data Type: file name
• Default Value: host_name-slow.log
socket
• Description: On Unix-like systems, this is the name of the socket file used for local client
connections, by default /tmp/mysql.sock, often changed by the distribution, for example
/var/lib/mysql/mysql.sock. On Windows, this is the name of the named pipe used for
local client connections, by default MySQL. On Windows, this is not case-sensitive.
• Commandline: --socket=name
• Scope: Global
• Dynamic: No
• Data Type: file name
• Default Value: /tmp/mysql.sock (Unix), MySQL (Windows)
sort_buffer_size
• Description: Each session performing a sort allocates a buffer with this amount of memory. Not
specific to any storage engine. If the status variable sort_merge_passes is too high, you may
need to look at improving your query indexes, or increasing this. Consider reducing where there
are many small sorts, such as OLTP, and increasing where needed by session. 16k is a suggested
minimum.
• Commandline: --sort-buffer-size=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: number
• Default Value: 2M (2097152) (some distributions increase the default)
sql_auto_is_null
• Description: If set to 1, the query SELECT * FROM table_name WHERE
auto_increment_column IS NULL will return an auto-increment that has just been
successfully inserted, the same as the LAST_INSERT_ID() function. Some ODBC programs
make use of this IS NULL comparison.
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: 0 (>= MariaDB/MySQL 5.5.3), 1 (MariaDB/MySQL <=
5.5.2)
sql_big_selects
• Description: If set to 0, MariaDB will not perform large SELECTs. See max_join_size for
details. If max_join_size is set to anything but DEFAULT, sql_big_selects is automatically set
to 0. If sql_big_selects is again set, max_join_size will be ignored.
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: 1
sql_big_tables
• Description: A synonym for big_tables.
sql_buffer_result
• Description: If set to 1 (0 is default), results from SELECT statements are always placed into
temporary tables. This can help the server when it takes a long time to send the results to the
client by allowing the table locks to be freed early.
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: 0
sql_log_off
• Description: If set to 1 (0 is the default), no logging to the general query log is done for the
client. Only clients with the SUPER privilege can update this variable.
• Scope: Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: 0
sql_log_update
• Description: Removed. Use sql_log_bin instead.
• Removed: MariaDB/MySQL 5.5
sql_low_priority_updates
• Description: Synonym for low_priority_updates, the preferred name.
sql_max_join_size
• Description: Synonym for max_join_size, the preferred name.
• Deprecated: MariaDB 5.5
• Removed: MariaDB 10.0
sql_mode
• Description: Sets the SQL Mode. Multiple modes can be set, separated by a comma.
• Commandline: --sql-mode=value[,value[,value...]]
• Scope: Global, Session
• Dynamic: Yes
• Data Type: string
• Default Value:
• STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREA
TE_USER,NO_ENGINE_SUBSTITUTION (>= MariaDB 10.2.4)
• NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION (>= MariaDB 10.1.7)
• (empty string) (<= MariaDB 10.1.6)
• Valid Values: See SQL Mode for the full list.
sql_notes
• Description: If set to 1, the default, warning_count is incremented each time a Note warning is
encountered. If set to 0, Note warnings are not recorded. mysqldump has outputs to set this
variable to 0 so that no unnecessary increments occur when data is reloaded.
• Commandline: None
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: 1
sql_quote_show_create
• Description: If set to 1, the default, the server will quote identifiers for SHOW CREATE
DATABASE, SHOW CREATE TABLE and SHOW CREATE VIEW statements. Quoting is
disabled if set to 0. Enable to ensure replications works when identifiers require quoting.
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: 1
sql_safe_updates
• Description: If set to 1, UPDATEs and DELETEs need either a key in the WHERE clause, or a
LIMIT clause, or else they will aborted. Prevents the common mistake of accidentally deleting
or updating every row in a table.
• Dynamic: Yes
• Data Type: boolean
• Default Value: OFF (0)
sql_select_limit
• Description: Maximum number of rows that can be returned from a SELECT query. Default is
the maximum number of rows permitted per table by the server, usually 232-1 or 264-1. Can be
restored to the default value after being changed by assigning it a value of DEFAULT.
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 0
sql_warnings
• Description: If set to 1, single-row INSERTs will produce a string containing warning
information if a warning occurs.
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: OFF (0)
storage_engine
• Description: See default_storage_engine.
• Deprecated: MariaDB 5.5
standard_compliant_cte
• Description: Allow only standard-compliant common table expressions. Prior to version 10.2.4,
this variable was named standards_compliant_cte.
• Commandline: --standard-compliant-cte={0|1}
• Scope: Global, Session
• Dynamic: Yes
• Data Type: boolean
• Default Value: ON
• Introduced: MariaDB 10.2.2
stored_program_cache
• Description: Limit to the number of stored routines held in the stored procedures and stored
functions caches. Each time a stored routine is executed, this limit is first checked, and if the
number held in the cache exceeds this, that cache is flushed and memory freed.
• Commandline: --stored-program-cache=#
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 256
• Range: 256 to 524288
• Introduced: MariaDB/MySQL 5.5.21
strict_password_validation
• Description: When password validation plugins are enabled, reject passwords that cannot be
validated (passwords specified as a hash). This excludes direct updates to the privilege tables.
• Commandline: --strict-password-validation
• Scope: Global
• Dynamic: Yes
• Data Type: boolean
• Default Value: ON
• Introduced: MariaDB 10.1.2
sync_frm
• Description: If set to 1, the default, each time a non-temporary table is created, its .frm
definition file is synced to disk. Fractionally slower, but safer in case of a crash.
• Commandline: --sync-frm
• Scope: Global
• Dynamic: Yes
• Data Type: boolean
• Default Value: TRUE
system_time_zone
• Description: Server system time zone, inherited from the machine setting when the server
starts. Usually specified by the TZ environment variable, can also be specified by the --
timezone option of the mysqld_safe script, or affected by the environment of the account
starting the server. Not the same as the time_zone system variable, which is used for client time
zones.
• Scope: Global
• Dynamic: No
• Data Type: string
table_definition_cache
• Description: Number of table definitions that can be cached. Table definitions are taken from
the .frm files, and if there are a large number of tables increasing the cache size can speed up
table opening. Unlike the table_open_cache, as the table_definition_cache doesn't use file
descriptors, and is much smaller.
• Commandline: --table-definition-cache=#
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 400
• Range: 400 to 524288
table_lock_wait_timeout
• Description: Unused, and removed in MariaDB/MySQL 5.5.3
• Commandline: --table-lock-wait-timeout=#
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 50
• Range: 1 to 1073741824
• Removed: MariaDB/MySQL 5.5.3
table_open_cache
• Description: Maximum number of open tables cached in one table cache instance. See
Optimizing table_open_cache for suggestions on optimizing. Increasing table_open_cache
increases the number of file descriptors required.
• Commandline: --table-open-cache=#
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 2000 (>= MariaDB 10.1.7), 400 (<= MariaDB 10.1.6)
• Range: 1 to 1048576 (1024K) (>= MariaDB 10.1.20, MariaDB 10.0.35), 1 to 524288
(512K) (<= MariaDB 10.1.19, MariaDB 10.0.34)
table_open_cache_instances
• Description: From MariaDB 10.2.2, specifies the maximum number of table cache instances.
This is different to the MySQL version which specifies the number of table cache instances. The
MariaDB implementation is more efficient, and always starts with 1 instance, increasing the
number up to the maximum when there's contention. Whenever an instance is activated a note is
written to error log, for example Detected table cache mutex contention at instance 1: 25%
waits. Additional table cache instance activated. Number of instances after activation: 2. The
number of instances does not decrease again. The current default value (8) is expected to handle
up to 100 CPU cores - beyond this, the setting should be increased. Until MariaDB 10.0.7, this
was an unused MySQL 5.6 compatibility option, as MariaDB achieved similar results in a
different way (see MDEV-4702).
• Scope: Global
• Dynamic: No
• Data Type: numeric
• Default Value: 8 (>= MariaDB 10.2.2), 1 (<= MariaDB 10.0.6)
• Range: 1 to 64
• Introduced: MariaDB 10.2.2 (previously in MariaDB 10.0.4)
• Removed: MariaDB 10.0.7, reintroduced MariaDB 10.2.2
table_type
• Description: Removed and replaced by storage_engine in MariaDB/MySQL 5.5.3. Use
default_storage_engine instead.
tcp_keepalive_interval
• Description: The interval, in seconds, between when successive keep-alive packets are sent if
no acknowledgement is received. If set to 0, the system dependent default is used.
• Commandline: --tcp-keepalive-interval=#
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 0
• Range: 0 to 2147483
• Introduced: MariaDB 10.3.3
tcp_keepalive_probes
• Description: The number of unacknowledged probes to send before considering the connection
dead and notifying the application layer. If set to 0, a system dependent default is used.
• Commandline: --tcp-keepalive-probes=#
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 0
• Range: 0 to 2147483
• Introduced: MariaDB 10.3.3
tcp_keepalive_time
• Description: Timeout, in milliseconds, with no activity until the first TCP keep-alive packet is
sent. If set to 0, a system dependent default is used.
• Commandline: --tcp-keepalive-time=#
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 0
• Range: 0 to 2147483
• Introduced: MariaDB 10.3.3
thread_cache_size
• Description: Number of threads server caches for re-use. If this limit hasn't been reached, when
a client disconnects, its threads are put into the cache, and re-used where possible. These are
freed after 5 minutes of idle time. Normally this setting has little effect, as the other aspects of
the thread implementation are more important, but increasing it can help servers with high
volumes of connections per second so that most can use a cached, rather than a new, thread. The
cache miss rate can be calculated as the server status variables threads_created/connections. If
the thread pool is active, thread_cache_size is ignored. From MariaDB 10.2.0, the
default is automatically set to the smaller of either 256, or the max_connections size.
• Commandline: --thread-cache-size=#
• Scope: Global
• Dynamic: Yes
• Data Type: numeric
• Default Value: 0 (<= MariaDB 10.1), Auto (from MariaDB 10.2.0)
• Range: 0 to 16384
thread_concurrency
• Description: Allows applications to give the system a hint about the desired number of threads.
Specific to Solaris only, invokes thr_setconcurrency(). Deprecated and has no effect in
MariaDB 5.5.
• Commandline: --thread-concurrency=#
• Scope: Global
• Dynamic: No
• Data Type: numeric
• Default Value: 10
• Range: 1 to 512
• Deprecated: MariaDB 5.5
thread_stack
• Description: Stack size for each thread. If set too small, limits recursion depth of stored
procedures and complexity of SQL statements the server can handle in memory. Also affects
limits in the crash-me test.
• Commandline: --thread-stack=#
• Scope: Global
• Dynamic: No
• Data Type: numeric
• Default Value:
• 299008 (MariaDB 10.2.5)
• 297984 (MariaDB 10.2.1)
• 296960 (MariaDB 10.2.0)
• 295936 (MariaDB 10.1)
• 294912 (<= MariaDB 10.0)
• Range: 131072 to 18446744073709551615
time_format
• Description: Unused.
time_zone
• Description: The current time zone, used to initialize the time zone for a client when it
connects. Set to SYSTEM by default, in which the client uses the system time zone value.
• Commandline: --default-time-zone=string
• Scope: Global, Session
• Dynamic: Yes
• Data Type: string
• Default Value: SYSTEM
timed_mutexes
• Description: Determines whether InnoDB mutexes are timed. OFF, the default, disables mutex
timing, while ON enables it. See also SHOW ENGINE for more on mutex statistics. Deprecated
in MariaDB 5.5.39, as has no effect anymore.
• Commandline: --timed-mutexes
• Scope: Global
• Dynamic: Yes
• Data Type: boolean
• Default Value: OFF
• Deprecated: MariaDB 5.5.39
timestamp
• Description: Sets the time for the client. This will affect the result returned by the NOW()
function, not the SYSDATE() function, unless the server is started with the --sysdate-is-now
option, in which case SYSDATE becomes an alias of NOW, and will also be affected. Also used
to get the original timestamp when restoring rows from the binary log.
• Scope: Session
• Dynamic: Yes
• Valid Values: timestamp_value (Unix epoch timestamp, not MariaDB timestamp),
DEFAULT
tmp_disk_table_size
• Description: Max size for data for an internal temporary on-disk MyISAM or Aria table. These
tables are created as part of complex queries when the result doesn't fit into the memory engine.
You can set this variable if you want to limit the size of temporary tables created in your
temporary directory tmpdir.
• Commandline: --tmp-disk-table-size=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 18446744073709551615 (max unsigned integer, no limit)
• Range: 1024 to 18446744073709551615
• Introduced: MariaDB 10.2.7
tmp_memory_table_size
• Description: An alias for tmp_table_size.
• Commandline: --tmp-memory-table-size=#
• Introduced: MariaDB 10.2.7
tmp_table_size
• Description: The largest size for temporary tables in memory (not MEMORY tables) although
if max_heap_table_size is smaller the lower limit will apply. If a table exceeds the limit,
MariaDB converts it to a MyISAM or Aria table. You can see if it's necessary to increase by
comparing the status variables Created_tmp_disk_tables and
Created_tmp_tables to see how many temporary tables out of the total created needed to
be converted to disk. Often complex GROUP BY queries are responsible for exceeding the
limit. Defaults may be different on some systems, see for example Differences in MariaDB in
Debian. From MariaDB 10.2.7, tmp_memory_table_size is an alias.
• Commandline: --tmp-table-size=#
• Scope: Global, Session
• Dynamic: Yes
• Data Type: numeric
• Default Value: 16777216 (16MB)
• Range: 1024 to 4294967295
tmpdir
• Description: Directory for storing temporary tables and files. Can specify a list (separated by
semicolons in Windows, and colons in Unix that will then be used in round-robin fashion. This
can be used for load balancing across several disks. Note that if the server is a replication slave,
and slave_load_tmpdir, which overrides tmpdir for slave replication, is not set, you should not
set tmpdir to a directory that is cleared when the machine restarts, or else replication may fail.
• Commandline: --tmpdir=path or -t path
• Scope: Global
• Dynamic: No
• Type: directory name/s
transaction_alloc_block_size
• Description: Size in bytes to increase the memory pool available to each transaction when the
available pool is not large enough. See transaction_prealloc_size.
• Commandline: --transaction-alloc-block-size=#
• Scope: Global, Session
• Dynamic: Yes
• Type: numeric
• Default Value: 8192
• Range: 1024 to 4294967295
• Block Size: 1024
transaction_prealloc_size
• Description: Initial size of a memory pool available to each transaction for various memory
allocations. If the memory pool is not large enough for an allocation, it is increased by
transaction_alloc_block_size bytes, and truncated back to transaction_prealloc_size bytes when
the transaction is completed. If set large enough to contain all statements in a transaction, extra
malloc() calls are avoided.
• Commandline: --transaction-prealloc-size=#
• Scope: Global, Session
• Dynamic: Yes
• Type: numeric
• Default Value: 4096
• Range: 1024 to 4294967295
• Block Size: 1024
tx_isolation
• Description: The transaction isolation level. See also SET TRANSACTION ISOLATION
LEVEL.
• Commandline: --transaction-isolation=name
• Scope: Global, Session
• Dynamic: Yes
• Type: enumeration
• Default Value: REPEATABLE-READ
• Valid Values: READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ,
SERIALIZABLE
tx_read_only
• Description: Default transaction access mode. If set to OFF, the default, access is read/write. If
set to ON, access is read-only. The SET TRANSACTION statement can also change the value of
this variable. See SET TRANSACTION and START TRANSACTION.
• Commandline: --transaction-read-only=#
• Scope: Global, Session
• Dynamic: Yes
• Type: boolean
• Default Value: OFF-READ
• Introduced: MariaDB 10.0
unique_checks
• Description: If set to 1, the default, secondary indexes in InnoDB tables are performed. If set to
0, storage engines can (but are not required to) assume that duplicate keys are not present in
input data. Set to 0 to speed up imports of large tables to InnoDB. The storage engine will still
issue a duplicate key error if it detects one, even if set to 0.
• Scope: Global, Session
• Dynamic: Yes
• Type: boolean
• Default Value: 1
updatable_views_with_limit
• Description: Determines whether view updates can be made with an UPDATE or DELETE
statement with a LIMIT clause if the view does not contain all primary or not null unique key
columns from the underlying table. 0 prohibits this, while 1 permits it while issuing a warning
(the default).
• Commandline: --updatable-views-with-limit=#
• Scope: Global, Session
• Dynamic: Yes
• Type: boolean
• Default Value: 1
use_stat_tables
• Description: Controls the use of engine-independent table statistics.
• never The optimizer will not use data from statistics tables.
• complementary The optimizer uses data from statistics tables if the same kind of
data is not provided by the storage engine.
• preferably Prefer the data from statistics tables, if it's not available there, use the
data from the storage engine.
• Commandline: --use-stat-tables=mode
• Scope: Global, Session
• Dynamic: Yes
• Data Type: enum
• Default Value: never
• Introduced: MariaDB 10.0.1
userstat
• Description: If set to 1, user statistics will be activated.
• Commandline: --userstat=1
• Scope: Global
• Dynamic: Yes
• Data Type: boolean
• Default Value: OFF
• Introduced: MariaDB 5.2.0
version
• Description: Server version number. It may also include a suffix with configuration or build
information. -debug indicates debugging support was enabled on the server, and -log
indicates at least one of the binary log, general log or slow query log are enabled, for example
10.0.1-MariaDB-mariadb1precise-log. From MariaDB 10.2.1, this variable can be
set at startup in order to fake the server version.
• Commandline: -V, --version[=name] (>= MariaDB 10.2.1), --version (<= MariaDB
10.2.0)
• Scope: Global
• Dynamic: No
• Type: string
version_comment
• Description: Value of the COMPILATION_COMMENT option specified by CMake when
building MariaDB, for example mariadb.org binary distribution.
• Scope: Global
• Dynamic: No
• Type: string
version_compile_machine
• Description: The machine type or architecture MariaDB was built on, for example i686.
• Scope: Global
• Dynamic: No
• Type: string
version_compile_os
• Description: Operating system that MariaDB was built on, for example debian-linux-
gnu.
• Scope: Global
• Dynamic: No
• Type: string
version_malloc_library
• Description: Version of the used malloc library.
• Commandline: No
• Scope: Global
• Dynamic: No
• Type: string
• Introduced: MariaDB 10.0.8
version_source_revision
• Description: Source control revision id for MariaDB source code, enabling one to see exactly
which version of the source was used for a build.
• Commandline: None
• Scope: Global
• Dynamic: No
• Type: string
• Introduced: MariaDB 10.3.2
wait_timeout
• Description: Time in seconds that the server waits for a connection to become active before
closing it. The session value is initialized when a thread starts up from either the global value, if
the connection is non-interactive, or from the interactive_timeout value, if the connection is
interactive.
• Commandline: --wait-timeout=#
• Scope: Global, Session
• Dynamic: Yes
• Type: numeric
• Default Value: 28800
• Range: (Windows): 1 to 2147483
• Range: (Other): 1 to 31536000
warning_count
• Description: Read-only variable indicating the number of warnings, errors and notes resulting
from the most recent statement that generated messages. See SHOW WARNINGS for more.
Note warnings will only be recorded if sql_notes is true (the default).
• Scope: Session
• Dynamic: No
• Type: numeric
List of Server Status Variables
Aborted_clients
• Description: Number of aborted client connections. This can be due to the client not calling
mysql_close() before exiting, the client sleeping without issuing a request to the server for more
seconds than specified by wait_timeout or interactive_timeout, or by the client program ending
in the midst of transferring data.
• Scope: Global
• Data Type: numeric
Aborted_connects
• Description: Number of failed server connection attempts. This can be due to a client using an
incorrect password, a client not having privileges to connect to a database, a connection packet
not containing the correct information, or if it takes more than connect_timeout seconds to get a
connect packet.
• Scope: Global
• Data Type: numeric
Access_denied_errors
• Description: Number of access denied errors.
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 5.2
Acl_column_grants
• Description: Number of column permissions granted (rows in the mysql.columns_priv table).
• Scope: Global
• Data Type: numeric
• Introduced:MariaDB 10.1.4
Acl_database_grants
• Description: Number of database permissions granted (rows in the mysql.db table).
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.1.4
Acl_function_grants
• Description: Number of function permissions granted (rows in the mysql.procs_priv table with
a routine type of FUNCTION).
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.1.4
Acl_package_body_grants
• Description:
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.3.5
Acl_package_spec_grants
• Description:
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.3.5
Acl_procedure_grants
• Description: Number of procedure permissions granted (rows in the mysql.procs_priv table
with a routine type of PROCEDURE).
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.1.4
Acl_proxy_users
• Description: Number of proxy permissions granted (rows in the mysql.proxies_priv table).
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.1.4
Acl_role_grants
• Description: Number of role permissions granted (rows in the mysql.roles_mapping table).
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.1.4
Acl_roles
• Description: Number of roles (rows in the mysql.user table where is_role='Y').
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.1.4
Acl_table_grants
• Description: Number of table permissions granted (rows in the mysql.tables_priv table).
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.1.4
Acl_users
• Description: Number of users (rows in the mysql.user table where is_role='N').
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.1.4
Busy_time
• Description: Cumulative time in seconds of activity on connections.
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 5.3
Bytes_received
• Description: Total bytes received from all clients.
• Scope: Global
• Data Type: numeric
Bytes_sent
• Description: Total bytes sent to all clients.
• Scope: Global, Session
• Data Type: numeric
Com_admin_commands
• Description: Number of admin commands executed. These include table dumps, change users,
binary log dumps, shutdowns, pings and debugs.
• Scope: Global, Session
• Data Type: numeric
Com_alter_db
• Description: Number of ALTER DATABASE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_alter_db_upgrade
• Description: Number of ALTER DATABASE ... UPGRADE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_alter_event
• Description: Number of ALTER EVENT commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_alter_function
• Description: Number of ALTER FUNCTION commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_alter_procedure
• Description: Number of ALTER PROCEDURE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_alter_sequence
• Description: Number of ALTER SEQUENCE commands executed.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.3.1
Com_alter_server
• Description: Number of ALTER SERVER commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_alter_table
• Description: Number of ALTER TABLE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_alter_tablespace
• Description: Number of ALTER TABLESPACE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_alter_user
• Description: Number of ALTER USER commands executed.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.2.0
Com_analyze
• Description: Number of ANALYZE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_assign_to_keycache
• Description: Number of assign to keycache commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_backup_table
• Description: Removed in MariaDB 5.5. In older versions, Com_backup_table contains the
number of BACKUP TABLE commands executed.
• Scope: Global, Session
• Data Type: numeric
• Removed: MariaDB 5.5
Com_begin
• Description: Number of BEGIN statements executed.
• Scope: Global, Session
• Data Type: numeric
Com_binlog
• Description: Number of BINLOG commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_call_procedure
• Description: Number of CALL procedure_name statements executed.
• Scope: Global, Session
• Data Type: numeric
Com_change_db
• Description: Number of USE database_name commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_check
• Description: Number of CHECK TABLE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_checksum
• Description: Number of CHECKSUM TABLE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_commit
• Description: Number of COMMIT commands executed. Differs from Handler_commit, which
counts internal commit statements.
• Scope: Global, Session
• Data Type: numeric
Com_compound_sql
• Description: Number of compund sql statements.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.1.1
Com_create_db
• Description: Number of CREATE DATABASE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_create_event
• Description: Number of CREATE EVENT commands executed. Differs from Executed_events
in that it is incremented when the CREATE EVENT is run, and not when the event executes.
• Scope: Global, Session
• Data Type: numeric
Com_create_function
• Description: Number of CREATE FUNCTION commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_create_index
• Description: Number of CREATE INDEX commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_create_package
• Description:
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.3.5
Com_create_package_body
• Description:
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.3.5
Com_create_procedure
• Description: Number of CREATE PROCEDURE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_create_role
• Description: Number of CREATE ROLE commands executed.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.0.5
Com_create_sequence
• Description: Number of CREATE SEQUENCE commands executed.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.3.0
Com_create_server
• Description: Number of CREATE SERVER commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_create_table
• Description: Number of CREATE TABLE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_create_temporary_table
• Description: Number of CREATE TEMPORARY TABLE commands executed.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.1.6
Com_create_trigger
• Description: Number of CREATE TRIGGER commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_create_udf
• Description: Number of CREATE UDF commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_create_user
• Description: Number of CREATE USER commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_create_view
• Description: Number of CREATE VIEW commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_dealloc_sql
• Description: Number of DEALLOCATE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_delete
• Description: Number of DELETE commands executed. Differs from Handler_delete, which
counts the number of times rows have been deleted from tables.
• Scope: Global, Session
• Data Type: numeric
Com_delete_multi
• Description: Number of multi-table DELETE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_do
• Description: Number of DO commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_drop_db
• Description: Number of DROP DATABASE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_drop_event
• Description: Number of DROP EVENT commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_drop_function
• Description: Number of DROP FUNCTION commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_drop_index
• Description: Number of DROP INDEX commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_drop_package
• Description:
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.3.5
Com_drop_package_body
• Description:
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.3.5
Com_drop_procedure
• Description: Number of DROP PROCEDURE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_drop_role
• Description: Number of DROP ROLE commands executed.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.0.5
Com_drop_sequence
• Description: Number of DROP SEQUENCE commands executed.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.3.0
Com_drop_server
• Description: Number of DROP SERVER commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_drop_table
• Description: Number of DROP TABLE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_drop_temporary_table
• Description: Number of DROP TEMPORARY TABLE commands executed.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.1.6
Com_drop_trigger
• Description: Number of DROP TRIGGER commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_drop_user
• Description: Number of DROP USER commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_drop_view
• Description: Number of DROP VIEW commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_empty_query
• Description: Number of queries to the server that do not produce SQL queries. An SQL query
simply returning no results does not increment Com_empty_query - see Empty_queries
instead. An example of an empty query sent to the server is mysql --comments -e '--
sql comment'
• Scope: Global, Session
• Data Type: numeric
Com_execute_immediate
• Description: Number of EXECUTE IMMEDIATE statements executed.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.2.3
Com_execute_sql
• Description: Number of EXECUTE statements executed.
• Scope: Global, Session
• Data Type: numeric
Com_flush
• Description: Number of FLUSH commands executed. This differs from Flush_commands,
which also counts internal server flush requests.
• Scope: Global, Session
• Data Type: numeric
Com_get_diagnostics
• Description: Number of GET DIAGNOSTICS commands executed.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.0.4 / MySQL 5.6.4
Com_grant
• Description: Number of GRANT commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_grant_role
• Description: Number of GRANT role commands executed.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.0.5
Com_ha_close
• Description: Number of HANDLER table_name CLOSE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_ha_open
• Description: Number of HANDLER table_name OPEN commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_ha_read
• Description: Number of HANDLER table_name READ commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_help
• Description: Number of HELP commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_insert
• Description: Number of INSERT commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_insert_select
• Description: Number of INSERT ... SELECT commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_install_plugin
• Description: Number of INSTALL PLUGIN commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_kill
• Description: Number of KILL commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_load
• Description: Number of LOAD commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_load_master_data
• Description:
• Scope: Global, Session
• Data Type: numeric
• Removed: MariaDB 5.5
Com_load_master_table
• Description:
• Scope: Global, Session
• Data Type: numeric
• Removed: MariaDB 5.5
Com_multi
• Description:
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.2.0
Com_lock_tables
• Description: Number of [lock-tables|LOCK TABLES]] commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_optimize
• Description: Number of OPTIMIZE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_preload_keys
• Description:
• Scope: Global, Session
• Data Type: numeric
Com_prepare_sql
• Description: Number of PREPARE statements executed.
• Scope: Global, Session
• Data Type: numeric
Com_purge
• Description: Number of PURGE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_purge_before_date
• Description: Number of PURGE BEFORE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_release_savepoint
• Description: Number of RELEASE SAVEPOINT commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_rename_table
• Description: Number of RENAME TABLE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_rename_user
• Description: Number of RENAME USER commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_repair
• Description: Number of REPAIR TABLE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_replace
• Description: Number of REPLACE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_replace_select
• Description: Number of REPLACE ... SELECT commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_reset
• Description: Number of RESET commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_resignal
• Description: Number of RESIGNAL commands executed.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Com_restore_table
• Description: Removed in MariaDB 5.5. In older versions, Com_restore_table contains the
number of RESTORE TABLE commands executed.
• Scope: Global, Session
• Data Type: numeric
• Removed: MariaDB 5.5
Com_revoke
• Description: Number of REVOKE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_revoke_all
• Description: Number of REVOKE ALL commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_revoke_grant
• Description: Number of REVOKE role commands executed.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.0.5
Com_rollback
• Description: Number of ROLLBACK commands executed. Differs from Handler_rollback,
which is the number of transaction rollback requests given to a storage engine.
• Scope: Global, Session
• Data Type: numeric
Com_rollback_to_savepoint
• Description: Number of ROLLBACK ... TO SAVEPOINT commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_savepoint
• Description: Number of SAVEPOINT commands executed. Differs from Handler_savepoint,
which is the number of transaction savepoint creation requests.
• Scope: Global, Session
• Data Type: numeric
Com_select
• Description: Number of SELECT commands executed. Since MariaDB 5.5, this also includes
queries that make use of the query cache.
• Scope: Global, Session
• Data Type: numeric
Com_set_option
• Description: Number of SET OPTION commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_signal
• Description: Number of SIGNAL statements executed.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Com_show_authors
• Description: Number of SHOW AUTHORS commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_binlog_events
• Description: Number of SHOW BINLOG EVENTS statements executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_binlogs
• Description: Number of SHOW BINARY LOGS commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_charsets
• Description: Number of SHOW CHARACTER SET commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_client_statistics
• Description: Number of SHOW CLIENT STATISTICS commands executed. Removed in
MariaDB 10.1.1 when that statement was replaced by the generic SHOW
information_schema_table.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.2
• Removed: MariaDB 10.1.1
Com_show_collations
• Description: Number of SHOW COLLATION commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_column_types
• Description:
• Scope: Global, Session
• Data Type: numeric
• Removed: MariaDB 5.5
Com_show_contributors
• Description: Number of SHOW CONTRIBUTORS commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_create_db
• Description: Number of SHOW CREATE DATABASE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_create_event
• Description: Number of SHOW CREATE EVENT commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_create_func
• Description: Number of SHOW CREATE FUNCTION commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_create_package
• Description:
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.3.5
Com_show_create_package_body
• Description:
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.3.5
Com_show_create_proc
• Description: Number of SHOW CREATE PROCEDURE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_create_table
• Description: Number of SHOW CREATE TABLE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_create_trigger
• Description: Number of SHOW CREATE TRIGGER commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_create_user
• Description: Number of SHOW CREATE USER commands executed.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.2.0
Com_show_databases
• Description: Number of SHOW DATABASES commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_engine_logs
• Description: Number of SHOW ENGINE LOGS commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_engine_mutex
• Description: Number of SHOW ENGINE MUTEX commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_engine_status
• Description: Number of SHOW ENGINE STATUS commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_events
• Description: Number of SHOW EVENTS commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_errors
• Description: Number of SHOW ERRORS commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_explain
• Description: Number of SHOW EXPLAIN commands executed.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.0.0
Com_show_fields
• Description: Number of SHOW COLUMNS or SHOW FIELDS commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_function_status
• Description: Number of SHOW FUNCTION STATUS commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_generic
• Description: Number of generic SHOW commands executed, such as SHOW
INDEX_STATISTICS and SHOW TABLE_STATISTICS
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.1.1
Com_show_grants
• Description: Number of SHOW GRANTS commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_keys
• Description: Number of SHOW INDEX or SHOW KEYS commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_index_statistics
• Description: Number of SHOW INDEX_STATISTICS commands executed. Removed in
MariaDB 10.1.1 when that statement was replaced by the generic SHOW
information_schema_table.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.2
• Removed: MariaDB 10.1.1
Com_show_open_tables
• Description: Number of SHOW OPEN TABLES commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_package_status
• Description:
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.3.5
Com_show_package_body_status
• Description:
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.3.5
Com_show_plugins
• Description: Number of SHOW PLUGINS commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_privileges
• Description: Number of SHOW PRIVILEGES commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_procedure_status
• Description: Number of SHOW PROCEDURE STATUS commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_processlist
• Description: Number of SHOW PROCESSLIST commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_profile
• Description: Number of SHOW PROFILE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_profiles
• Description: Number of SHOW PROFILES commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_relaylog_events
• Description: Number of SHOW RELAYLOG EVENTS commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_status
• Description: Number of SHOW STATUS commands executed.
• Scope: Global, Session
• Data Type: numericst
Com_show_storage_engines
• Description: Number of SHOW STORAGE ENGINES - or SHOW ENGINES - commands
executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_table_statistics
• Description: Number of SHOW TABLE STATISTICS commands executed. Removed in
MariaDB 10.1.1 when that statement was replaced by the generic SHOW
information_schema_table.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.2
• Removed: MariaDB 10.1.1
Com_show_table_status
• Description: Number of SHOW TABLE STATUS commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_tables
• Description: Number of SHOW TABLES commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_triggers
• Description: Number of SHOW TRIGGERS commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_user_statistics
• Description: Number of SHOW USER STATISTICS commands executed. Removed in
MariaDB 10.1.1 when that statement was replaced by the generic SHOW
information_schema_table.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.2
• Removed: MariaDB 10.1.1
Com_show_variable
• Description: Number of SHOW VARIABLES commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_show_warnings
• Description: Number of SHOW WARNINGS commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_shutdown
• Description: Number of SHUTDOWN commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_stmt_close
• Description: Number of prepared statements closed (deallocated or dropped).
• Scope: Global, Session
• Data Type: numeric
Com_stmt_execute
• Description: Number of prepared statements executed.
• Scope: Global, Session
• Data Type: numeric
Com_stmt_fetch
• Description: Number of prepared statements fetched.
• Scope: Global, Session
• Data Type: numeric
Com_stmt_prepare
• Description: Number of prepared statements prepared.
• Scope: Global, Session
• Data Type: numeric
Com_stmt_reprepare
• Description: Number of prepared statements reprepared.
• Scope: Global, Session
• Data Type: numeric
Com_stmt_reset
• Description: Number of prepared statements where the data of a prepared statement which was
accumulated in chunks by sending long data has been reset.
• Scope: Global, Session
• Data Type: numeric
Com_stmt_send_long_data
• Description: Number of prepared statements where the parameter data has been sent in chunks
(long data).
• Scope: Global, Session
• Data Type: numeric
Com_truncate
• Description: Number of TRUNCATE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_uninstall_plugin
• Description: Number of UNINSTALL PLUGIN commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_unlock_tables
• Description: Number of UNLOCK TABLES commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_update
• Description: Number of UPDATE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_update_multi
• Description: Number of multi-table UPDATE commands executed.
• Scope: Global, Session
• Data Type: numeric
Com_xa_commit
• Description: Number of XA statements committed.
• Scope: Global, Session
• Data Type: numeric
Com_xa_end
• Description: Number of XA statements ended.
• Scope: Global, Session
• Data Type: numeric
Com_xa_prepare
• Description: Number of XA statements prepared.
• Scope: Global, Session
• Data Type: numeric
Com_xa_recover
• Description: Number of XA RECOVER statements executed.
• Scope: Global, Session
• Data Type: numeric
Com_xa_rollback
• Description: Number of XA statements rolled back.
• Scope: Global, Session
• Data Type: numeric
Com_xa_start
• Description: Number of XA statements started.
• Scope: Global, Session
• Data Type: numeric
Compression
• Description: Whether client-server traffic is compressed.
• Scope: Session
• Data Type: boolean
Connection_errors_accept
• Description: Number of errors that occurred during calls to accept() on the listening port.
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.0.4 / MySQL 5.6.5
Connection_errors_internal
• Description: Number of refused connections due to internal server errors, for example out of
memory errors, or failed thread starts.
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.0.4 / MySQL 5.6.5
Connection_errors_max_connections
• Description: Number of refused connections due to the max_connections limit being reached.
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.0.4 / MySQL 5.6.5
Connection_errors_peer_address
• Description: Number of errors while searching for the connecting client IP address.
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.0.4 / MySQL 5.6.5
Connection_errors_select
• Description: Number of errors during calls to select() or poll() on the listening port. The client
would not necessarily have been rejected in these cases.
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.0.4 / MySQL 5.6.5
Connection_errors_tcpwrap
• Description: Number of connections the libwrap library refused.
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.0.4 / MySQL 5.6.5
Connections
• Description: Number of connection attempts (both successful and unsuccessful)
• Scope: Global
• Data Type: numeric
Cpu_time
• Description: Total CPU time used.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.3
Created_tmp_disk_tables
• Description: Number of on-disk temporary tables created.
• Scope: Global, Session
• Data Type: numeric
Created_tmp_files
• Description: Number of in-memory temporary tables created.
• Scope: Global
• Data Type: numeric
Created_tmp_tables
• Description: Number of temporary tables created.
• Scope: Global
• Data Type: numeric
Delayed_errors
• Description: Number of errors which occurred while doing INSERT DELAYED.
• Scope: Global
• Data Type: numeric
Delayed_insert_threads
• Description: Number of INSERT DELAYED threads.
• Scope: Global
• Data Type: numeric
Delayed_writes
• Description: Number of INSERT DELAYED rows written.
• Scope: Global
• Data Type: numeric
Delete_scan
• Description: Number of DELETEs that required a full table scan.
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.1.17, MariaDB 10.0.27
Empty_queries
• Description: Number of queries returning no results. Note this is not the same as
Com_empty_query.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.2
Executed_events
• Description: Number of times events created with CREATE EVENT have executed. This
differs from Com_create_event in that it is only incremented when the event has run, not when
it executes.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5.28
Executed_triggers
• Description: Number of times triggers created with CREATE TRIGGER have executed. This
differs from Com_create_trigger in that it is only incremented when the trigger has run, not
when it executes.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5.28
Feature_check_constraint
• Description: Number of times constraints were checked.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.2.2
Feature_custom_aggregate_functions
• Description: Number of queries which make use of custom aggregate functions.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.3.6
Feature_delay_key_write
• Description: Number of tables opened that are using delay_key_write.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.0.13
Feature_dynamic_columns
• Description: Number of times the COLUMN_CREATE() function was used.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Feature_fulltext
• Description: Number of times the MATCH … AGAINST() function was used.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Feature_gis
• Description: Number of times a table with a any of the geometry columns was opened.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Feature_invisible_columns
• Description: Number of invisible columns in all opened tables.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.3.3
Feature_json
• Description: Number of times JSON functionality has been used, such as one of the JSON
functions. Does not include the CONNECT engine JSON type, or EXPLAIN/ANALYZE
FORMAT=JSON.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.3.7
Feature_locale
• Description: Number of times the @@lc_messages variable was assigned into.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Feature_subquery
• Description: Number of subqueries (excluding subqueries in the FROM clause) used.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Feature_system_versioning
• Description: Number of times system versioning functionality has been used (opening a table
WITH SYSTEM VERSIONING).
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.3.7
Feature_timezone
• Description: Number of times an explicit timezone (excluding UTC and SYSTEM) was
specified.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Feature_trigger
• Description: Number of triggers loaded.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Feature_window_functions
• Description: Number of times window functions were used.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.2.2
Feature_xml
• Description: Number of times XML functions (EXTRACTVALUE() and UPDATEXML())
were used.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Flush_commands
• Description: Number of FLUSH statements executed, as well as due to internal server flush
requests. This differs from Com_flush, which simply counts FLUSH statements, not internal
server flush operations.
• Scope: Global
• Data Type: numeric
Handler_commit
• Description: Number of internal COMMIT requests. Differs from Com_commit, which counts
the number of COMMIT statements executed.
• Scope: Global, Session
• Data Type: numeric
Handler_delete
• Description: Number of times rows have been deleted from tables. Differs from Com_delete,
which counts DELETE statements.
• Scope: Global, Session
• Data Type: numeric
Handler_discover
• Description: Discovery is when the server asks the NDBCLUSTER storage engine if it knows
about a table with a given name. Handler_discover indicates the number of times that tables
have been discovered in this way.
• Scope: Global, Session
• Data Type: numeric
Handler_external_lock
• Description: Incremented for each call to the external_lock() function, which generally occurs
at the beginning and end of access to a table instance.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.0.0
Handler_icp_attempts
• Description: Number of times pushed index condition was checked. The smaller the ratio of
Handler_icp_attempts to Handler_icp_match the better the filtering. See Index Condition
Pushdown.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.3
Handler_icp_match
• Description: Number of times pushed index condition was matched. The smaller the ratio of
Handler_icp_attempts to Handler_icp_match the better the filtering. See See Index Condition
Pushdown.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.3
Handler_mrr_init
• Description: Counts how many MRR (multi-range read) scans were performed. See Multi
Range Read optimization.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.3
Handler_mrr_key_refills
• Description: Number of times key buffer was refilled (not counting the initial fill). A non-zero
value indicates there wasn't enough memory to do key sort-and-sweep passes in one go. See
Multi Range Read optimization.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.3
Handler_mrr_rowid_refills
• Description: Number of times rowid buffer was refilled (not counting the initial fill). A non-
zero value indicates there wasn't enough memory to do rowid sort-and-sweep passes in one go.
See Multi Range Read optimization.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.3
Handler_prepare
• Description: Number of two-phase commit prepares.
• Scope: Global, Session
• Data Type: numeric
Handler_read_first
• Description: Number of requests to read the first row from an index. A high value indicates
many full index scans, e.g. SELECT a FROM table_name where a is an indexed column.
• Scope: Global, Session
• Data Type: numeric
Handler_read_key
• Description: Number of row read requests based on an index value. A high value indicates
indexes are regularly being used, which is usually positive.
• Scope: Global, Session
• Data Type: numeric
Handler_read_last
• Description: Number of requests to read the last row from an index. ORDER BY DESC results
in a last-key request followed by several previous-key requests.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Handler_read_next
• Description: Number of requests to read the next row from an index (in order). Increments
when doing an index scan or querying an index column with a range constraint.
• Scope: Global, Session
• Data Type: numeric
Handler_read_prev
• Description: Number of requests to read the previous row from an index (in order). Mostly
used with ORDER BY DESC.
• Scope: Global, Session
• Data Type: numeric
Handler_read_retry
• Description: Number of read retrys triggered by semi_consistent_read (InnoDB feature).
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.0.27
Handler_read_rnd
• Description: Number of requests to read a row based on its position. If this value is high, you
may not be using joins that don't use indexes properly, or be doing many full table scans.
• Scope: Global, Session
• Data Type: numeric
Handler_read_rnd_deleted
• Description: Number of requests to delete a row based on its position.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.3
Handler_read_rnd_next
• Description: Number of requests to read the next row. A large number of these may indicate
many table scans and improperly used indexes.
• Scope: Global, Session
• Data Type: numeric
Handler_rollback
• Description: Number of transaction rollback requests given to a storage engine. Differs from
Com_rollback, which is the number of ROLLBACK commands executed.
• Scope: Global, Session
• Data Type: numeric
Handler_savepoint
• Description: Number of transaction savepoint creation requests. Differs from Com_savepoint
which is the number of SAVEPOINT commands executed.
• Scope: Global, Session
• Data Type: numeric
Handler_savepoint_rollback
• Description: Number of requests to rollback to a transaction savepoint.
• Scope: Global, Session
• Data Type: numeric
Handler_tmp_delete
• Description: Number of requests to delete a row in a temporary table.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.3.0
Handler_tmp_update
• Description: Number of requests to update a row to a temporary table.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.3
Handler_tmp_write
• Description: Number of requests to write a row to a temporary table.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.3
Handler_update
• Description: Number of requests to update a row in a table. Since MariaDB 5.3, this no longer
counts temporary tables - see Handler_tmp_update.
• Scope: Global, Session
• Data Type: numeric
Handler_write
• Description: Number of requests to write a row to a table. Since MariaDB 5.3, this no longer
counts temporary tables - see Handler_tmp_write.
• Scope: Global, Session
• Data Type: numeric
Key_blocks_not_flushed
• Description: Number of key cache blocks which have been modified but not flushed to disk.
• Scope: Global
• Data Type: numeric
Key_blocks_unused
• Description: Number of unused key cache blocks.
• Scope: Global
• Data Type: numeric
Key_blocks_used
• Description: Max number of key cache blocks which have been used simultaneously.
• Scope: Global
• Data Type: numeric
Key_blocks_warm
• Description: Number of key cache blocks in the warm list.
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 5.1
Key_read_requests
• Description: Number of key cache block read requests. See Optimizing key_buffer_size.
• Scope: Global
• Data Type: numeric
Key_reads
• Description: Number of physical index block reads. See Optimizing key_buffer_size.
• Scope: Global
• Data Type: numeric
Key_write_requests
• Description: Number of requests to write a block to the key cache.
• Scope: Global
• Data Type: numeric
Key_writes
• Description: Number of key cache block write requests
• Scope: Global
• Data Type: numeric
Last_query_cost
• Description: The most recent query optimizer query cost calculation. Can not be calculated for
complex queries, such as subqueries or UNION. It will be set to 0 for complex queries.
• Scope: Session
• Data Type: numeric
Maria_*
• Description: When the Maria storage engine was renamed Aria, the Maria variables existing at
the time were renamed at the same time. See Aria Server Status Variables.
Max_statement_time_exceeded
• Description: Number of queries that exceeded the execution time specified by
max_statement_time. See Aborting statements that take longer than a certain time to execute.
• Data Type: numeric
• Introduced: MariaDB 10.1.1
Max_used_connections
• Description: Max number of connections ever open at the same time.
• Scope: Session
• Data Type: numeric
Memory_used
• Description: Global or per-connection memory usage, in bytes.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.0.1
Memory_used_initial
• Description:
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.3.3
Not_flushed_delayed_rows
• Description: Number of INSERT DELAYED rows waiting to be written.
• Scope: Global
• Data Type: numeric
Open_files
• Description: Number of regular files currently opened by the server. Does not include sockets
or pipes, or storage engines using internal functions.
• Scope: Global
• Data Type: numeric
Open_streams
• Description: Number of currently opened streams, usually log files.
• Scope: Global
• Data Type: numeric
Open_table_definitions
• Description: Number of currently cached .frm files.
• Scope: Global
• Data Type: numeric
Open_tables
• Description: Number of currently opened tables, excluding temporary tables.
• Scope: Global, Session
• Data Type: numeric
Opened_files
• Description: Number of files the server has opened.
• Scope: Global
• Data Type: numeric
Opened_table_definitions
• Description: Number of .frm files that have been cached.
• Scope: Global, Session
• Data Type: numeric
Opened_tables
• Description: Number of tables the server has opened.
• Scope: Global, Session
• Data Type: numeric
Opened_views
• Description: Number of views the server has opened.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Performance_schema_accounts_lost
• Description: Number of times a row could not be added to the performance schema accounts
table due to it being full.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.0.0
Performance_schema_cond_classes_lost
• Description: Number of condition instruments that could not be loaded.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Performance_schema_cond_instances_lost
• Description: Number of instances a condition object could not be created.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Performance_schema_digest_lost
• Description:
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Performance_schema_file_classes_lost
• Description: Number of file instruments that could not be loaded.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Performance_schema_file_handles_lost
• Description: Number of instances a file object could not be opened.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Performance_schema_file_instances_lost
• Description: Number of instances a file object could not be created.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Performance_schema_hosts_lost
• Description: Number of times a row could not be added to the performance schema hosts table
due to it being full.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.0.0
Performance_schema_locker_lost
• Description: Number of events not recorded, due to either being recursive, or having a deeper
nested events stack than the implementation limit.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Performance_schema_mutex_classes_lost
• Description: Number of mutual exclusion instruments that could not be loaded.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Performance_schema_mutex_instances_lost
• Description: Number of instances a mutual exclusion object could not be created.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Performance_schema_rwlock_classes_lost
• Description: Number of read/write lock instruments that could not be loaded.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Performance_schema_rwlock_instances_lost
• Description: Number of instances a read/write lock object could not be created.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Performance_schema_socket_classes_lost
• Description:
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.0.0
Performance_schema_socket_instances_lost
• Description: Number of instances a socket object could not be created.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.0.0
Performance_schema_stage_classes_lost
• Description: Number of stage event instruments that could not be loaded.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.0.0
Performance_schema_statement_classes_lost
• Description: Number of statement instruments that could not be loaded.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.0.0
Performance_schema_table_handles_lost
• Description: Number of instances a table object could not be opened.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Performance_schema_table_instances_lost
• Description: Number of instances a table object could not be created.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Performance_schema_thread_classes_lost
• Description: Number of thread instruments that could not be loaded.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Performance_schema_thread_instances_lost
• Description: Number of instances thread object could not be created.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Performance_schema_users_lost
• Description: Number of times a row could not be added to the performance schema users table
due to it being full.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.5
Prepared_stmt_count
• Description: Current number of prepared statements.
• Scope: Global
• Data Type: numeric
Qcache_free_blocks
• Description: Number of free query cache memory blocks.
• Scope: Global
• Data Type: numeric
Qcache_free_memory
• Description: Amount of free query cache memory.
• Scope: Global
• Data Type: numeric
Qcache_hits
• Description: Number of requests served by the query cache.
• Scope: Global
• Data Type: numeric
Qcache_inserts
• Description: Number of queries ever cached in the query cache.
• Scope: Global
• Data Type: numeric
Qcache_lowmem_prunes
• Description: Number of pruning operations performed to remove old results to make space for
new results in the query cache.
• Scope: Global
• Data Type: numeric
Qcache_not_cached
• Description: Number of queries that are uncacheable by the query cache, or use
SQL_NO_CACHE.
• Scope: Global
• Data Type: numeric
Qcache_queries_in_cache
• Description: Number of queries currently cached by the query cache.
• Scope: Global
• Data Type: numeric
Qcache_total_blocks
• Description: Number of blocks used by the query cache.
• Scope: Global
• Data Type: numeric
Queries
• Description: Number of statements executed by the server, excluding COM_PING and
COM_STATISTICS. Differs from Questions in that it also counts statements executed within
stored programs.
• Scope: Global, Session
• Data Type: numeric
Questions
• Description: Number of statements executed by the server, excluding COM_PING,
COM_STATISTICS, COM_STMT_PREPARE, COM_STMT_CLOSE, and
COM_STMT_RESET statements. Differs from Queries in that it doesn't count statements
executed within stored programs.
• Scope: Global, Session
• Data Type: numeric
Rows_read
• Description: Number of requests to read a row (excluding temporary tables).
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.3
Rows_sent
• Description:
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.3
Rows_tmp_read
• Description: Number of requests to read a row in a temporary table.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.3
Select_full_join
• Description: Number of joins which did not use an index. If not zero, you may need to check
table indexes.
• Scope: Global, Session
• Data Type: numeric
Select_full_range_join
• Description: Number of joins which used a range search of the first table.
• Scope: Global, Session
• Data Type: numeric
Select_range
• Description: Number of joins which used a range on the first table.
• Scope: Global, Session
• Data Type: numeric
Select_range_check
• Description: Number of joins without keys that check for key usage after each row. If not zero,
you may need to check table indexes.
• Scope: Global, Session
• Data Type: numeric
Select_scan
• Description: Number of joins which used a full scan of the first table.
• Scope: Global, Session
• Data Type: numeric
Slow_launch_threads
• Description: Number of threads which took longer than slow_launch_time to create.
• Scope: Global, Session
• Data Type: numeric
Slow_queries
• Description: Number of queries which took longer than long_query_time to run. The slow
query log does not need to be active for this to be recorded.
• Scope: Global, Session
• Data Type: numeric
Sort_merge_passes
• Description: Number of merge passes performed by the sort algorithm. If too high, you may
need to look at improving your query indexes, or increasing the sort_buffer_size.
• Scope: Global, Session
• Data Type: numeric
Sort_priority_queue_sorts
• Description: The number of times that sorting was done through a priority queue. (The total
number of times sorting was done is a sum Sort_range and Sort_scan). See filesort with small
LIMIT optimization.
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 10.0.13
Sort_range
• Description: Number of sorts which used a range.
• Scope: Global, Session
• Data Type: numeric
Sort_rows
• Description: Number of rows sorted.
• Scope: Global, Session
• Data Type: numeric
Sort_scan
• Description: Number of sorts which used a full table scan.
• Scope: Global, Session
• Data Type: numeric
Subquery_cache_hit
• Description: Counter for all subquery cache hits
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.3
Subquery_cache_miss
• Description: Counter for all subquery cache misses
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.3
Syncs
• Description: Number of times my_sync() has been called, or the number of times the server has
had to force data to disk. Covers the binary log, .frm creation (if these operations are configured
to sync) and some storage engines (Archive, CSV, Aria), but not XtraDB/InnoDB).
• Scope: Global, Session
• Data Type: numeric
• Introduced: MariaDB 5.1
Table_locks_immediate
• Description: Number of table locks which were completed immediately.
• Scope: Global
• Data Type: numeric
Table_locks_waited
• Description: Number of table locks which had to wait. Indicates table lock contention.
• Scope: Global
• Data Type: numeric
Table_open_cache_active_instances
• Description: Number of active instances for open tables cache lookups.
• Scope:
• Data Type: numeric
• Introduced: MariaDB 10.3.3
Table_open_cache_hits
• Description: Number of hits for open tables cache lookups.
• Scope:
• Data Type: numeric
• Introduced: MariaDB 10.3.3
Table_open_cache_misses
• Description: Number of misses for open tables cache lookups.
• Scope:
• Data Type: numeric
• Introduced: MariaDB 10.3.3
Table_open_cache_overflows
• Description: Number of overflows for open tables cache lookups.
• Scope:
• Data Type: numeric
• Introduced: MariaDB 10.3.3
Tc_log_max_pages_used
• Description: Max number of pages used by the transaction coordinator recovery log.
• Scope: Global
• Data Type: numeric
Tc_log_page_size
• Description: Page size of the transaction coordinator recovery log.
• Scope: Global
• Data Type: numeric
Tc_log_page_waits
• Description: Number of times a two-phase commit was forced to wait for a free transaction
coordinator recovery log page.
• Scope: Global
• Data Type: numeric
Threads_cached
• Description: Number of threads cached in the thread cache. Will be zero if the thread pool is in
use (see Thread pool in MariaDB 5.5).
• Scope: Global
• Data Type: numeric
Threads_connected
• Description: Number of open connections. See Handling Too Many Connections.
• Scope: Global
• Data Type: numeric
Threads_created
• Description: Number of threads created to respond to client connections. If too large, look at
increasing thread_cache_size.
• Scope: Global
• Data Type: numeric
Threads_running
• Description: Number of threads that are actively running, not sleeping. Until MariaDB 10.3.2,
a global counter was updated on the fly. From MariaDB 10.3.3, as a performance improvement,
all threads having a command not equal to COM_SLEEP are included. This means that the
querying the session value will always return 1 (before MariaDB 10.3.3, global and session
returned the same value).
• Scope: Global
• Data Type: numeric
Update_scan
• Description: Number of updates that required a full table scan.
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 10.1.17, MariaDB 10.0.27
Uptime
• Description: Number of seconds the server has been running.
• Scope: Global
• Data Type: numeric
Uptime_since_flush_status
• Description: Number of seconds since the last FLUSH STATUS.
• Scope: Global
• Data Type: numeric
This page documents status variables related to the Aria storage engine. See Server Status
Variables for a complete list of status variables that can be viewed with SHOW STATUS.
See also the Full list of MariaDB options, system and status variables.
Aria_pagecache_blocks_not_flushed
• Description: The number of dirty blocks in the Aria page cache.
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 5.3
Aria_pagecache_blocks_unused
• Description: Free blocks in the Aria page cache.
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 5.3
Aria_pagecache_blocks_used
• Description: Blocks used in the Aria page cache.
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 5.3
Aria_pagecache_read_requests
• Description: The number of requests to read something from the Aria page cache.
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 5.3
Aria_pagecache_reads
• Description: The number of Aria page cache read requests that caused a block to be read from
the disk.
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 5.3
Aria_pagecache_write_requests
• Description: The number of requests to write a block to the Aria page cache.
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 5.3
Aria_pagecache_writes
• Description: The number of blocks written to disk from the Aria page cache.
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 5.3
Aria_transaction_log_syncs
• Description: The number of Aria log fsyncs.
• Scope: Global
• Data Type: numeric
• Introduced: MariaDB 5.3

More Related Content

PPT
Linux
PPT
Linux basics
PDF
Cisco Digital Network Architecture - Introducing the Network Intuitive
PDF
Osint second edition
PDF
Server Management
PDF
Configuring and administrate server
PDF
Network Security Fundamentals
PPT
Networking basics PPT
Linux
Linux basics
Cisco Digital Network Architecture - Introducing the Network Intuitive
Osint second edition
Server Management
Configuring and administrate server
Network Security Fundamentals
Networking basics PPT

What's hot (20)

PDF
Red Hat Insights
PPTX
5 reasons why you need a network monitoring tool
PPT
Linux basic commands
PPTX
Ethical Hacking PPT (CEH)
ODP
An Introduction to Linux
PPT
Naming And Binding (Distributed computing)
PPTX
Network Monitoring Basics
PDF
Network Access Control (NAC)
PPT
Samba server
PDF
Network commands
PPT
CCNA presentation.
PPTX
Linux file system
PPTX
Computer network
ODP
pfSense presentation
PPTX
Aruba Netwrok(1).pptx
PPTX
Metasploit
PPTX
Network connecting devices and their security
PPTX
Cisco Networking (Routing and Switching)
Red Hat Insights
5 reasons why you need a network monitoring tool
Linux basic commands
Ethical Hacking PPT (CEH)
An Introduction to Linux
Naming And Binding (Distributed computing)
Network Monitoring Basics
Network Access Control (NAC)
Samba server
Network commands
CCNA presentation.
Linux file system
Computer network
pfSense presentation
Aruba Netwrok(1).pptx
Metasploit
Network connecting devices and their security
Cisco Networking (Routing and Switching)
Ad

Similar to مرجع oracle mysql |mariadb (20)

PDF
Zfs and btrfs
PDF
‫سطح دسترسی و کنترل لیست و سهمیه بندی‬ ‫در گنو/لینوکس‬
PDF
Package management
PDF
Zabbix monitoring website
PDF
PDF
PDF
تجارت الکترونبکی با opencart
PDF
virsh vmware
PDF
Supervisor
PDF
PDF
nbd and it's benefits
PDF
devops and bcp (bussiness continues planning)
PDF
Systemd and its various uses and capabilities.
PDF
PDF
bcache and cachefs its benefits.
PDF
PDF
PDF
Partition in oracle mysql |Mariadb
PDF
openstack designate
Zfs and btrfs
‫سطح دسترسی و کنترل لیست و سهمیه بندی‬ ‫در گنو/لینوکس‬
Package management
Zabbix monitoring website
تجارت الکترونبکی با opencart
virsh vmware
Supervisor
nbd and it's benefits
devops and bcp (bussiness continues planning)
Systemd and its various uses and capabilities.
bcache and cachefs its benefits.
Partition in oracle mysql |Mariadb
openstack designate
Ad

More from Yashar Esmaildokht (20)

PDF
ceph csi vs rook and its benefit and future
PDF
firewalling in linux and netfilter and iptables
PDF
the refrence of Oracle Database - The 0.4 release
PDF
The Refrence Of DevOps -The 0.5 release
PDF
Ceph RADOS Gateway (RGW) - s3 swift -object storage
PDF
oracle mysql/mariadb api -the connect engine
PDF
what is staging in database (oracle and mariadb |mysql)
PDF
maxscale and spider engine for performance and security and clustering
PDF
DevOps reference - Devops metadologhy - devops technologhy
PDF
louad balancing vs api getway vs reverse proxy
PDF
Ceph: A Powerful, Scalable, and Flexible Storage Solution
PDF
how install and config sdn in proxmox virtualization
PDF
service registery and the service discovery
PDF
how add and remove Mgr in ceph cluster
PDF
how add and delete new mon in ceph cluster
PDF
raid with megacli
PDF
Openstack Rally
PDF
OpenStack and its service
PDF
Load Balancing-as-a-Service (LBaaS) with octavia in openstack
PDF
نحوه ایجاد snapshot و ایجاد point در سیستم‌های گنو/لینوکسی برای ایجاد sys...
ceph csi vs rook and its benefit and future
firewalling in linux and netfilter and iptables
the refrence of Oracle Database - The 0.4 release
The Refrence Of DevOps -The 0.5 release
Ceph RADOS Gateway (RGW) - s3 swift -object storage
oracle mysql/mariadb api -the connect engine
what is staging in database (oracle and mariadb |mysql)
maxscale and spider engine for performance and security and clustering
DevOps reference - Devops metadologhy - devops technologhy
louad balancing vs api getway vs reverse proxy
Ceph: A Powerful, Scalable, and Flexible Storage Solution
how install and config sdn in proxmox virtualization
service registery and the service discovery
how add and remove Mgr in ceph cluster
how add and delete new mon in ceph cluster
raid with megacli
Openstack Rally
OpenStack and its service
Load Balancing-as-a-Service (LBaaS) with octavia in openstack
نحوه ایجاد snapshot و ایجاد point در سیستم‌های گنو/لینوکسی برای ایجاد sys...

مرجع oracle mysql |mariadb

  • 1. ‫تعالی‬ ‫بسمه‬ ‫مرجع‬ ‫دخت‬ ‫اسمعیل‬ ‫یاشار‬ : ‫نوشته‬ ‫نسخه‬ ۰.۱
  • 2. whoami : yashar esmaildokht I am Gnu/Linux Sys/net/sec engineer| Administrator & Oracle Dba |devops my tel : 09141100257 my resume (fa) :goo.gl/oUQopW Linkedin: goo.gl/Ljb9SF website : http://unixmen.ir http://oraclegeek.ir my nick name : royaflash
  • 3. : ‫به‬ ‫تقدیم‬ ‫خدا‬ ‫شتافت‬ ‫یاریم‬ ‫به‬ ‫که‬ ‫بود‬ ‫او‬ ‫تنها‬ ‫هایم‬ ‫سختی‬ ‫در‬ ‫که‬ ‫چرا‬ ‫مادرم‬ ‫اویم‬ ‫مدیون‬ ‫که‬ ‫را‬ ‫حبت‬ َ‫م‬ ‫و‬ ‫انسانیت‬ ‫داد‬ ‫یاد‬ ‫و‬ . ‫کرد‬ ‫تقدیم‬ ‫زندگی‬ ‫به‬ ‫مرا‬ ‫که‬ ‫چرا‬ ‫پدرم‬ ‫اویم‬ ‫مدیون‬ ‫و‬ ‫بود‬ ‫من‬ ‫حامی‬ ‫همیشه‬ ‫روحش‬ ‫که‬ ‫عشقم‬ ‫هست‬ ‫و‬ ‫بود‬ ‫مشوقم‬ ‫که‬ ‫سورس‬ ‫اپن‬ ‫جامعه‬ ‫بشریت‬ ‫را‬ ‫هایش‬ ‫دانسته‬ ‫میکند‬ ‫منتشر‬ ‫و‬ ‫میخواند‬ ‫که‬ ‫او‬ ‫و‬ ): ‫هیچ‬ ‫دیگر‬ ‫و‬ ‫جهانی‬ ‫صلح‬ ‫امید‬ ‫به‬ ‫و‬
  • 6. ‫؟‬ ‫کنیم‬ ‫استفاده‬ ‫لینوکس‬/‫گنو‬ ‫از‬ ‫چرا‬ ‫یک‬ ‫دنبال‬ ‫به‬ ‫باید‬ ،‫نیست‬ ‫‌تان‬ ‫ی‬‫نیازها‬ ‫رفع‬ ‫برای‬ ‫مناسبی‬ ‫‌عامل‬ ‫م‬‫سیست‬ ‫ویندوز‬ ‫که‬ ‫رسیدید‬ ‫نتیجه‬ ‫این‬ ‫به‬ ‫اگر‬ ‫باشید‬ ‫آن‬ ‫برای‬ ‫جایگزین‬ . ‫ندارد‬ ‫وجود‬ ‫فراوانی‬ ‫‌های‬ ‫ب‬‫انتخا‬ . ‫سایر‬ ‫میان‬ ‫از‬ ‫ما‬ ‫‌های‬ ‫ب‬‫انتخا‬ ‫بهترین‬ ‫شاید‬ ‫گنو‬ ‫و‬ ‫مک‬ ‫به‬ ‫تنها‬ ‫بتواند‬ ‫‌ها‬ ‫ل‬‫‌عام‬ ‫م‬‫سیست‬ / ‫شود‬ ‫منتهی‬ ‫لینوکس‬ . ‫‌ی‬ ‫ه‬‫انحصارطلبان‬ ‫‌های‬ ‫ت‬‫سیاس‬ ‫علت‬ ‫به‬ ‫مک‬ ‫نصب‬ ‫‌افزارها‬ ‫ت‬‫سخ‬ ‫سایر‬ ‫روی‬ ‫سختی‬ ‫به‬ ‫و‬ ‫است‬ ‫شرکت‬ ‫همان‬ ‫اختصاصی‬ ‫‌افزارهای‬ ‫ت‬‫سخ‬ ‫به‬ ‫محصور‬ ‫اپل‬ ‫شرکت‬ ‫ندارد‬ ‫مناسبی‬ ‫و‬ ‫کامل‬ ‫کارکرد‬ ‫نیز‬ ‫نصب‬ ‫صورت‬ ‫در‬ ‫و‬ ‫‌شود‬ ‫ی‬‫م‬ . ‫گنو‬ ‫‌عامل‬ ‫م‬‫سیست‬ / ‫بزرگترین‬ ‫از‬ ‫یکی‬ ‫لینوکس‬ ‫دارد‬ ‫جالبی‬ ‫بسیار‬ ‌ ‫ه‬‫تاریخچ‬ ‫که‬ ‫است‬ ‫رایانه‬ ‫تاریخ‬ ‫‌های‬ ‫ه‬‫پروژ‬ . ‫یک‬ ‫توسط‬ ‫آن‬ ‫مونولیتیک‬ ‫‌ی‬ ‫ه‬‫هست‬ ‫که‬ ‫‌عاملی‬ ‫م‬‫سیست‬ ‫انتشار‬ ‫مجوز‬ ‫انتخاب‬ ‫علت‬ ‫به‬ ‫بعدها‬ ‫اما‬ ‫شد‬ ‫ایجاد‬ ‫سرگرمی‬ ‫جهت‬ ‫تنها‬ ‫فنالندی‬ ‫دانشجوی‬ GPL ‫پیشرفت‬ ‫مسیر‬ ‫در‬ ‫اکنون‬ ‫و‬ ‫پیمود‬ ‫جهشی‬ ‫را‬ ۲۲ ‫‌است‬ ‫ه‬‌ ‫د‬‫کر‬ ‫نفوذ‬ ‫‌ها‬ ‫ن‬‫انسا‬ ‫اکثر‬ ‫زندگی‬ ‫در‬ ‫‌اش‬ ‫ی‬‫سالگ‬ . ‫از‬ ‫بسیاری‬ ‫روزها‬ ‫این‬ ‫پسوند‬ ‫که‬ ‫وسایلی‬ « ‫هوشمند‬ » ‫استفاده‬ ‫خود‬ ‫‌عامل‬ ‫م‬‫سیست‬ ‫قلب‬ ‫عنوان‬ ‫به‬ ‫لینوکس‬ ‫از‬ ‫‌کشند‬ ‫ی‬‫م‬ ‫خود‬ ‫دنبال‬ ‫به‬ ‫را‬ ‫‌کنند‬ ‫ی‬‫م‬ . ‫تلویزیون‬ ،‫یخچال‬ ‫مثل‬ ‫خانگی‬ ‫وسایل‬ ‫تا‬ ‫گرفته‬ ‫موتورسیکلت‬ ‫و‬ ‫ماشین‬ ‫مثل‬ ‫مختلف‬ ‫‌ی‬ ‫ه‬‫نقلی‬ ‫وسایل‬ ‫از‬ ‫دارند‬ ‫را‬ ‫خود‬ ‫جای‬ ‫نیز‬ ‫‌ها‬ ‫ت‬‫تبل‬ ‫و‬ ‫موبایل‬ ‫‌های‬ ‫ی‬‫گوش‬ ‫البته‬ ‫و‬ …‫و‬ . ‫گنو‬ ‫روی‬ ‫‌توان‬ ‫ی‬‫م‬ ‫هم‬ ‫دسکتاپ‬ ‫‌ی‬ ‫ه‬‫زمین‬ ‫در‬ ‫آیا‬ ‫‌گیرد؟‬ ‫ی‬‫م‬ ‫چشمه‬ ‫سر‬ ‫کجا‬ ‫از‬ ‫موفقیت‬ ‫همه‬ ‫این‬ ‫اما‬ / ‫لینوکس‬ ‫کرد؟‬ ‫باز‬ ‫حساب‬ ‫گنو‬ ‫‌ی‬ ‫ه‬‫رایان‬ ‫به‬ ‫نفوذ‬ ‫احتمال‬ ; / ; ‫است‬ ‫کم‬ ‫لینوکسی‬ ‫دنیاست‬ ‫‌های‬ ‫ل‬‫‌عام‬ ‫م‬‫سیست‬ ‫‌ترین‬ ‫ن‬‫ام‬ ‫از‬ ‫یکی‬ ‫لینوکس‬ ‫مسلما‬ . ‫است‬ ‫‌ای‬ ‫ه‬‫فلسف‬ ‫ویژگی‬ ‫این‬ ‫آمدن‬ ‫وجود‬ ‫به‬ ‫دلیل‬ ‫گنو‬ ‫‌عامل‬ ‫م‬‫سیست‬ ‫پشت‬ ‫که‬ / ‫دارد‬ ‫وجود‬ ‫آزاد‬ ‫‌افزارهای‬ ‫م‬‫نر‬ ‫و‬ ‫لینوکس‬ . ‫الیسنیس‬ ‫طبق‬ GPL ‫انتشار‬ ‫مجوز‬ ‫که‬ ‫ویرایش‬ ‫آزادانه‬ ،‫ببینید‬ ‫آزادانه‬ ‫را‬ ‫آنها‬ ،‫کنید‬ ‫دریافت‬ ‫آزادانه‬ ‫را‬ ‫برنامه‬ ‫یک‬ ‫کدهای‬ ‫‌توانید‬ ‫ی‬‫م‬ ‫شما‬ ‫است‬ ‫لینوکس‬ ‫کنید‬ ‫منتشر‬ ‫الیسنس‬ ‫همان‬ ‫تحت‬ ‫اما‬ ‫آزادانه‬ ‫نهایت‬ ‫در‬ ‫و‬ ‫کنید‬ . ‫‌دهنگان‬ ‫ه‬‫توسع‬ ‫تا‬ ‫شده‬ ‫باعث‬ ‫ویژگی‬ ‫این‬ ‫‌های‬ ‫ه‬‫حفر‬ ‫و‬ ‫برده‬ ‫باال‬ ‫بسیار‬ ‫را‬ ‫‌عامل‬ ‫م‬‫سیست‬ ‫پایداری‬ ‫امر‬ ‫همین‬ ‫و‬ ‫برسند‬ ‫نفر‬ ‫هزار‬ ‫صدها‬ ‫به‬ ‫لینوکس‬ ‫‌ی‬ ‫ه‬‫هست‬ ‫‌است‬ ‫ه‬‫کرد‬ ‫کم‬ ‫بسیار‬ ‫را‬ ‫امنیتی‬ . ‫است‬ ‫حقیقت‬ ‫یک‬ ‫نگرفتن‬ ‫ویروس‬ ‫‌گیرد‬ ‫ی‬‫نم‬ ‫ویروس‬ ‫لینوکس‬ ‫که‬ ‫‌باشید‬ ‫ه‬‫شنید‬ ‫هم‬ ‫شما‬ ‫شاید‬ . ‫‌عامل‬ ‫م‬‫سیست‬ ‫این‬ ‫کم‬ ‫کاربرد‬ ‫با‬ ‫را‬ ‫اتفاق‬ ‫‌این‬‫‌ها‬ ‫ی‬‫خیل‬ ‫از‬ ‫بیش‬ ‫که‬ ‫بدانید‬ ‫است‬ ‫بهتر‬ ‫اما‬ ‫‌کنند‬ ‫ی‬‫م‬ ‫توجیه‬ ۴۰۰ ‫از‬ ‌ ‫ه‬‫ابررایان‬ ۵۰۰ ‫استفاده‬ ‫لینوکس‬ ‫از‬ ‫دنیا‬ ‫برتر‬ ‫‌ی‬ ‫ه‬‫ابررایان‬ ‫از‬ ‫بیش‬ ‫همچنین‬ ‫‌کنندو‬ ‫ی‬‫م‬ ۷۰ ‫‌های‬ ‫ه‬‫دهند‬ ‫سرویس‬ ‫درصد‬ ( servers ) ‫انتخاب‬ ‫را‬ ‫‌عامل‬ ‫م‬‫سیست‬ ‫این‬ ‫نیز‬ ‫جهان‬
  • 7. ‫‌اند‬ ‫ه‬‫کرد‬ . ‫از‬ ‫دسکتاپ‬ ‫کاربران‬ ‫تعداد‬ ‫همچنان‬ ‫خاصی‬ ‫دالیل‬ ‫به‬ ‫البته‬ ۳ ‫‌است‬ ‫ه‬‫نکرد‬ ‫تجاوز‬ ‫درصد‬ . ‫حساب‬ ‫این‬ ‫با‬ ‫و‬ ‫‌ها‬ ‫ه‬‫رایان‬ ‫ابر‬ ‫بخش‬ ‫در‬ ‫حیاتی‬ ‫‌های‬ ‫ت‬‫مسئولی‬ ‫و‬ ‫زیاد‬ ‫بسیار‬ ‫کاربران‬ ‫علت‬ ‫به‬ ‫لینوکس‬ ‫‌عامل‬ ‫م‬‫سیست‬ ‫مسلما‬ ‫پایداری‬ ‫که‬ ‫‌کنیم‬ ‫ی‬‫م‬ ‫مشاهده‬ ‫عمل‬ ‫در‬ ‫اما‬ ‫دارد‬ ‫نفوذ‬ ‫و‬ ‫خرابکاری‬ ‫برای‬ ‫ویندوز‬ ‫به‬ ‫نسبت‬ ‫بیشتری‬ ‫پتانسیل‬ ‫سرورها‬ ‫دارد‬ ‫ویندوز‬ ‫به‬ ‫نسبت‬ ‫بیشتری‬ ‫امنیت‬ ‫و‬ . ‫‌گیرد؟‬ ‫ی‬‫نم‬ ‫ویروس‬ ‫لینوکس‬ ‫چرا‬ ‫اما‬ ‫وجود‬ ‫امر‬ ‫این‬ ‫دلیل‬ ‌ ‫ی‬‫دسترس‬ ‫مجوزهای‬ ‫است‬ ‫متفاوت‬ ‫‌ها‬ ‫ل‬‫فای‬ ‫به‬ ‫لینوکس‬ ‫دید‬ ‫یعنی‬ ‫است‬ . ‫اجرایی‬ ‫‌ی‬ ‫ه‬‫برنام‬ ‫هر‬ ‫‌کنند‬ ‫ی‬‫م‬ ‫طی‬ ‫شدن‬ ‫اجرا‬ ‫برای‬ ‫را‬ ‫خاصی‬ ‫مراحل‬ ‫‌ها‬ ‫س‬‫ویرو‬ ‫مثل‬ : ۱ . ‫‌کند‬ ‫ی‬‫م‬ ‫بررسی‬ ‫بودن‬ ‫اجرایی‬ ‫نظر‬ ‫از‬ ‫را‬ ‫فایل‬ ‫نوع‬ ‫ابتدا‬ ‫‌عامل‬ ‫م‬‫سیست‬ . ۲ . ‫‌شود‬ ‫ی‬‫م‬ ‫بررسی‬ ‫اجرا‬ ‫برای‬ ‫کاربر‬ ‫مجوزهای‬ . ۳ . ‫‌گیرد‬ ‫ی‬‫م‬ ‫قرار‬ ‫برنامه‬ ‫فایل‬ ‫اختیار‬ ‫در‬ ‫‌افزاری‬ ‫ت‬‫سخ‬ ‫منابع‬ ‫و‬ ‫‌شود‬ ‫ی‬‫م‬ ‫اجرا‬ ‫فایل‬ ‫باال‬ ‫مورد‬ ‫دو‬ ‫تایید‬ ‫صورت‬ ‫در‬ . ‫‌شوند‬ ‫ی‬‫م‬ ‫طی‬ ‫چگونه‬ ‫ویندوز‬ ‫و‬ ‫لینوکس‬ ‫‌عامل‬ ‫م‬‫سیست‬ ‫دو‬ ‫در‬ ‫مراحل‬ ‫این‬ ‫ببینیم‬ ‫حال‬ . ۱ . ‫‌شود‬ ‫ی‬‫م‬ ‫شناخته‬ ‫آن‬ ‫پسوند‬ ‫از‬ ‫فایل‬ ‫نوع‬ ‫ویندوز‬ ‫در‬ . ‫پسوند‬ ‫فایل‬ ‫اگر‬ ‫یعنی‬ exe , com ‫یا‬ bat ‫مانند‬ ‫‌باشد‬ ‫ه‬‫داشت‬ ‫‌شود‬ ‫ی‬‫م‬ ‫رفتار‬ ‫آن‬ ‫با‬ ‫اجرایی‬ ‫فایل‬ . ‫قابل‬ ‫که‬ ‫‌شوند‬ ‫ی‬‫م‬ ‫شناخته‬ ‫آنها‬ ‫داخلی‬ ‫سرنام‬ ‫روی‬ ‫از‬ ‫‌ها‬ ‫ل‬‫فای‬ ‫نوع‬ ‫لینوکس‬ ‫در‬ ‫اما‬ ‫نیستند‬ ‫کاربر‬ ‫توسط‬ ‫تغییر‬ . ‫اجرایی‬ ‫فایل‬ ‫آن‬ ‫با‬ ‫لینوکس‬ ‫رفتار‬ ‫در‬ ‫تغییری‬ ‫هیچ‬ ‫پسوند‬ ‫نداشتن‬ ‫یا‬ ‫داشتن‬ ‫واقع‬ ‫در‬ ‫آن‬ ‫پسوند‬ ‫اگر‬ ‫حتی‬ ‫است‬ ‫اجرایی‬ ‫حتما‬ ‫لینوکس‬ ‫در‬ ‫اجرایی‬ ‫فایل‬ ‫یک‬ ،‫‌کند‬ ‫ی‬‫نم‬ ‫ایجاد‬ jpg ‫باشد‬ . ۲ . ‫دارند‬ ‫اجرا‬ ‫مجوز‬ ‫ویندوز‬ ‫در‬ ‫کاربران‬ ‫‌ی‬ ‫ه‬‫هم‬ ‫برای‬ ‫‌ها‬ ‫ل‬‫فای‬ ‫‌ی‬ ‫ه‬‫هم‬ ‫‌فرض‬ ‫ش‬‫پی‬ ‫حالت‬ ‫در‬ . ‫از‬ ‫که‬ ‫صورتی‬ ‫در‬ ‫البته‬ ‫‌فایل‬ ‫م‬‫سیست‬ Ntfs ‫کاری‬ ‫هر‬ ‫آزادند‬ ‫همه‬ ‫و‬ ‫داشت‬ ‫نخواهد‬ ‫وجود‬ ‫بررسی‬ ‫برای‬ ‫مجوزی‬ ‫اصال‬ ‫وگرنه‬ ‫کنید‬ ‫استفاده‬ ‫دهند‬ ‫انجام‬ . ‫است‬ ‫فایل‬ ‫یک‬ ‫‌های‬ ‫ش‬‫بخ‬ ‫مهمترین‬ ‫از‬ ‫کاربران‬ ‫برای‬ ‫اجرا‬ ‫مجوز‬ ‫لینوکس‬ ‫در‬ . ‫شناخته‬ ‫اجرایی‬ ‫اگر‬ ‫فایل‬ ‫یک‬ ‫یعنی‬ ‫باشد‬ ‫داشته‬ ‫شدن‬ ‫اجرا‬ ‫مجوز‬ ‫باید‬ ‫اجرا‬ ‫برای‬ ‫شود‬ . ‫‌ی‬ ‫ه‬‫کنند‬ ‫ایجاد‬ ‫کاربر‬ ‫برای‬ ‫فقط‬ ‫اجرا‬ ‫مجوز‬ ‫‌فرض‬ ‫ش‬‫پی‬ ‫حالت‬ ‫در‬ ‫‌رود‬ ‫ی‬‫م‬ ‫بین‬ ‫از‬ ‫فایل‬ ‫شدن‬ ‫کپی‬ ‫صورت‬ ‫در‬ ‫هم‬ ‫مجوز‬ ‫این‬ ‫‌شود‬ ‫ی‬‫م‬ ‫داده‬ ‫خاص‬ ‫شرایط‬ ‫در‬ ‫و‬ ‫فایل‬ . ‫شما‬ ‫اگر‬ ‫یعنی‬ ‫اجرا‬ ‫مجوز‬ ‫آن‬ ‫به‬ ‫شما‬ ‫توسط‬ ‫تا‬ ‫شود‬ ‫دانلود‬ ‫اتوماتیک‬ ‫دالیلی‬ ‫به‬ ‫فایل‬ ‫این‬ ‫یا‬ ‫کنید‬ ‫دانلود‬ ‫اینترنت‬ ‫از‬ ‫را‬ ‫اجرایی‬ ‫فایل‬ ‫‌گیرد‬ ‫ی‬‫نم‬ ‫اختیار‬ ‫در‬ ‫را‬ ‫سیستم‬ ‫منابع‬ ‫نشود‬ ‫داده‬ . ‫پایین‬ ‫‌ی‬ ‫ه‬‫هزین‬ ‫انتشار‬ ‫مجوز‬ ‫از‬ ‫لینوکس‬ ‫‌ی‬ ‫ه‬‫استفاد‬ ‫دلیل‬ ‫به‬ ‫هم‬ ‫باز‬ GPL ‫‌آید‬ ‫ی‬‫م‬ ‫پایین‬ ‫بسیار‬ ‫‌عامل‬ ‫م‬‫سیست‬ ‫نهایی‬ ‫‌ی‬ ‫ه‬‫هزین‬ . ‫زیرا‬ ‫‌است‬ ‫ه‬‫شد‬ ‫نوشته‬ ‫دنیا‬ ‫سراسر‬ ‫مردم‬ ‫طرف‬ ‫از‬ ‫و‬ ‫داوطلبانه‬ ‫صورت‬ ‫به‬ ‫آن‬ ‫کدهای‬ ‫اکثر‬ .
  • 8. ‫دبیان‬ ‫‌دهندگان‬ ‫ه‬‫توسع‬ ‫از‬ ‫یکی‬ ‫آنالیزهای‬ ‫طبق‬ ‫که‬ ‫بدانید‬ ‫است‬ ‫جالب‬ ( debian ) ‫نظر‬ ‫از‬ ‫لینوکس‬ ‫توزیع‬ ‫بزگترین‬ ‫که‬ ‫تقریبا‬ ‫دبیان‬ ‫دوباره‬ ‫تولید‬ ،‫است‬ ‫برنامه‬ ‫شمار‬ ۱۹.۱ ‫دالر‬ ‫میلیارد‬ ( ‫حدود‬ ‫چیزی‬ ‫یعنی‬ ۲۴ ‫و‬ ‫هزار‬ ۷۰۰ ‫تومان‬ ‫میلیارد‬ ) ‫لینوکس‬ ‫‌ی‬ ‫ه‬‫هست‬ ‫ارزش‬ ‫دیگری‬ ‫‌ای‬ ‫ه‬‫محاسب‬ ‫در‬ ‫و‬ ‫دارد‬ ‫بر‬ ‫در‬ ‫هزینه‬ ۳ ‫‌است‬ ‫ه‬‫شد‬ ‫زده‬ ‫تخمین‬ ‫دالر‬ ‫میلیارد‬ . ‫پذیری‬ ‫انعطاف‬ ‫انتشار‬ ‫مجوز‬ ‫این‬ ‫آورد‬ ‫حساب‬ ‫به‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫صنعت‬ ‫برای‬ ‫انقالب‬ ‫یه‬ ‫را‬ ‫گنو‬ ‫‌توان‬ ‫ی‬‫م‬ ‫حقیقتا‬ - ‫این‬ ‫آن‬ ‫از‬ ‫بهتر‬ ‫و‬ ‫فلسفه‬ - ‫بود‬ ‫هم‬ ‫موفق‬ ‫حقیقتا‬ ‫و‬ ‫آمد‬ ‫وجود‬ ‫به‬ ‫‌افزارها‬ ‫م‬‫نر‬ ‫پیشرفت‬ ‫سد‬ ‫برداشتن‬ ‫برای‬ . ‫انتشار‬ ‫مجوز‬ ‫لطف‬ ‫به‬ ‫هم‬ ‫پذیری‬ ‫انعطاف‬ ‫یعنی‬ ‫لینوکس‬ ‫ویژگی‬ ‫چهارمین‬ GPL ‫وجود‬ ‫به‬ ‫آزاد‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫تفکر‬ ‫و‬ ‫آمده‬ . ‫سازی‬ ‫آماده‬ ‫خود‬ ‫نیازهای‬ ‫برای‬ ‫را‬ ‫آن‬ ‫و‬ ‫ویرایش‬ ‫آزادانه‬ ‫را‬ ‫‌عامل‬ ‫م‬‫سیست‬ ‫این‬ ‫کدهای‬ ‫‌توان‬ ‫ی‬‫م‬ ‫مجوز‬ ‫این‬ ‫طبق‬ ‫کرد‬ . ‫ببینیم‬ ‫مختلف‬ ‫‌های‬ ‫ه‬‫دستگا‬ ‫روی‬ ‫را‬ ‫‌عامل‬ ‫م‬‫سیست‬ ‫این‬ ‫تا‬ ‫شده‬ ‫باعث‬ ‫ویژگی‬ ‫این‬ . ‫سیکلت‬ ‫موتور‬ ‫مثال‬ TTX02 ‫شرکت‬ ‫محصول‬ Mavizen ‫‌ی‬ ‫ه‬‫رایان‬ ‫با‬ ‫الکترونیک‬ ‫‌ای‬ ‫ه‬‫مسابق‬ ‫موتورسیکلت‬ ‫نخستین‬ ‫است‬ ‫داخلی‬ . ‫‌شود‬ ‫ی‬‫م‬ ‫هدایت‬ ‫لینوکس‬ ‫طرق‬ ‫از‬ ‫کامال‬ ‫سیکلت‬ ‫موتور‬ ‫این‬ . ‫شرکت‬ ‫شیردوشی‬ ‫‌های‬ ‫ه‬‫دستگا‬ ‫یا‬ DeLavel ‫‌کند‬ ‫ی‬‫م‬ ‫استفاده‬ ‫دور‬ ‫راه‬ ‫از‬ ‫کنترل‬ ‫و‬ ‫مدیریت‬ ‫برای‬ ‫لینوکس‬ ‫‌عامل‬ ‫م‬‫سیست‬ ‫از‬ . ‫پست‬ ‫سرویس‬ ‫همچنین‬ ‫‌تپد‬ ‫ی‬‫م‬ ‫لینوکسی‬ ‫‌عامل‬ ‫م‬‫سیست‬ ‫یک‬ ‫آن‬ ‫قلب‬ ‫در‬ ‫که‬ ‫بوده‬ ‫متکی‬ ‫مراسالتی‬ ‫سازی‬ ‫مرتب‬ ‫سیستم‬ ‫بر‬ ‫متحده‬ ‫ایاالت‬ . ‫ایزامو‬ ( Isamu ) ‫سال‬ ‫حوالی‬ ‫در‬ ‫که‬ ۲۰۰۱ ‫لینوکس‬ ‫‌بر‬‫مبتنی‬ ‫‌نمای‬ ‫ن‬‫انسا‬ ‫روبات‬ ‫نخستین‬ ‫عنوان‬ ‫به‬ ،‫شد‬ ‫عرضه‬ ‫‌شود‬ ‫ی‬‫م‬ ‫شناخته‬ . ‫است‬ ‫شده‬ ‫تبدیل‬ ‫‌ها‬ ‫ت‬‫روبا‬ ‫انواع‬ ‫تمام‬ ‫معمول‬ ‫بنیان‬ ‫به‬ ‫لینوکس‬ ،‫‌کنون‬ ‫ا‬‫ت‬ ‫زمان‬ ‫آن‬ ‫از‬ ‫اما‬ . ‫از‬ ‫پلئو‬ ‫به‬ ‫‌توان‬ ‫ی‬‫م‬ ‫‌ها‬ ‫ت‬‫روبا‬ ‫این‬ ‫جمله‬ ( Pleo ) ‫کاتانا‬ ‫روباتیک‬ ‫بازوی‬ ‫و‬ ‫‌متحرک‬ ‫ی‬‫‌باز‬ ‫ب‬‫اسبا‬ ‫دایناسور‬ ( Katana Robotic Arm ) ‫نورونیکز‬ ‫توسط‬ ‫که‬ ( Neuronics ) ‫کرد‬ ‫اشاره‬ ،‫است‬ ‫شده‬ ‫ساخته‬ ‫صنعتی‬ ‫کاربردهای‬ ‫برای‬ . ‫دارد‬ ‫حضور‬ ‫هم‬ ‫راهنما‬ ‫‌های‬ ‫غ‬‫چرا‬ ‫در‬ ‫حتی‬ ‫‌عامل‬ ‫م‬‫سیست‬ ‫این‬ ‫نهایت‬ ‫در‬ ‫و‬ . ‫ترافیک‬ ‫پیک‬ ( Peek Traffic ) ‫نظیر‬ ‫‌هایی‬ ‫ن‬‫مکا‬ ‫در‬ ‫را‬ ‫ترافیک‬ ‫کنترل‬ ‫که‬ ‫‌کند‬ ‫ی‬‫م‬ ‫تولید‬ ‫را‬ ‫لینوکس‬ ‫بر‬ ‫مبتنی‬ ‫راهنمایی‬ ‫‌های‬ ‫غ‬‫چرا‬ ‫از‬ ‫‌ای‬ ‫ه‬‫مجموع‬ ‫بزرگراه‬ ‫حتی‬ ‫و‬ ‫نیویورک‬ ،‫آیوا‬ ۱۰۱ ‫دارند‬ ‫عهده‬ ‫بر‬ ‫‌آنجلس‬ ‫س‬‫ل‬ ‫در‬ . ‫‌عامل‬ ‫م‬‫سیست‬ ‫کدهای‬ ‫از‬ ‫اطالع‬ ‫دارید‬ ‫خبر‬ ‫خود‬ ‫‌عامل‬ ‫م‬‫سیست‬ ‫رازهای‬ ‫و‬ ‫رمز‬ ‫تمام‬ ‫از‬ ‫شما‬ ‫که‬ ‫است‬ ‫این‬ ‫‌سورس‬ ‫ن‬‫اپ‬ ‫‌افزارهای‬ ‫م‬‫نر‬ ‫‌های‬ ‫ی‬‫ویژگ‬ ‫از‬ ‫یکی‬ . ‫نام‬ ‫به‬ ‫‌ای‬ ‫ه‬‫برنام‬ ‫شناسایی‬ ‫باعث‬ ‫ویژگی‬ ‫همین‬ ‫مثال‬ carrier IQ ‫‌های‬ ‫ن‬‫تلف‬ ‫کاربران‬ ‫از‬ ‫زیادی‬ ‫اطالعات‬ ‫که‬ ‫شد‬ ‫‌کرد‬ ‫ی‬‫م‬ ‫ارسال‬ ‫معلومی‬ ‫نا‬ ‫جای‬ ‫به‬ ‫و‬ ‫ذخیره‬ ‫را‬ ‫همراه‬ . ‫کنیم‬ ‫بررسی‬ ‫را‬ ‫تر‬ ‫افتاده‬ ‫پا‬ ‫پیش‬ ‫‌های‬ ‫ی‬‫ویژگ‬ ‫هم‬ ‫کمی‬ ‫‌توانیم‬ ‫ی‬‫م‬ ‫بگذریم‬ ‫کلیدی‬ ‫و‬ ‫اصلی‬ ‫‌های‬ ‫ی‬‫ویژگ‬ ‫این‬ ‫از‬ ‫اگر‬ ‫اما‬ ‫‌آید‬ ‫ی‬‫م‬ ‫چشم‬ ‫به‬ ‫بیشتر‬ ‫دسکتاپ‬ ‫‌ی‬ ‫ه‬‫نسخ‬ ‫در‬ ‫که‬ .
  • 9. ‫نصب‬ ‫از‬ ‫بعد‬ ‫آماده‬ ‫‌ی‬ ‫ه‬‫برنام‬ ‫صدها‬ ‫شما‬ ‫نیاز‬ ‫که‬ ‫‌شوند‬ ‫ی‬‫م‬ ‫نصب‬ ‫دیگر‬ ‫درشت‬ ‫و‬ ‫ریز‬ ‫‌ی‬ ‫ه‬‫برنام‬ ‫هزاران‬ ‫با‬ ‫فرض‬ ‫پیش‬ ‫صورت‬ ‫به‬ ‫لینوکس‬ ‫‌های‬ ‫ه‬‫نسخ‬ ‫اکثر‬ ‫‌کنند‬ ‫ی‬‫م‬ ‫برطرف‬ ً‫ال‬‫کام‬ ‫را‬ . ‫‌ای‬ ‫ه‬‫مجموع‬ ‫خرید‬ ‫و‬ ‫یافتن‬ ‫نیست‬ ‫الزم‬ ‫دیگر‬ ‫توزیع‬ ‫هر‬ ‫نصب‬ ‫از‬ ‫بعد‬ ‫شما‬ ‫همین‬ ‫برای‬ ‫بدهید‬ ‫خود‬ ‫به‬ ‫‌افزاری‬ ‫م‬‫نر‬ . ‫است‬ ‫استفاده‬ ‫‌ی‬ ‫ه‬‫آماد‬ ‫چیز‬ ‫همه‬ ‫یافتن‬ ‫برای‬ . ‫کلیک‬ ‫یک‬ ‫با‬ ‫نصب‬ ‫خود‬ ‫‌ی‬ ‫ه‬‫رایان‬ ‫پشت‬ ‫از‬ ‫نیست‬ ‫الزم‬ ‫حتی‬ ‫نیست‬ ‫نگرانی‬ ‫جای‬ ‫داشتید‬ ‫نیاز‬ ‫‌ای‬ ‫ه‬‫برنام‬ ‫به‬ ‫هم‬ ‫باز‬ ‫نصب‬ ‫از‬ ‫بعد‬ ‫اگر‬ ‫حتی‬ ‫بخورید‬ ‫تکان‬ . ‫و‬ ‫نصب‬ ‫کار‬ ‫دارند‬ ‫قرار‬ ‫لینوکس‬ ‫مختلف‬ ‫‌های‬ ‫ع‬‫توزی‬ ‫در‬ ‫که‬ ‫‌هایی‬ ‫ه‬‫بست‬ ‫مدیریت‬ ‫یا‬ ‫نصاب‬ ‫‌های‬ ‫ه‬‫برنام‬ ‫‌دهند‬ ‫ی‬‫م‬ ‫انجام‬ ‫کاربر‬ ‫برای‬ ‫سادگی‬ ‫به‬ ‫را‬ ‫بروزرسانی‬ . ‫متفاوت‬ ‫و‬ ‫سریع‬ ‫رسانی‬ ‫روز‬ ‫به‬ ‫‌ی‬ ‫ه‬‫آماد‬ ‫آن‬ ‫‌ی‬ ‫ه‬‫شد‬ ‫اصالح‬ ‫‌ی‬ ‫ه‬‫نسخ‬ ‫بعد‬ ‫روز‬ ‫چند‬ ‫بشود‬ ‫کشف‬ ‫باگی‬ ‫که‬ ‫هنگامی‬ ‫لینوکس‬ ‫عامل‬ ‫سیستم‬ ‫در‬ ‫است‬ ‫کاربران‬ ‫‌ی‬ ‫ه‬‫استفاد‬ . ،‫آپدیت‬ ‫افزار‬ ‫نرم‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫که‬ ‫است‬ ‫یکپارچه‬ ‫طوری‬ ‫لینوکس‬ ‫سیستم‬ ‫اینکه‬ ‫ضمن‬ ‫دارید‬ ‫را‬ ‫ها‬ ‫برنامه‬ ‫اکثر‬ ‫رسانی‬ ‫بروز‬ ‫قدرت‬ ‫شما‬ . ‫برنامه‬ ‫و‬ ‫عامل‬ ‫سیستم‬ ‫اشکاالت‬ ‫به‬ ‫محدود‬ ‫تنها‬ ‫ویندوز‬ ‫در‬ ‫این‬ ‫آن‬ ‫به‬ ‫وابسته‬ ‫های‬ ( …‫و‬ ‫اکسپلورر‬ ،‫پلیر‬ ‫مدیا‬ ‫مثل‬ ) ‫است‬ . ‫های‬ ‫ویژگی‬ ‫امنیتی‬ ‫های‬ ‫آپدیت‬ ‫بر‬ ‫عالوه‬ ‫لینوکس‬ ‫در‬ ‫باشد‬ ‫گرفته‬ ‫قرار‬ ‫بروزرسانی‬ ‫یک‬ ‫در‬ ‫است‬ ‫ممکن‬ ‫نیز‬ ‫جدیدی‬ . ‫نیست‬ ‫پوشیده‬ ‫شما‬ ‫بر‬ ‫چیز‬ ‫هیچ‬ ‫لینوکس‬ ‫در‬ . ‫‌های‬ ‫ه‬‫بست‬ ‫تمامی‬ ‫حجم‬ ‫و‬ ‫توضیحات‬ ،‫نام‬ ،‫رسانی‬ ‫روز‬ ‫به‬ ‫‌ی‬ ‫ه‬‫برنام‬ ‫ببینید‬ ‫را‬ ‫روزرسانی‬ ‫به‬ ‫فرآیند‬ ‫ذره‬ ‫ذره‬ ‫‌توانید‬ ‫ی‬‫م‬ ‫شما‬ ‫و‬ ‫‌گذارد‬ ‫ی‬‫م‬ ‫شما‬ ‫اختیار‬ ‫در‬ ‫را‬ ‫شده‬ ‫‌روز‬ ‫ه‬‫ب‬ . ‫سریع‬ ‫پیشرفت‬ ‫‌دهد‬ ‫ی‬‫م‬ ‫روی‬ ‫آزاد‬ ‫دنیای‬ ‫در‬ ‫نویی‬ ‫اتفاق‬ ‫روز‬ ‫هر‬ ‫آزاد‬ ‫‌افزارهای‬ ‫م‬‫نر‬ ‫‌ی‬ ‫ه‬‫فلسف‬ ‫و‬ ‫استالمن‬ ‫ریچارد‬ ‫لطف‬ ‫به‬ . ‫همین‬ ‫به‬ ‫هستند‬ ‫شدن‬ ‫کامل‬ ‫حال‬ ‫در‬ ‫روز‬ ‫هر‬ ‫سورس‬ ‫اپن‬ ‫‌های‬ ‫ه‬‫برنام‬ ‫علت‬ . ‫سرعت‬ ‫لینوکسی‬ ‫نویسان‬ ‫برنامه‬ ‫تعدد‬ ‫طرفی‬ ‫از‬ ‫‌است‬ ‫ه‬‫کرد‬ ‫بیشتر‬ ‫را‬ ‫پیشرفت‬ ‫این‬ . ‫درایورها‬ ‫نصب‬ ‫دهید‬ ‫انجام‬ ‫کاری‬ ‫هیچ‬ ‫نیست‬ ‫الزم‬ ‫درایورها‬ ‫اکثر‬ ‫نصب‬ ‫برای‬ ‫لینوکس‬ ‫در‬ . ‫معروف‬ ‫قطعات‬ ‫با‬ ‫رایانه‬ ‫یک‬ ‫از‬ ‫اگر‬ ‫‌کند‬ ‫ی‬‫م‬ ‫اندازی‬ ‫راه‬ ‫و‬ ‫کرده‬ ‫شناسایی‬ ‫را‬ ‫قطعات‬ ‫خودکار‬ ‫صورت‬ ‫به‬ ‫لینوکس‬ ‫‌ی‬ ‫ه‬‫هست‬ ‫‌کنید‬ ‫ی‬‫م‬ ‫استفاده‬ . ‫به‬ ‫احتیاج‬ ‫‌ها‬ ‫ه‬‫رایان‬ ‫بعضی‬ ‫در‬ ‫است‬ ‫ممکن‬ ‫که‬ ‫هستند‬ ‫قطعاتی‬ ‫تنها‬ ‫گرافیک‬ ‫‌های‬ ‫ت‬‫کار‬ ‫و‬ ‫وایرلس‬ ‫‌های‬ ‫م‬‫مود‬ ‫باشند‬ ‫داشته‬ ‫‌انداز‬ ‫ه‬‫را‬ .
  • 10. ‫‌العاده‬ ‫ق‬‫فو‬ ‫‌های‬ ‫ت‬‫افک‬ ‫و‬ ‫زیبایی‬ ‫گنو‬ ‫‌های‬ ‫ع‬‫توزی‬ ‫اینکه‬ ‫در‬ / ‫نکنید‬ ‫شک‬ ‫است‬ ‫‌تر‬ ‫ن‬‫‌ر‬ ‫د‬‫م‬ ‫و‬ ‫زیباتر‬ ‫بسیار‬ ‫ماکروسافت‬ ‌ ‫ل‬‫‌عام‬ ‫م‬‫سیست‬ ‫از‬ ‫لینوکس‬ . ‫به‬ ‫‌های‬ ‌ ‫ه‬‫پنجر‬ ‫مدیر‬ ‫‌ی‬ ‫ه‬‫وسیل‬ compiz ‫یا‬ Kwin ‫بدهید‬ ‫خود‬ ‫دسکتاپ‬ ‫به‬ ‫مختلف‬ ‫افکت‬ ‫دهها‬ ‫‌توانید‬ ‫ی‬‫م‬ . ‫همچنین‬ ‫زیبایی‬ KDE ‫سادگی‬ ‫و‬ Gnome ‫است‬ ‫‌زد‬ ‫ن‬‫زبا‬ ‫لینوکس‬ ‫دنیای‬ ‫در‬ . ‫سلیقه‬ ‫هر‬ ‫برای‬ ‫‌هایی‬ ‫ع‬‫توزی‬ ‫دارد‬ ‫وجود‬ ‫لینوکس‬ ‫قدرتمند‬ ‫‌عامل‬ ‫م‬‫سیست‬ ‫از‬ ‫متفاوت‬ ‫توزیع‬ ‫هزاران‬ ‫امروزه‬ . ‫‌های‬ ‫ع‬‫توزی‬ ‫به‬ ‫‌توان‬ ‫ی‬‫م‬ ‫میان‬ ‫این‬ ‫از‬ ،‫فیزیک‬ ،‫شیمی‬ ‫مثل‬ ‫دانشگاهی‬ ‫‌های‬ ‫ه‬‫رشت‬ ‫مخصوص‬ ‫‌هایی‬ ‫ع‬‫توزی‬ ‫و‬ ‫بازی‬ ‫مخصوص‬ ‫‌هایی‬ ‫ع‬‫توزی‬ ‫تا‬ ‫‌شده‬ ‫ی‬‫اسالم‬ ‫کرد‬ ‫اشاره‬ ،‫‌اند‬ ‫ه‬‫کرد‬ ‫‌آوری‬ ‫ع‬‫جم‬ ‫خود‬ ‫در‬ ‫را‬ ‫رشته‬ ‫مخصوص‬ ‫کاربردی‬ ‫‌ی‬ ‫ه‬‫برنام‬ ‫‌ها‬ ‫ه‬‫د‬ ‫که‬ …‫و‬ ‫برق‬ ،‫ریاضی‬ . ‫فرمان‬ ‫خط‬ ‫توسط‬ ‫جادویی‬ ‫کنترل‬ ‫ترمینال‬ ‫از‬ ‫کنند‬ ‫استفاده‬ ‫لینوکس‬ ‫‌عامل‬ ‫م‬‫سیست‬ ‫از‬ ‫‌اند‬ ‫ه‬‫گرفت‬ ‫تصمیم‬ ‫تازگی‬ ‫به‬ ‫که‬ ‫بسیاری‬ ( ‫شبیه‬ ‫محیطی‬ command prompt ‫آن‬ ‫برابر‬ ‫چند‬ ‫قدرتی‬ ‫با‬ ‫ویندوز‬ ‫در‬ ) ‫خود‬ ‫برای‬ ‫لینوکس‬ ‫ترمینال‬ ‫بدانید‬ ‫است‬ ‫بهتر‬ ‫اما‬ ،‫گریزانند‬ ‫دارد‬ ‫جدا‬ ‫دنیایی‬ . ‫مشتتان‬ ‫در‬ ‫لینوکس‬ ‫حقیقت‬ ‫در‬ ‫و‬ ‫دهید‬ ‫انجام‬ ‫‌خواهید‬ ‫ی‬‫م‬ ‫کاری‬ ‫هر‬ ‫ترمینال‬ ‫با‬ ‫‌توانید‬ ‫ی‬‫م‬ ‫شما‬ ‫است‬ . ‫‌ها‬ ‫ت‬‫مد‬ ‫برای‬ ‫‌تواند‬ ‫ی‬‫م‬ ‫‌آید‬ ‫ی‬‫م‬ ‫دست‬ ‫به‬ ‫اینترنت‬ ‫در‬ ‫جستجو‬ ‫با‬ ‫مواقع‬ ‫اکثر‬ ‫که‬ ‫ترمینال‬ ‫دستورات‬ ‫فهمیدن‬ ‫کند‬ ‫سرگرم‬ ‫را‬ ‫شما‬ . ‫از‬ ‫کامال‬ ‫امنیت‬ ‫بردن‬ ‫باال‬ ‫منظور‬ ‫به‬ ‫شبکه‬ ‫برای‬ ‫لینوکس‬ ‫از‬ ‫استفاده‬ ‫که‬ ‫بدانید‬ ‫نیست‬ ‫بد‬ ‫‌گیرد‬ ‫ی‬‫م‬ ‫صورت‬ ‫فرمان‬ ‫خط‬ ‫و‬ ‫ترمینال‬ . ‫رایگان‬ ‫دانلود‬ ‫دانلود‬ ‫توزیع‬ ‫آن‬ ‫اینترنتی‬ ‫پایگاه‬ ‫از‬ ‫رایگان‬ ‫و‬ ‫راحتی‬ ‫به‬ ‫‌توانید‬ ‫ی‬‫م‬ ‫را‬ ‫لینوکس‬ ‫‌های‬ ‫ع‬‫توزی‬ ‫اکثر‬ ‫از‬ ‫جدیدی‬ ‫‌ی‬ ‫ه‬‫نسخ‬ ‫هر‬ ‫کنید‬ . ‫‌شود‬ ‫ی‬‫م‬ ‫برداشته‬ ‫شما‬ ‫دوش‬ ‫از‬ ‫هم‬ ‫آن‬ ‫خرید‬ ‫زحمت‬ ‫پس‬ . ‫نیز‬ ‫آزاد‬ ‫‌های‬ ‫ر‬‫‌افزا‬ ‫م‬‫نر‬ ‫اکثر‬ ‫‌ی‬ ‫ه‬‫دربار‬ ‫ویژگی‬ ‫این‬ ‫‌کند‬ ‫ی‬‫م‬ ‫صدق‬ . ‫برای‬ ‫‌باز‬ ‫ن‬‫مت‬ ‫‌افزارهای‬ ‫م‬‫نر‬ ‫دهنگان‬ ‫توسعه‬ ‫چون‬ ‫که‬ ‫نیست‬ ‫معنی‬ ‫این‬ ‫به‬ ‫بودن‬ ‫رایگان‬ ‫این‬ ‫البته‬ ‫‌دهند‬ ‫ی‬‫م‬ ‫ارائه‬ ‫را‬ ‫‌تری‬ ‫ف‬‫ضعی‬ ‫محصول‬ ‫پس‬ ‫‌کنند‬ ‫ی‬‫نم‬ ‫دریافت‬ ‫پولی‬ ‫کدهایشان‬ . ‫متن‬ ‫مدل‬ ‫در‬ ‫کسب‬ ‫شیوه‬ ‫اصوال‬ ‫است‬ ‫متفاوت‬ ‫باز‬ . ‫‌آورند‬ ‫ی‬‫م‬ ‫دست‬ ‫به‬ ‫زیر‬ ‫‌های‬ ‫ه‬‫شیو‬ ‫به‬ ‫را‬ ‫خود‬ ‫‌های‬ ‫ه‬‫سرمای‬ ‫معموال‬ ‫‌باز‬ ‫ن‬‫مت‬ ‫‌افزارهای‬ ‫م‬‫نر‬ . • ‫پشتیبانی‬ ‫‌های‬ ‫س‬‫سروی‬ ‫‌ی‬ ‫ه‬‫ارائ‬ ( ‫اوبونتو‬ ‫برای‬ ‫کانونیکال‬ ‫مانند‬ ) • ‫الیسنس‬ ‫دو‬ ‫با‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫انتشار‬ ( ‫مانند‬ sun ‫‌کرد‬ ‫ی‬‫م‬ ‫منتشر‬ ‫پولی‬ ‫را‬ ‫آفیس‬ ‫استار‬ ‫و‬ ‫رایگان‬ ‫را‬ ‫آفیس‬ ‫اپن‬ ‫که‬ ) • ‫اجرایی‬ ‫فایل‬ ‫پولی‬ ‫انتشار‬ ‫و‬ ‫برنامه‬ ‫کد‬ ‫رایگان‬ ‫انتشار‬ • ‫قبلی‬ ‫‌های‬ ‫ه‬‫نسخ‬ ‫و‬ ‫برنامه‬ ‫اصل‬ ‫بودن‬ ‫‌باز‬ ‫ن‬‫مت‬ ‫و‬ ‫برنامه‬ ‫‌ی‬ ‫ه‬‫نسخ‬ ‫آخرین‬ ‫فروش‬ • ‫گوناگون‬ ‫‌های‬ ‫د‬‫نها‬ ‫برای‬ ‫برنامه‬ ‫سازی‬ ‫شخصی‬ ‫و‬ ‫‌تر‬ ‫ی‬‫اضاف‬ ‫امکانات‬ ‫بابت‬ ‫پول‬ ‫دریافت‬
  • 11. • ‫داوطلبانه‬ ‫‌های‬ ‫ک‬‫کم‬ ‫یا‬ ‫کردن‬ ‫دونیت‬ ‫طریق‬ ‫از‬ • ‫‌ها‬ ‫ت‬‫شرک‬ ‫سایر‬ ‫با‬ ‫همکاری‬ ‫طریق‬ ‫از‬ ( ‫‌های‬ ‫ت‬‫شرک‬ ‫جستجوی‬ ‫موتورهای‬ ‫دادن‬ ‫قرار‬ ‫با‬ ‫که‬ ‫موزیال‬ ‫بنیاد‬ ‫مانند‬ ‫فایرفاکس‬ ‫در‬ ‫دیگر‬ ) ‫سازی‬ ‫بومی‬ ‫شود‬ ‫همسان‬ ‫ملت‬ ‫یک‬ ‫فرهنگ‬ ‫با‬ ‫کامال‬ ‫‌تواند‬ ‫ی‬‫م‬ ‫لینوکس‬ . ‫مختلف‬ ‫‌های‬ ‫ن‬‫زبا‬ ‫برای‬ ‫‌عامل‬ ‫م‬‫سیست‬ ‫این‬ ‫اهمیتی‬ ‫در‬ ‫فارسی‬ ‫تقویم‬ ‫‌سازی‬ ‫ه‬‫پیاد‬ ‫یا‬ ‫و‬ ‫‌فرض‬ ‫ش‬‫پی‬ ‫صورت‬ ‫به‬ ‫فارسی‬ ‫استاندارد‬ ‫کیبورد‬ ‫از‬ ‫بشتیبانی‬ ‫مانند‬ ‫است‬ ‫قائل‬ KDE ‫مانند‬ ‫مهم‬ ‫‌افزارهای‬ ‫م‬‫نر‬ ‫از‬ ‫بسیاری‬ ‫شدن‬ ‫ترجمه‬ ‫یا‬ libreoffice , gimp ‫و‬ .. ‫مناسب‬ ‫بستر‬ ‫یک‬ ‫به‬ ‫را‬ ‫لینوکس‬ ‫کشورها‬ ‫سایر‬ ‫برخالف‬ ‫ایران‬ ‫در‬ ‫متاسفانه‬ ‫که‬ ‫‌است‬ ‫ه‬‫کرد‬ ‫تبدیل‬ ‫ملی‬ ‫عامل‬ ‫سیستم‬ ‫یک‬ ‫داشتن‬ ‫برای‬ ( ‫حتی‬ ‫آفریقایی‬ ‫کشورهای‬ ) ‫‌است‬ ‫ه‬‫شد‬ ‫داده‬ ‫اهمیت‬ ‫کمتر‬ ‫موضوع‬ ‫این‬ ‫به‬ .
  • 12. ‫لینوکس‬ ‫و‬ ‫گنو‬ ‫تاریخچه‬ ‫گنو‬ .‫‌باشد‬ ‫ی‬‫م‬ ‫سازگار‬ ‫یونیکس‬ ‫با‬ ‫‌ای‬ ‫ه‬‫فزایند‬ ‫طــور‬ ‫به‬ ‫کــه‬ ‫بــوده‬ ‫آزاد‬ ‫کامال‬ ‫عامل‬ ‫سیــستم‬ ‫یک‬ ‫گنو‬ ‫عامل‬ ‫سیستم‬ “ ‫مخفف‬ GNU’s Not Unix ‫سپتامبر‬ ‫در‬ ‫را‬ ‫گنو‬ ‫پروژه‬ ‫اولیه‬ ‫اطالعیه‬ ‫استالمن‬ ‫ریچارد‬ .‫است‬ ” ۱۹۸۳ .‫کرد‬ ‫منتشر‬ ‫سپتامبر‬ ‫در‬ ‫گنو‬ ‫اعالمیه‬ ‫نام‬ ‫به‬ ‫آن‬ ‫‌تر‬ ‫ل‬‫کام‬ ‫نسخه‬ ۱۹۸۵ .‫است‬ ‫شده‬ ‫ترجمه‬ ‫زبان‬ ‫چندین‬ ‫به‬ ‫که‬ ‫شد‬ ‫منتشر‬ ‫مخفف‬ ‫یک‬ ،‫نخست‬ ‫‌کند؛‬ ‫ی‬‫م‬ ‫بــرطــرف‬ ‫را‬ ‫نیــازها‬ ‫از‬ ‫تعدادی‬ ‫که‬ ‫است‬ ‫شده‬ ‫انتخاب‬ ‫علت‬ ‫این‬ ‫به‬ »‫«گنو‬ ‫نام‬ “ ‫برای‬ ‫بازگشتی‬ GNU’s Not Unix ‫جالب‬ ‫آن‬ )‫خواندن‬ ‫(یا‬ ‫گفتن‬ ‫آهنگ‬ ،‫سوم‬ ،‫است‬ ‫واقعی‬ ‫کلمه‬ ‫یک‬ ،‫دوم‬ ،‫است‬ ” .‫است‬ ‫ممکن‬ ‫آزاد‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫آوردن‬ ‫دست‬ ‫به‬ ‫برای‬ ‫شما‬ .‫قیمت‬ ‫نه‬ ،‫‌کند‬ ‫ی‬‫م‬ ‫اشاره‬ ‫آزادی‬ ‫به‬ »‫آزاد‬ ‫‌افزار‬ ‫م‬‫«نر‬ ‫در‬ »‫«آزاد‬ ‫کلمه‬ ‫ویــژه‬ ‫آزادی‬ ‫ســه‬ ،‫باشید‬ ‫داشتــه‬ ‫اختیار‬ ‫در‬ ‫را‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫وقتـی‬ ،‫صورت‬ ‫هر‬ ‫در‬ .‫نپردازید‬ ‫یا‬ ‫بپردازید‬ ‫مبلغی‬ ‫است‬ ‫و‬ ‫دوستان‬ ‫به‬ ‫آن‬ ‫دادن‬ ‫هدیه‬ ‫و‬ ‫برنامه‬ ‫از‬ ‫برداری‬ ‫نسخه‬ ‫برای‬ ‫آزادی‬ ،‫نخست‬ .‫داشت‬ ‫خواهید‬ ‫آن‬ ‫از‬ ‫استفاده‬ ‫برای‬ ‫کدهای‬ ‫به‬ ‫کامل‬ ‫دسترسی‬ ‫داشتن‬ ‫با‬ ،‫دلخواه‬ ‫طور‬ ‫به‬ ‫برنامه‬ ‫در‬ ‫تغییرات‬ ‫اعمال‬ ‫بــرای‬ ‫آزادی‬ ،‫دوم‬ ‫همــکاران؛‬ ‫را‬ ‫گنو‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫مجددا‬ ‫(اگر‬ .‫جامعه‬ ‫ساخت‬ ‫به‬ ‫کمک‬ ‫نهایت‬ ‫در‬ ‫و‬ ‫یافته‬ ‫بهبود‬ ‫نسخه‬ ‫توزیع‬ ‫برای‬ ‫آزادی‬ ،‫سوم‬ ‫منبع؛‬ ‫رایگان‬ ‫طور‬ ‫به‬ ‫را‬ ‫آنها‬ ‫یا‬ ‫و‬ ‫کنید‬ ‫دریافت‬ ‫را‬ ‫مبلغی‬ ‫نسخه‬ ‫یک‬ ‫انتقال‬ ‫فیزیکی‬ ‫کار‬ ‫بــرای‬ ‫‌تــوانـید‬ ‫ی‬‫م‬ ،‫نمایید‬ ‫توزیع‬ .)‫کنید‬ ‫هدیه‬ ‫ســال‬ ‫در‬ .‫‌شود‬ ‫ی‬‫م‬ ‫نامیده‬ «‫گنو‬ ‫»پروژه‬ ،‫گنو‬ ‫سیستم‬ ‫توسعه‬ ‫پروژه‬ ۱۹۸۳ ‫برای‬ ‫راهی‬ ‫عنوان‬ ‫به‬ ‫گنــو‬ ‫پــروژه‬ ‫با‬ ‫تا‬ ‫شد‬ ‫ایجاد‬ ‫داشـت‬ ‫وجــود‬ ‫کامپیــوتر‬ ‫کاربران‬ ‫جامعه‬ ‫بین‬ ‫در‬ ‫نخست‬ ‫روزهای‬ ‫در‬ ‫که‬ ‫همکاری‬ ‫روح‬ ‫بازگرداندن‬ ‫ممکن‬ ‫را‬ ‫همکاری‬ ‫دیگر‬ ‫بار‬ ‫یک‬ ،‫بودند‬ ‫شده‬ ‫تحمیل‬ ‫انحصاری‬ ‫‌افزارهای‬ ‫م‬‫نر‬ ‫صاحبان‬ ‫توسط‬ ‫که‬ ‫موانع‬ ‫بردن‬ ‫بین‬ ‫از‬ .‫سازد‬ ‫سال‬ ‫در‬ ۱۹۷۱ ‫دانشگاه‬ ‫در‬ ‫را‬ ‫خود‬ ‫کار‬ ‫استالمن‬ ‫ریچارد‬ ‫که‬ ‫هنگامی‬ MIT ‫از‬ ‫منحصرا‬ ‫کــه‬ ‫گــروهی‬ ‫در‬ ،‫کرد‬ ‫آغاز‬ ‫توزیع‬ ‫آزاد‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫اغلب‬ ‫نیز‬ ‫کامپیوتری‬ ‫‌های‬ ‫ت‬‫شرک‬ ‫حتی‬ .‫پرداخت‬ ‫کار‬ ‫به‬ ‫‌کردند‬ ‫ی‬‫م‬ ‫استفاده‬ ‫آزاد‬ ‫‌افزار‬ ‫م‬‫نر‬ .‫‌دادند‬ ‫ی‬‫م‬ ‫انجام‬ ‫را‬ ‫کار‬ ‫همین‬ ‫نیز‬ ‫اغلب‬ ‫و‬ ‫بودند‬ ‫آزاد‬ ‫یکدیگر‬ ‫با‬ ‫همکاری‬ ‫در‬ ‫‌نویسان‬ ‫ه‬‫بــرنام‬ .‫‌کــردند‬ ‫ی‬‫م‬ ‫دهه‬ ‫در‬ ۱۹۸۰ ‫همکاری‬ ‫آنها‬ ‫مالکان‬ ‫و‬ ‫داشتند‬ ‫مالک‬ ‫که‬ ‫معنی‬ ‫این‬ ‫بــه‬ ،‫بودند‬ ‫انحصاری‬ ‫‌افزارها‬ ‫م‬‫نر‬ ‫تمام‬ ‫تقریبا‬ .‫‌کرد‬ ‫ی‬‫م‬ ‫ایجاب‬ ‫را‬ ‫گنو‬ ‫پروژه‬ ‫ضرورت‬ ‫کار‬ ‫این‬ ‫که‬ ‫‌کردند‬ ‫ی‬‫م‬ ‫منع‬ ‫را‬ ‫کاربزان‬ ‫توسط‬ ،‫بــاشـد‬ ‫نـداشـته‬ ‫وجــود‬ ‫آزادی‬ ‫عامل‬ ‫سـیـستم‬ ‫اگــر‬ ‫دارند؛‬ ‫نیــاز‬ ‫عامل‬ ‫سیستم‬ ‫یــک‬ ‫به‬ ‫کامپیوتر‬ ‫کاربران‬ ‫تمام‬ ‫اولیــن‬ ‫بنــابــراین‬ .‫کنید‬ ‫شروع‬ ‫را‬ ‫کامپیوتر‬ ‫با‬ ‫کار‬ ‫انحصاری‬ ‫‌افزارهای‬ ‫م‬‫نر‬ ‫از‬ ‫استفاده‬ ‫بدون‬ ‫‌توانید‬ ‫ی‬‫نم‬ ‫حتی‬ ‫شـما‬ .‫است‬ ‫آزاد‬ ‫عامل‬ ‫سیستم‬ ‫یک‬ ‫وجود‬ ،‫آزاد‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫در‬ ‫ضرورت‬
  • 13. ‫قبال‬ ‫آن‬ ‫کلی‬ ‫طــراحی‬ ‫زیرا‬ ‫بساند‬ ‫یونیکس‬ ‫با‬ ‫منطبق‬ ‫عاملی‬ ‫سیستم‬ ‫تا‬ ‫گرفتند‬ ‫تصمیم‬ ‫آزاد‬ ‫افزاری‬ ‫نرم‬ ‫جنبش‬ .‫‌کرد‬ ‫ی‬‫م‬ ‫آسان‬ ‫را‬ ‫گنو‬ ‫به‬ ‫یونیکس‬ ‫کاربران‬ ‫حرکت‬ ‫سازگاری‬ ‫این‬ ‫همچنین‬ ‫و‬ ،‫بود‬ ‫انتقال‬ ‫قابل‬ ‫و‬ ‫خورده‬ ‫محک‬ ،‫ویــرایشــگـرها‬ ،‫کامپــایـلرها‬ ‫شــامــل‬ ‫و‬ ‫اســت؛‬ ‫هسته‬ ‫یک‬ ‫از‬ ‫بیشتر‬ ‫خیلی‬ ‫یونیکس‬ ‫شبه‬ ‫عامل‬ ‫سیستم‬ ‫یک‬ ‫سیستم‬ ‫یک‬ ‫نوشتن‬ ‫بنابرایـن‬ .‫‌باشد‬ ‫ی‬‫م‬ ‫دیگر‬ ‫چیزهای‬ ‫خیلی‬ ‫و‬ ‫پستی‬ ‫‌افزارهای‬ ‫م‬‫نر‬ ،‫متن‬ ‫‌بندی‬ ‫ب‬‫قال‬ ‫‌های‬ ‫ه‬‫برنام‬ ‫ژانویه‬ ‫در‬ .‫است‬ ‫بزرگی‬ ‫بسیار‬ ‫کار‬ ‫کامل‬ ‫عامل‬ ۱۹۸۴ ‫آزاد‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫بنیاد‬ .‫انجامید‬ ‫طول‬ ‫به‬ ‫سالها‬ ‫کردند‬ ‫کار‬ ‫به‬ ‫شروع‬ ‫اکتبر‬ ‫در‬ ۱۹۸۵ .‫شد‬ ‫تاسیس‬ ‫گنو‬ ‫توسعه‬ ‫به‬ ‫کمک‬ ‫جهت‬ ‫سرمایه‬ ‫جذب‬ ‫برای‬ ‫بیشتر‬ ‫سال‬ ‫تا‬ ۱۹۹۰ ‫هسته‬ ‫یک‬ ،‫لینوکس‬ ‫سپس‬ . ‫یافتند‬ ‫دست‬ ‫هسته‬ ‫جــز‬ ‫بــه‬ ،‫عامل‬ ‫سیستم‬ ‫اصلی‬ ‫اجزای‬ ‫تمامی‬ ‫به‬ ‫سال‬ ‫در‬ ،‫یونیکس‬ ‫شبه‬ ۱۹۹۱ ‫ســال‬ ‫در‬ ‫و‬ ‫کرد‬ ‫پیدا‬ ‫توسعه‬ ‫تروالدز‬ ‫لینوس‬ ‫توسط‬ ۱۹۹۲ .‫شد‬ ‫آزاد‬ ‫‌افـزار‬ ‫م‬‫نــر‬ ‫یــک‬ .‫لینوکس‬/‫گنـو‬ ‫سیستم‬ :‫شد‬ ‫کــامل‬ ‫عامــل‬ ‫سیستم‬ ‫یک‬ ‫به‬ ‫منجر‬ ‫گنو‬ ‫کامل‬ ‫تقریبا‬ ‫سیستم‬ ‫با‬ ‫لینوکس‬ ‫ترکیب‬ ،‫دبیــان‬ ،‫اسلکور‬ ‫شــامــل‬ ،‫لینوکس‬/‫گنو‬ ‫‌های‬ ‫م‬‫سیست‬ ‫از‬ ‫نفر‬ ‫میلیون‬ ‫‌ها‬ ‫ه‬‫د‬ ‫‌اکنون‬ ‫م‬‫ه‬ ‫که‬ ‫‌شود‬ ‫ی‬‫م‬ ‫زده‬ ‫تخمــین‬ .‫‌کنند‬ ‫ی‬‫م‬ ‫استفاده‬ ‫غـیـره‬ ‫و‬ ‫ردهــت‬ ‫یک‬ ‫تا‬ ‫دارد‬ ‫نظر‬ ‫در‬ ‫آزاد‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫بنیاد‬ .‫است‬ ‫نشده‬ ‫محدود‬ ‫عامل‬ ‫سیستم‬ ‫یک‬ ‫به‬ ‫فقط‬ ‫گنو‬ ‫پروژه‬ ،‫حال‬ ‫این‬ ‫با‬ ‫ایــن‬ .‫باشند‬ ‫داشته‬ ‫‌خواهند‬ ‫ی‬‫م‬ ‫کاربــران‬ ‫از‬ ‫بسیاری‬ ‫که‬ ‫آنچه‬ ‫هر‬ ، ‫کند‬ ‫ایجاد‬ ‫را‬ ‫‌افزارها‬ ‫م‬‫نر‬ ‫از‬ ‫کامل‬ ‫مجموعه‬ .‫‌شود‬ ‫ی‬‫م‬ ‫نیز‬ ‫کاربردی‬ ‫‌افزارهای‬ ‫م‬‫نـر‬ ‫شــامــل‬ ‫مــوضــوع‬ ‫به‬ ‫کنند‬ ‫تهیه‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫نیز‬ ‫ندارند‬ ‫مهارت‬ ‫کامپیـوتر‬ ‫زمینه‬ ‫در‬ ‫که‬ ‫کاربرانی‬ ‫برای‬ ‫دارد‬ ‫قصد‬ ‫همچنین‬ ‫آزاد‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫بنیاد‬ ‫سیستم‬ ‫از‬ ‫استفاده‬ ‫در‬ ‫‌کار‬ ‫ه‬‫تاز‬ ‫کاربران‬ ‫به‬ ‫کمک‬ ‫منظور‬ ‫به‬ ‫گرافیکی‬ ‫کار‬ ‫میز‬ ‫یک‬ ‫آزاد‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫بنیاد‬ ‫جهت‬ ‫همین‬ .‫کرد‬ ‫ایجاد‬ ،‫گنو‬ ‫آزاد‬ ‫بازی‬ ‫تعدادی‬ .‫کند‬ ‫ایجاد‬ ‫نیز‬ ‫دیگــری‬ ‫تفریح‬ ‫ابزارهای‬ ‫و‬ ‫‌ها‬ ‫ی‬‫باز‬ ‫‌خــواهد‬ ‫ی‬‫م‬ ‫همچنین‬ ‫آزاد‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫بنیاد‬ ‫جز‬ ‫بـه‬ ،‫نـدارد‬ ‫وجــود‬ ‫محدودیتی‬ ‫هیچ‬ ‫برود؟‬ ‫پیش‬ ‫‌تواند‬ ‫ی‬‫م‬ ‫کجا‬ ‫تا‬ ‫آزاد‬ ‫‌افزار‬ ‫م‬‫نر‬ .‫است‬ ‫دسترس‬ ‫در‬ ‫‌اکنون‬ ‫م‬‫ه‬ ‫کردن‬ ‫فراهم‬ ‫نــهـایی‬ ‫هــدف‬ .‫کننــد‬ ‫منع‬ ‫کامل‬ ‫طور‬ ‫به‬ ‫را‬ ‫گنو‬ ‫‌افزار‬ ‫م‬‫نر‬ ،‫انحصاری‬ ‫سیستم‬ ‫مانند‬ ‫قوانینی‬ ‫که‬ ‫زمانی‬ ‫کردن‬ ‫مطرود‬ ‫نتیجه‬ ‫در‬ ‫و‬ ‫دهند‬ ‫انجام‬ ‫‌خواهند‬ ‫ی‬‫م‬ ‫کامپیوتر‬ ‫کاربران‬ ‫که‬ ‫کارهایی‬ ‫تمام‬ ‫انجام‬ ‫برای‬ ‫آزاد‬ ‫‌افزارهای‬ ‫م‬‫نر‬ .‫‌باشد‬ ‫ی‬‫م‬ ‫انحصاری‬ ‫‌افزارهای‬ ‫م‬‫نر‬
  • 14. ‫باز‬ ‫متن‬ ‫افزار‬ ‫نرم‬ Open Source Software ‫مقدمه‬ ‫اکوسیستم‬ ‫در‬ ‫‌گذاران‬ ‫ه‬‫سرمای‬ ‫اقتصادی‬ ‫رفتار‬ ‫بر‬ ‫که‬ ‫‌ای‬ ‫ه‬‫مالحظ‬ ‫قابل‬ ‫تأثیر‬ ‫با‬ ‫‌باز‬ ‫ن‬‫مت‬ ‫افزار‬ ‫نرم‬ ‫سعی‬ ‫‌دهنگان‬ ‫ه‬‫توسع‬ ‫تازه‬ ‫محیط‬ ‫این‬ ‫در‬ .‫است‬ ‫داده‬ ‫تغییر‬ ‫را‬ ‫بازی‬ ‫قواعد‬ ‫گذاشته‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫و‬ ‫‌کنند‬ ‫ی‬‫م‬ ‫حس‬ ‫را‬ ‫‌باز‬ ‫ن‬‫مت‬ ‫محصوالت‬ ‫تولید‬ ‫فشار‬ ‫شرکتها‬ ،‫باشند‬ ‫کد‬ ‫کننده‬ ‫اعمال‬ ‫‌کنند‬ ‫ی‬‫م‬ .‫‌کشند‬ ‫ی‬‫م‬ ‫را‬ ‫سرشاری‬ ‫سود‬ ‫انتظار‬ ‫سیستم‬ ‫فروشندگان‬
  • 15. ۱ ‫معرفی‬ . ‫اتفاق‬ ‫این‬ .‫است‬ ‫آورده‬ ‫بار‬ ‫به‬ ‫کاربران‬ ‫برای‬ ‫ارزانتر‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫از‬ ‫بیش‬ ‫چیزی‬ ‫‌باز‬ ‫ن‬‫مت‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫ظهور‬ .‫است‬ ‫کرده‬ ‫ایجاد‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫حوزه‬ ‫بازیگران‬ ‫بین‬ ‫اقتصادی‬ ‫انفعال‬ ‫و‬ ‫فعل‬ ‫در‬ ‫عمده‬ ‫تغییراتی‬ ‫زندگی‬ ‫از‬ ‫سبکی‬ ‫حتی‬ ‫یا‬ - ‫‌افزار‬ ‫م‬‫نر‬ ‫توسعه‬ ‫به‬ ‫ویژه‬ ‫نگاهی‬ ‫تجسم‬ ‫‌باز‬ ‫ن‬‫مت‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫‌ها‬ ‫ی‬‫خیل‬ ‫برای‬ ‫این‬ ‫گابریل‬ ‫ریچارد‬ ‫و‬ ‫گلدمن‬ ‫ران‬ ‫پیشنهاد‬ .‫هست‬ ‫هم‬ ‫تجاری‬ ‫تدبیر‬ ‫نوعی‬ ‫معنای‬ ‫به‬ ‫اما‬ ‫است‬ - ‫محیطی‬ ‫و‬ ‫کنند‬ ‫استفاده‬ ‫‌باز‬ ‫ن‬‫مت‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫از‬ ‫کاربرانشان‬ ‫جامعه‬ ‫رشد‬ ‫برای‬ ‫باید‬ ‫شرکتها‬ ‫که‬ ‫است‬ .‫نمایند‬ ‫ایجاد‬ ‫خدماتشان‬ ‫و‬ ‫محصوالت‬ ‫اطراف‬ ‫زنده‬ ‫احتیاجات‬ ‫با‬ ‫آن‬ ‫دادن‬ ‫تطبیق‬ ‫برای‬ ‫که‬ ‫را‬ ‫کد‬ ‫متن‬ ‫و‬ ‫است‬ ‫رایگان‬ ‫‌باز‬ ‫ن‬‫مت‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫معمول‬ ‫بطور‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫بازپخش‬ ‫اجازه‬ ‫کاربر‬ ‫به‬ ‫‌باز‬ ‫ن‬‫مت‬ ‫‌های‬ ‫ه‬‫پروان‬ ‫اغلب‬ .‫دارد‬ ‫همراه‬ ‫به‬ ‫است‬ ‫نیاز‬ ‫مورد‬ ‫کاربر‬ ‫تغییرات‬ ‫که‬ ‫زمانی‬ ‫تا‬ ‫‌دهند‬ ‫ی‬‫م‬ ‫بازپخش‬ ‫برای‬ ‫مبلغی‬ ‫دریافت‬ ‫ازای‬ ‫در‬ ‫را‬ ‫ممکن‬ ‫تغییرات‬ ‫بعالوه‬ ( ‫باشد‬ ‫دسترس‬ ‫در‬ ‫عمومی‬ ‫بصورت‬ ‫کد‬ ‫متن‬ www.opensource.org .) .‫‌دهد‬ ‫ی‬‫م‬ ‫توسعه‬ ‫جامعه‬ ‫که‬ ‫است‬ ‫‌افزاری‬ ‫م‬‫نر‬ ‫جمعی‬ ‫‌باز‬ ‫ن‬‫مت‬ .‫دارد‬ ‫وجود‬ ‫‌باز‬ ‫ن‬‫مت‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫نوع‬ ‫دو‬ ‫داوطلبان‬ ‫از‬ ‫برگزیده‬ ‫گروهی‬ ‫گاهی‬ ‫باشد‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫مالک‬ ‫حقوقی‬ ‫شخصیت‬ ‫یک‬ ‫اینکه‬ ‫بجای‬ ‫پذیرفته‬ ‫اصلی‬ ‫کد‬ ‫متن‬ ‫به‬ ‫ورود‬ ‫برای‬ ‫شده‬ ‫اعمال‬ ‫همکاریهای‬ ‫از‬ ‫یک‬ ‫کدام‬ ‫که‬ ‫‌گیرند‬ ‫ی‬‫م‬ ‫تصمیم‬ ‫یک‬ ‫نه‬ ‫و‬ ‫کد‬ ‫کنندگان‬ ‫اعمال‬ ،‫شخصی‬ ‫‌دهندگان‬ ‫ه‬‫توسع‬ .‫برود‬ ‫سو‬ ‫کدام‬ ‫به‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫و‬ ‫شوند‬ ( ‫آپاچی‬ ‫وب‬ ‫سرور‬ ‫مورد‬ ‫مانند‬ ‫‌گیرند‬ ‫ی‬‫م‬ ‫تصمیم‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫درباره‬ ‫بخصوص‬ ‫شرکت‬ httpd.apache.org .) .‫است‬ ‫آن‬ ‫‌دهنده‬ ‫ه‬‫توسع‬ ‫و‬ ‫مالک‬ ،‫سود‬ ‫پی‬ ‫در‬ ‫شخصیتی‬ ‫که‬ ‫است‬ ‫‌افزاری‬ ‫م‬‫نر‬ ‫تجاری‬ ‫‌باز‬ ‫ن‬‫مت‬ ‫اصلی‬ ‫کد‬ ‫متن‬ ‫به‬ ‫ورود‬ ‫برای‬ ‫را‬ ‫کد‬ ‫کدام‬ ‫که‬ ‫‌کند‬ ‫ی‬‫م‬ ‫تعیین‬ ‫و‬ ‫دارد‬ ‫اختیار‬ ‫در‬ ‫را‬ ‫تالیف‬ ‫حق‬ ‫شرکت‬ ‫مورد‬ ‫مانند‬ ‫دهد‬ ‫انجام‬ ‫کاری‬ ‫چه‬ ‫آینده‬ ‫در‬ ‫و‬ ‫بپذیرد‬ MySQL ‫داده‬ ‫پایگاه‬ ‫و‬ MySQL (www.mysql.com) . ‫بر‬ ‫اغلب‬ ‫جامعه‬ ‫بوسیله‬ ‫شده‬ ‫داده‬ ‫توسعه‬ ‫‌باز‬ ‫ن‬‫مت‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫اقتصاد‬ ‫درباره‬ ‫پیشین‬ ‫مطالعات‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫به‬ ‫‌آوری‬ ‫ب‬‫تعج‬ ‫فراوان‬ ‫داوطلبانه‬ ‫کار‬ ‫میزان‬ ‫آن‬ ‫در‬ ‫که‬ ‫است‬ ‫متمرکز‬ ‫کار‬ ‫نیروی‬ ‫اقتصاد‬ ‫شخصی‬ ‫لذت‬ ‫بخاطر‬ ‫‌دهندگان‬ ‫ه‬‫توسع‬ ‫که‬ ‫‌کند‬ ‫ی‬‫م‬ ‫اشاره‬ ‫ریموند‬ ‫اریک‬ .‫‌یابد‬ ‫ی‬‫م‬ ‫تخصیص‬ ‫‌باز‬ ‫ن‬‫مت‬ ‫و‬ ‫هارووی‬ ‫ارنان‬ ‫‌کنند‬ ‫ی‬‫م‬ ‫کمک‬ ‫‌باز‬ ‫ن‬‫مت‬ ‫‌های‬ ‫ه‬‫پروژ‬ ‫به‬ ‫همتایانشان‬ ‫بین‬ ‫اعتبار‬ ‫افزایش‬ ‫از‬ ‫ناشی‬
  • 16. . ‫رسیدند‬ ‫مشابهی‬ ‫نتیجه‬ ‫به‬ ‫نیز‬ ‫خود‬ ‫تجربی‬ ‫مطالعه‬ ‫در‬ ‫همکارانش‬ ‫تواناییهای‬ ‫کردن‬ ‫مستند‬ ‫برای‬ ‫‌دهندگان‬ ‫ه‬‫توسع‬ ‫که‬ ‫‌کنند‬ ‫ی‬‫م‬ ‫استدالل‬ ‫تیروله‬ ‫جین‬ ،‫لرنرو‬ ‫جاشوا‬ ‫کریم‬ ‫و‬ ‫‌کنند‬ ‫ی‬‫م‬ ‫کمک‬ ‫‌باز‬ ‫ن‬‫مت‬ ‫‌های‬ ‫ه‬‫پروژ‬ ‫به‬ ‫آتی‬ ‫کارفرمایان‬ ‫برای‬ ‫شغلی‬ ‫‌انداز‬ ‫م‬‫چش‬ ‫بهبود‬ ‫و‬ ‫فنی‬ ‫کمک‬ ‫برای‬ ‫مهمی‬ ‫ذاتی‬ ‫محرک‬ ‫کار‬ ‫از‬ ‫بردن‬ ‫لذت‬ ‫که‬ ‫‌کنند‬ ‫ی‬‫م‬ ‫گزارش‬ ‫گلف‬ ‫رابرت‬ ‫الخانیو‬ ‫‌های‬ ‫ه‬‫انگیز‬ ‫که‬ ‫‌دهد‬ ‫ی‬‫م‬ ‫نشان‬ ‫مطالعه‬ ‫این‬ ‫گرچه‬ ‫است‬ ‫‌باز‬ ‫ن‬‫مت‬ ‫‌های‬ ‫ه‬‫پروژ‬ ‫به‬ ‫‌دهندگان‬ ‫ه‬‫توسع‬ .‫‌اند‬ ‫م‬‫مه‬ ‫هم‬ ‫مالی‬ ‫چرا‬ ‫که‬ ‫‌دهد‬ ‫ی‬‫نم‬ ‫شرح‬ ‫را‬ ‫این‬ ‫اما‬ ‫است‬ ‫داوطلبانه‬ ‫کار‬ ‫برای‬ ‫توضیحات‬ ‫از‬ ‫‌ای‬ ‫ه‬‫پار‬ ‫اینها‬ ‫که‬ ‫حالی‬ ‫در‬ ‫‌باز‬ ‫ن‬‫مت‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫‌های‬ ‫ه‬‫پروژ‬ ‫به‬ ‫شرکت‬ ‫کاری‬ ‫زمان‬ ‫در‬ ‫که‬ ‫‌کنند‬ ‫ی‬‫م‬ ‫استخدام‬ ‫را‬ ‫اشخاصی‬ ‫شرکتها‬ ‫نرم‬ ‫بنیاد‬ ‫پروژه‬ ‫به‬ ‫که‬ ‫کسانی‬ ‫حقوق‬ ‫که‬ ‫دریافتند‬ ‫همکارانش‬ ‫و‬ ‫هان‬ ‫هورن‬ ‫ایل‬ .‫‌کنند‬ ‫ی‬‫م‬ ‫کمک‬ ‫محققین‬ ‫پس‬ .‫دارد‬ ‫آپاچی‬ ‫تشکیالت‬ ‫در‬ ‫آنها‬ ‫رتبه‬ ‫با‬ ‫مستقیمی‬ ‫رابطه‬ ‫‌کنند‬ ‫ی‬‫م‬ ‫کمک‬ ‫آپاچی‬ ‫افزار‬ ‫سنجش‬ ‫برای‬ ‫معیاری‬ ‫عنوان‬ ‫به‬ ‫را‬ ‫بنیاد‬ ‫در‬ ‫‌دهندگان‬ ‫ه‬‫توسع‬ ‫رتبه‬ ‫کارفرمایان‬ ‫که‬ ‫گرفتند‬ ‫نتیجه‬ .‫‌گیرند‬ ‫ی‬‫م‬ ‫بکار‬ ‫مولد‬ ‫‌های‬ ‫ی‬‫توانای‬
  • 17. ‫‌ها‬ ‫ه‬‫داد‬ ‫پایگاه‬ ،)»‫«پایگاه‬ ،‫خالصه‬ ‫‌طور‬ ‫ه‬‫(ب‬ ‫اطالعاتی‬ ‫بانک‬ ، ‫ِگان‬‫د‬‫دا‬ ‫یا‬ ‫یس‬ِ‫ب‬‫یتا‬ِ‫د‬ :‫انگلیسی‬ ‫(به‬ Database ‫به‬ ) .‫‌شود‬ ‫ی‬‫م‬ ‫گفته‬ ‫‌مند‬ ‫ن‬‫ساما‬ ‫و‬ ‫منظم‬ ‫ساختار‬ ‫با‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫از‬ ‫‌ای‬ ‫ه‬‫مجموع‬ ‫اجمالی‬ ‫بررسی‬ ‫و‬ ‫اصطالحات‬ ‫به‬ ‫دسترسی‬ ‫که‬ ‫است‬ ‫سازمان‬ ‫یا‬ ‫ساختار‬ ‫و‬ ‫مرتبط‬ ‫‌های‬ ‫ه‬‫داد‬ ‫از‬ ‫‌ای‬ ‫ه‬‫مجموع‬ ‫به‬ ‫اشاره‬ »‫داده‬ ‫«پایگاه‬ ،‫دیگر‬ ‫بعبارت‬ ( »‫داده‬ ‫پایگاه‬ ‫مدیریت‬ ‫«سیستم‬ ‫طریق‬ ‫از‬ ً‫ال‬‫معمو‬ ‫اطالعات‬ ‫این‬ DBMS ‫از‬ ‫یکپارچه‬ ‫مجموعه‬ ‫یک‬ ‫از‬ ‫متشکل‬ ) ‫و‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫پایگاه‬ ‫چند‬ ‫یا‬ ‫یک‬ ‫با‬ ‫کردن‬ ‫برقرار‬ ‫ارتباط‬ ‫برای‬ ‫کاربران‬ ‫تا‬ ‫‌دهد‬ ‫ی‬‫م‬ ‫اجازه‬ ‫که‬ ‫است‬ ‫کامپیوتری‬ ‫‌افزارهای‬ ‫م‬‫نر‬ ‫به‬ ‫محدود‬ ‫دسترسی‬ ‫که‬ ‫است‬ ‫ممکن‬ ‫محدودیت‬ ‫چه‬ ‫(اگر‬ ‫داده‬ ‫پایگاه‬ ‫در‬ ‫موجود‬ ‫اطالعات‬ ‫تمام‬ ‫به‬ ‫دسترسی‬ ‫داده‬ ‫پایگاه‬ ،‫‌ای‬ ‫ه‬‫حرف‬ ‫اطالعات‬ ‫فناوری‬ ‫دنیای‬ ‫از‬ ‫خارج‬ . .‫‌کند‬ ‫ی‬‫م‬ ‫فراهم‬ ‫را‬ )‫باشد‬ ‫داشته‬ ‫وجود‬ ‫خاص‬ ‫اطالعات‬ ‫شاخص‬ ‫یک‬ ‫یا‬ ‫گسترده‬ ‫صفحه‬ ‫یک‬ ‫(مانند‬ ‫مرتبط‬ ‫‌های‬ ‫ه‬‫داد‬ ‫از‬ ‫‌ای‬ ‫ه‬‫مجموع‬ ‫هر‬ ‫به‬ ‫اشاره‬ ‫برای‬ ‫اغلب‬ ‫که‬ ‫است‬ ‫مدتی‬ ‫داده‬ ‫پایگاه‬ ‫یک‬ ‫مدیریت‬ ‫که‬ ‫‌دهد‬ ‫ی‬‫م‬ ‫اجازه‬ ‫مختلف‬ ‫توابع‬ ‫به‬ ‫موجود‬ ‫اس‬ .‫اس‬.‫ام‬.‫بی‬.‫دی‬ .‫‌شود‬ ‫ی‬‫م‬ ‫استفاده‬ )‫کارت‬ :‫کرد‬ ‫‌بندی‬ ‫ه‬‫طبق‬ ‫اصلی‬ ‫گروه‬ ‫چهار‬ ‫به‬ ‫را‬ ‫آن‬ ‫‌توان‬ ‫ی‬‫م‬ ‫که‬ ‫دهد‬ ‫انجام‬ ‫را‬ ‫خود‬ ‫‌های‬ ‫ه‬‫داد‬ ‫و‬ 1 . .‫‌کنیم‬ ‫ی‬‫م‬ ‫تعریف‬ ‫آن‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫را‬ ‫داده‬ ‫سازمان‬ ‫که‬ ‫تعاریف‬ ‫از‬ ‫حذف‬ ‫و‬ ‫اصالح‬ ،‫ایجاد‬ - ‫‌ها‬ ‫ه‬‫داد‬ ‫تعریف‬ 2 . .‫واقعی‬ ‫‌های‬ ‫ه‬‫داد‬ ‫حذف‬ ‫و‬ ‫اصالح‬ ،‫درج‬ - ‫روزرسانی‬ ‫به‬ 3 . ‫‌های‬ ‫ه‬‫برنام‬ ‫توسط‬ ‫بیشتر‬ ‫پردازش‬ ‫برای‬ ‫یا‬ ‫استفاده‬ ‫قابل‬ ‫مستقیم‬ ‫‌طور‬ ‫ه‬‫ب‬ ‫فرم‬ ‫یک‬ ‫در‬ ‫اطالعات‬ ‫ارائه‬ ‫یک‬ ‫در‬ ‫یا‬ ‫داده‬ ‫پایگاه‬ ‫در‬ ‫که‬ ‫است‬ ‫همان‬ ً‫اساسا‬ ‫فرم‬ ‫یک‬ ‫در‬ ‫است‬ ‫ممکن‬ ‫بازیابی‬ ‫‌های‬ ‫ه‬‫داد‬ .‫دیگر‬ ‫کاربردی‬ ‫دسترس‬ ‫در‬ ‫شده‬ ‫ذخیره‬ ‫‌های‬ ‫ه‬‫داد‬ ‫پایگاه‬ ‫از‬ ‫موجود‬ ‫‌های‬ ‫ه‬‫داد‬ ‫ترکیب‬ ‫یا‬ ‫تغییر‬ ‫با‬ ‫آمده‬ ‫دست‬ ‫به‬ ‫جدید‬ ‫فرم‬ .‫‌است‬ ‫ه‬‫شد‬ ‫ساخته‬ 4 . ،‫‌ها‬ ‫ه‬‫داد‬ ‫تمامیت‬ ‫حفظ‬ ،‫عملکرد‬ ‫بر‬ ‫نظارت‬ ،‫‌ها‬ ‫ه‬‫داد‬ ‫امنیت‬ ‫اجرای‬ ،‫کاربران‬ ‫بر‬ ‫نظارت‬ ‫و‬ ‫نام‬ ‫ثبت‬ - ‫اداره‬ ‫مانند‬ ‫رویداد‬ ‫از‬ ‫برخی‬ ‫توسط‬ ‫که‬ ‫است‬ ‫اطالعات‬ ‫بعد‬ ‫نقاهت‬ ‫دوره‬ ‫و‬ ،‫همزمانی‬ ‫کنترل‬ ‫با‬ ‫فروش‬ ‫و‬ ‫خرید‬ .‫‌آید‬ ‫ی‬‫م‬ ‫وجود‬ ‫به‬ ‫خراب‬ ‫سیستم‬ ‫غیرمنتظره‬ ‫شکست‬ ‫هم‬ ‫و‬ ‫داده‬ ‫پایگاه‬ ‫هم‬ DBMS ‫جمعی‬ ‫اشاره‬ »‫داده‬ ‫پایگاه‬ ‫«سیستم‬ .‫است‬ ‫خاص‬ ‫داده‬ ‫پایگاه‬ ‫مدل‬ ‫اصول‬ ‫با‬ ‫مطابق‬ .‫است‬ ‫داده‬ ‫پایگاه‬ ‫و‬ ،‫داده‬ ‫پایگاه‬ ‫مدیریت‬ ‫سیستم‬ ،‫داده‬ ‫پایگاه‬ ‫مدل‬ ‫به‬ ‫داده‬ ‫پایگاه‬ ‫تاریخچه‬ ‫داده‬ ‫پایگاه‬ ‫مفهوم‬ ‫دهٔه‬ ‫از‬ ‫داده‬ ‫پایگاه‬ ‫مفهوم‬ ۱۹۶۰ ‫‌های‬ ‫م‬‫سسیست‬ ‫نگهداشت‬ ‫و‬ ،‫ساخت‬ ،‫طراحی‬ ‫در‬ ‫فزاینده‬ ‫مشکالت‬ ‫کاهش‬ ‫برای‬ ‫این‬ .‫‌است‬ ‫ه‬‫شد‬ ‫ایجاد‬ )‫مختلف‬ ‫دادٔه‬ ‫زیادی‬ ‫تعداد‬ ‫با‬ ‫و‬ ،‫همزمان‬ ‫نهایی‬ ِ‫ر‬‫کارب‬ ‫زیادی‬ ‫تعداد‬ ‫با‬ ً‫ال‬‫(معمو‬ ‫اطالعاتی‬
  • 18. ‫ممکن‬ ‫را‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫پایگاه‬ ‫به‬ ‫کارا‬ ‫و‬ ‫مؤثر‬ ‫دستکاری‬ ‫که‬ ‫داده‬ ‫پایگاه‬ ‫مدیریت‬ ‫‌های‬ ‫م‬‫سیست‬ ‫مفهوم‬ ‫همراه‬ ‫به‬ ‫مفهوم‬ .‫‌است‬ ‫ه‬‫کرد‬ ‫رشد‬ ‫‌کند‬ ‫ی‬‫م‬ ‫ژوئن‬ ‫به‬ ‫داده‬ ‫پایگاه‬ ‫اصطالح‬ ‫کاربردهای‬ ‫اولین‬ ۱۹۶۳ ‫شرکت‬ ‫که‬ ‫زمانی‬ ‫یعنی‬ ،‫‌گردد‬ ‫ی‬‫بازم‬ System Development Corporation ‫بر‬ ‫را‬ »‫مرکزی‬ ‫‌ای‬ ‫ه‬‫داد‬ ‫پایگاه‬ ‫یک‬ ‫محاسباتی‬ ‫مدیریت‬ ‫و‬ ‫«توسعه‬ ‫نام‬ ‫به‬ ‫طرح‬ ‫یک‬ ‫اجرایی‬ ‫مسئولیت‬ ‫دهه‬ ‫اوایل‬ ‫در‬ ‫واحد‬ ‫واژه‬ ‫یک‬ ‫عنوان‬ ‫به‬ ‫داده‬ ‫پایگاه‬ .‫گرفت‬ ‫عهده‬ ۷۰ ‫دهه‬ ‫اواخر‬ ‫در‬ ‫و‬ ‫اروپا‬ ‫در‬ ۷۰ ‫‌های‬ ‫ه‬‫نام‬ ‫خبر‬ ‫در‬ ‫سال‬ ‫اوایل‬ ‫در‬ ‫یا‬ ‫‌ای‬ ‫ه‬‫داد‬ ‫(بانک‬ .‫رفت‬ ‫کار‬ ‫به‬ ‫آمریکایی‬ ‫معتبر‬ ۱۹۶۶ )‫رفت‬ ‫کار‬ ‫پست‬ ‫واشینگتن‬ ‫روزنامه‬ ‫در‬ ‫دهه‬ ‫در‬ ‫داده‬ ‫پایگاه‬ ‫مدیریت‬ ‫سیستم‬ ‫اولین‬ ۶۰ .‫‌باشد‬ ‫ی‬‫م‬ ‫بکمن‬ ‫چارلز‬ ‫شاخه‬ ‫این‬ ‫پیشگامان‬ ‫از‬ .‫یافت‬ ‫گسترش‬ ‫مهیا‬ ‫را‬ ‫‌سازی‬ ‫ه‬‫ذخیر‬ ‫وسایل‬ ‫به‬ ‫دسترسی‬ ‫برای‬ ‫مؤثرتری‬ ‫بسیار‬ ‫کاربرد‬ ‫او‬ ‫فرضیات‬ ‫که‬ ‫داد‬ ‫نشان‬ ‫را‬ ‫این‬ ‫بکمن‬ ‫مقاالت‬ ‫سری‬ ‫پردازش‬ ‫که‬ ‫بود‬ ‫مغناطیسی‬ ‫نوارهای‬ ‫و‬ ‫منگنه‬ ‫‌های‬ ‫ت‬‫کار‬ ‫پایه‬ ‫بر‬ ‫داده‬ ‫پردازش‬ ‫‌ها‬ ‫ن‬‫زما‬ ‫آن‬ ‫در‬ .‫‌کند‬ ‫ی‬‫م‬ :‫شد‬ ‫ایجاد‬ ‫‌ها‬ ‫ن‬‫زما‬ ‫آن‬ ‫در‬ ‫‌ای‬ ‫ه‬‫داد‬ ‫مدل‬ ‫نوع‬ ‫دو‬ .‫‌کند‬ ‫ی‬‫م‬ ‫مهیا‬ ‫را‬ ‫اطالعات‬ CODASYL ‫‌ای‬ ‫ه‬‫شبک‬ ‫مدل‬ ‫توسعه‬ ‫موجب‬ ‫توسط‬ ‫که‬ ‫مراتبی‬ ‫سلسله‬ ‫مدل‬ ‫و‬ ‫داشت‬ ‫بکمن‬ ‫نظریات‬ ‫در‬ ‫ریشه‬ ‫شدکه‬ North American Rockwell ‫شد‬ ‫ایجاد‬ ‫شرکت‬ ‫آن‬ ‫از‬ ‫اقتباس‬ ‫با‬ ً‫بعدا‬ ‫و‬ IBM ‫محصول‬ IMS .‫نمود‬ ‫تولید‬ ‫را‬ ‫توسط‬ ‫‌ای‬ ‫ه‬‫رابط‬ ‫مدل‬ E. F. Codd ‫سال‬ ‫در‬ ۱۹۷۰ ‫برای‬ .‫‌داد‬ ‫ی‬‫م‬ ‫قرار‬ ‫انتقاد‬ ‫مورد‬ ‫را‬ ‫موجود‬ ‫‌های‬ ‫ل‬‫مد‬ ‫او‬ .‫شد‬ ‫ارائه‬ ‫کامپیوترها‬ ‫میکرو‬ ‫برای‬ ‫موفق‬ ‫محصول‬ ‫اولین‬ .‫بود‬ ‫تأیید‬ ‫مورد‬ ‫علمی‬ ‫مجامع‬ ‫در‬ ‫مدل‬ ‫این‬ ‫طوالنی‬ ً‫نسبتا‬ ‫مدتی‬ dBASE ‫‌های‬ ‫ل‬‫‌عام‬ ‫م‬‫سیست‬ ‫برای‬ ‫بودکه‬ CP/M ‫و‬ PC-DOS/MS-DOS ‫سال‬ ‫جریان‬ ‫در‬ .‫شد‬ ‫ساخته‬ ۱۹۸۰ ‫پژوهش‬ ( ‫پایگاهی‬ ‫‌های‬ ‫ن‬‫ماشی‬ ‫و‬ ‫شده‬ ‫توزیع‬ ‫مدل‬ ‫‌های‬ ‫ه‬‫پایگا‬ ‫روی‬ ‫بر‬ database machines ‫کمی‬ ‫تأثیر‬ ‫اما‬ ،‫شد‬ ‫متمرکز‬ ) ‫سال‬ ‫در‬ .‫گذاشت‬ ‫بازار‬ ‫بر‬ ۱۹۹۰ ‫مرکب‬ ‫‌های‬ ‫ه‬‫داد‬ ‫کنترل‬ ‫جهت‬ ‫مدل‬ ‫این‬ .‫شد‬ ‫جلب‬ ‫گرا‬ ‫شیء‬ ‫مدل‬ ‫طرف‬ ‫به‬ ‫توجهات‬ ‫‌های‬ ‫ه‬‫داد‬ ‫و‬ )‫منابع‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫مهندسی‬ ‫(شامل‬ ‫داده‬ ‫مهندسی‬ ،‫خاص‬ ‫‌های‬ ‫ه‬‫داد‬ ‫پایگاه‬ ‫روی‬ ‫بر‬ ‫‌سادگی‬ ‫ه‬‫ب‬ ‫و‬ ‫بود‬ ‫الزم‬ .‫‌کرد‬ ‫ی‬‫م‬ ‫کار‬ ‫‌ای‬ ‫ه‬‫رسان‬ ‫چند‬ ‫سال‬ ‫در‬ ۲۰۰۰ ( ‫‌ال‬ ‫م‬‫‌ا‬ ‫س‬‫اک‬ ‫پایگاه‬ ‫و‬ ‫داد‬ ‫رخ‬ ‫‌ای‬ ‫ه‬‫تاز‬ ‫نوآوری‬ XML ‫تفاوت‬ ‫بردن‬ ‫بین‬ ‫از‬ ‫مدل‬ ‫این‬ ‫هدف‬ .‫آمد‬ ‫وجود‬ ‫به‬ ) ‫قرار‬ ‫هم‬ ‫کنار‬ ‫در‬ ‫نه‬ ‫یا‬ ‫باشند‬ ‫یافته‬ ‫ساخت‬ ‫چه‬ ‫اطالعاتی‬ ‫منابع‬ ‫که‬ ‫‌کند‬ ‫ی‬‫م‬ ‫کمک‬ ‫و‬ ‫است‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫و‬ ‫مستندات‬ ‫بین‬ .‫گیرند‬ ‫اس‬ .‫ام‬.‫بی‬.‫دی‬ ‫توضیح‬ DBMS ‫تالش‬ ‫سال‬ ‫و‬ ‫نفر‬ ‫هزاران‬ ‫به‬ ‫معمول‬ ‫‌طور‬ ‫ه‬‫ب‬ ‫آن‬ ‫توسعه‬ ‫و‬ ‫‌است‬ ‫ه‬‫یافت‬ ‫تکامل‬ ‫پیچیده‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫سیستم‬ ‫یک‬ ‫مانند‬ ‫اس‬ .‫ام‬.‫بی‬.‫دی‬ ‫از‬ ‫برخی‬ .‫دارد‬ ‫نیاز‬ ‫وتوسعه‬ Adabas ‫و‬ ‫اوراکل‬ ، DB2 ‫نیازهای‬ ‫رفع‬ ‫اس‬ .‫ام‬.‫بی‬.‫دی‬ ‫هدف‬ . ‫با‬ .‫باشد‬ ‫تر‬ ‫صرفه‬ ‫به‬ ‫مقرون‬ ‫‌تواند‬ ‫ی‬‫م‬ ‫توسعه‬ ‫هزینه‬ ‫که‬ ‫است‬ ‫واقعیت‬ ‫این‬ ،‫حال‬ ‫این‬ ‫با‬ .‫ست‬ ‫کاربردی‬ ‫‌های‬ ‫ه‬‫برنام‬ ،‫حال‬ ‫این‬ DBMS ‫موارد‬ ‫برخی‬ ‫در‬ :‫دارد‬ ‫‌ای‬ ‫ه‬‫بهین‬ ‫حل‬ ‫راه‬ ‫همیشه‬ DBMS .‫کند‬ ‫معرفی‬ ‫را‬ ‫غیرضروری‬ ‫سربار‬ ‫ممکن‬ ‫سیستم‬ ‫رایج‬ ‫مثال‬ ‫یک‬ .‫دارد‬ ‫وجود‬ ‫خاص‬ ‫‌های‬ ‫ه‬‫داد‬ ‫پایگاه‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫که‬ ‫‌های‬ ‫م‬‫سیست‬ ‫از‬ ‫بسیاری‬ ‫‌های‬ ‫ه‬‫نمون‬
  • 19. ‫بخش‬ ‫نیازی‬ ‫و‬ ،‫ایمیل‬ ‫‌های‬ ‫م‬‫پیا‬ ‫مدیریت‬ ‫‌سازی‬ ‫ه‬‫بهین‬ ‫برای‬ ‫‌است‬ ‫ه‬‫شد‬ ‫طراحی‬ ‫ایمیل‬ ‫‌های‬ ‫م‬‫سیست‬ :‫است‬ ‫ایمیل‬ ‫قابلیت‬ ‫از‬ ‫توجهی‬ ‫قابل‬ DBMS ‫به‬ ‫دسترسی‬ ‫برای‬ ‫است‬ ‫‌ای‬ ‫ه‬‫برنام‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫اطالعاتی‬ ‫‌های‬ ‫ک‬‫بان‬ ‫از‬ ‫بسیاری‬ .‫است‬ ‫رابط‬ ‫دادن‬ ‫قرار‬ ‫بدون‬ ،‫نهایی‬ ‫کاربران‬ ‫طرف‬ ‫از‬ ‫داده‬ ‫پایگاه‬ DBMS ‫ممکن‬ ‫‌افزار‬ ‫م‬‫نر‬ ‫نویسان‬ ‫برنامه‬ .‫مستقیم‬ ‫‌طور‬ ‫ه‬‫ب‬ .‫کنند‬ ‫استفاده‬ ‫برنامه‬ ‫‌نویسی‬ ‫ه‬‫برنام‬ ‫رابط‬ ‫یک‬ ‫طریق‬ ‫از‬ ‫زیاد‬ ‫احتمال‬ ‫به‬ ‫یا‬ ،‫مستقیم‬ ‫‌طور‬ ‫ه‬‫ب‬ ‫سیم‬ ‫پروتکل‬ ‫یک‬ ‫است‬ ‫با‬ ‫داده‬ ‫پایگاه‬ ‫مدیران‬ ‫و‬ ‫داده‬ ‫پایگاه‬ ‫طراحان‬ DBMS ‫حفظ‬ ‫و‬ ‫ساخت‬ ‫برای‬ ‫شده‬ ‫داده‬ ‫اختصاص‬ ‫‌های‬ ‫ط‬‫راب‬ ‫طریق‬ ‫از‬ ‫عملکرد‬ ‫چگونگی‬ ‫مورد‬ ‫در‬ ‫درک‬ ‫و‬ ‫بیشتر‬ ‫دانش‬ ‫از‬ ‫برخی‬ ‫به‬ ‫نیاز‬ ‫نتیجه‬ ‫در‬ ‫و‬ ،‫داده‬ ‫‌های‬ ‫ه‬‫پایگا‬ ' ‫کاربردی‬ ‫‌های‬ ‫ه‬‫برنام‬ .‫‌کنند‬ ‫ی‬‫م‬ ‫تعامل‬ ‫اس‬ .‫ام‬.‫بی‬.‫دی‬ ‫تنظیم‬ ‫پارامترهای‬ ‫و‬ ‫خارجی‬ ‫رابط‬ ‫و‬ ‫اس‬ .‫ام‬.‫بی‬.‫دی‬ ‫داده‬ ‫پایگاه‬ ‫‌های‬ ‫ل‬‫مد‬ ‫‌های‬ ‫ل‬‫مد‬ ‫برای‬ ‫مختلفی‬ ‫شگردهای‬ .‫‌کند‬ ‫ی‬‫م‬ ‫مشخص‬ ‫منطقی‬ ‫سطح‬ ‫در‬ ‫را‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫پایگاه‬ ‫کاربران‬ ‫کاری‬ ‫الگوی‬ ‫سطوح‬ ‫و‬ ‫است‬ ‫‌سازی‬ ‫ه‬‫پیاد‬ ‫قابل‬ ‫مختلفی‬ ‫فیزیکی‬ ‫اجراهای‬ ‫منطقی‬ ‫‌های‬ ‫ل‬‫مد‬ ‫از‬ ‫یک‬ ‫هر‬ ‫برای‬ .‫دارد‬ ‫وجود‬ ‫‌ای‬ ‫ه‬‫داد‬ ‫سلسله‬ ‫مدل‬ ،‫تخت‬ ‫مدل‬ ‫از‬ ‫عبارتند‬ ‫‌ها‬ ‫ل‬‫مد‬ ‫این‬ .‫‌کند‬ ‫ی‬‫م‬ ‫مهیا‬ ‫کاربران‬ ‫برای‬ ‫فیزیکی‬ ‫انطباق‬ ‫در‬ ‫مختلفی‬ ‫کنترل‬ .‫است‬ ‫امروزی‬ ‫‌های‬ ‫ه‬‫داد‬ ‫پایگاه‬ ‫مدیریت‬ ‫سامانه‬ ‫کار‬ ‫اساس‬ ‫‌ای‬ ‫ه‬‫رابط‬ ‫مدل‬ .‫‌ای‬ ‫ه‬‫رابط‬ ‫مدل‬ ‫و‬ ‫‌ای‬ ‫ه‬‫شبک‬ ‫مدل‬ ،‫مراتبی‬ ‫‌سازی‬ ‫ل‬‫مد‬ ‫و‬ ‫طراحی‬ ‫ساختار‬ ‫‌کننده‬ ‫س‬‫منعک‬ ‫که‬ ‫مفهومی‬ ‫داده‬ ‫مدل‬ ‫یک‬ ‫تولید‬ ‫برای‬ ‫که‬ ‫است‬ ‫این‬ ‫داده‬ ‫پایگاه‬ ‫طراح‬ ‫یک‬ ‫وظیفه‬ ‫اولین‬ ‫اغلب‬ ،‫ارتباط‬-‫موجودیت‬ ‫مدل‬ ‫یک‬ ‫توسعه‬ ‫منظور‬ ‫به‬ .‫کند‬ ‫پیشنهاد‬ ‫طرحی‬ ‫‌شود‬ ‫ی‬‫م‬ ‫برگزار‬ ‫داده‬ ‫پایگاه‬ ‫در‬ ‫اطالعات‬ ‫حالت‬ ‫دقت‬ ‫به‬ ‫موفق‬ ‫داده‬ ‫مدل‬ .‫است‬ ‫یکپارچه‬ ‫‌سازی‬ ‫ل‬‫مد‬ ‫زبان‬ ‫محبوب‬ ‫روش‬ ‫از‬ ‫دیگر‬ ‫یکی‬ .‫طراحی‬ ‫ابزار‬ ‫کمک‬ ‫با‬ ‫یک‬ ‫از‬ ‫بیش‬ ‫‌توانند‬ ‫ی‬‫م‬ ‫مردم‬ ‫اگر‬ ،‫مثال‬ ‫عنوان‬ ‫به‬ :‫شود‬ ‫خارج‬ ‫جهان‬ ‫از‬ ‫ممکن‬ ‫مدل‬ ‫دارد‬ ‫بستگی‬ ‫‌کننده‬ ‫س‬‫منعک‬ ‫داده‬ ‫مدل‬ ‫طراحی‬ .‫شود‬ ‫ذخیره‬ ‫اطالعات‬ ‫یک‬ ‫از‬ ‫بیش‬ ‫که‬ ‫‌دهد‬ ‫ی‬‫نم‬ ‫اجازه‬ ‫حقیقت‬ ‫در‬ ،‫باشد‬ ‫داشته‬ ‫تلفن‬ ‫شماره‬ ‫مورد‬ ‫در‬ ‫عمیق‬ ‫‌های‬ ‫ل‬‫سوا‬ ‫پرسیدن‬ ‫شامل‬ ً‫ال‬‫معمو‬ .‫دارد‬ ‫کاربران‬ ‫کاربرد‬ ‫دامنه‬ ‫از‬ ‫خوبی‬ ‫درک‬ ‫به‬ ‫نیاز‬ ‫خوب‬ ‫مفهومی‬ ،" ‫باشد؟‬ ‫کاال‬ ‫‌کننده‬ ‫ه‬‫عرض‬ ‫یک‬ ‫‌تواند‬ ‫ی‬‫م‬ ‫مشتری‬ ‫یک‬ " ‫مانند‬ ،‫‌باشد‬ ‫ی‬‫م‬ ‫دارد‬ ‫عالقه‬ ‫آن‬ ‫به‬ ‫سازمان‬ ‫یک‬ ‫که‬ ‫چیزهایی‬ ‫مختلف‬ ‫محصوالت‬ ‫یا‬ ‫محصول‬ ‫همان‬ ،‫‌رسد‬ ‫ی‬‫م‬ ‫فروش‬ ‫به‬ ‫‌بندی‬ ‫ه‬‫بست‬ ‫از‬ ‫مختلف‬ ‫فرم‬ ‫دو‬ ‫با‬ ‫محصول‬ ‫یک‬ ‫اگر‬ " ‫یا‬ ‫و‬ ‫‌ها‬ ‫ن‬‫آ‬ ‫روابط‬ ‫و‬ )‫پرواز‬ ‫بخش‬ ،‫پرواز‬ ،‫محصوالت‬ ،‫(مشتریان‬ ‫اشخاص‬ ‫برای‬ ‫اصطالحات‬ ‫تعاریف‬ ‫؟"پرسش‬ ‫است‬ ‫آن‬ ‫از‬ ‫ورودی‬ ‫شامل‬ ‫اوقات‬ ‫گاهی‬ ‫مفهومی‬ ‫داده‬ ‫مدل‬ ‫تولید‬ .‫‌گیرد‬ ‫ی‬‫م‬ ‫قرار‬ ‫استفاده‬ ‫مورد‬ ‫شده‬ ‫ایجاد‬ ‫‌های‬ ‫ی‬‫ویژگ‬ ‫پایگاه‬ ‫در‬ ‫اطالعاتی‬ ‫ایجاد‬ ‫به‬ ‫‌تواند‬ ‫ی‬‫م‬ ‫این‬ .‫است‬ ‫سازمان‬ ‫در‬ ‫کار‬ ‫گردش‬ ‫تحلیل‬ ‫و‬ ‫تجزیه‬ ‫یا‬ ،‫کار‬ ‫و‬ ‫کسب‬ ‫فرایندهای‬ ‫‌های‬ ‫ه‬‫داد‬ ‫نگهداری‬ ‫برای‬ ‫نیاز‬ ‫مورد‬ ‫داده‬ ‫پایگاه‬ ‫‌گیری‬ ‫م‬‫تصمی‬ ‫به‬ ‫‌تواند‬ ‫ی‬‫م‬ ،‫مثال‬ ‫عنوان‬ ‫به‬ .‫کند‬ ‫کمک‬ ‫نیاز‬ ‫مورد‬ ‫داده‬ .‫هستند‬ ‫خوشحال‬ ‫کاربران‬ ‫مفهومی‬ ‫داده‬ ‫مدل‬ ‫یک‬ ‫تولید‬ ‫از‬ ‫پس‬ .‫کند‬ ‫کمک‬ ‫فعلی‬ ‫‌های‬ ‫ه‬‫داد‬ ‫همچنین‬ ‫و‬ ‫تاریخی‬
  • 20. ‫پایگاه‬ ‫در‬ ‫مربوطه‬ ‫‌های‬ ‫ه‬‫داد‬ ‫ساختمان‬ ‫‌سازی‬ ‫ه‬‫پیاد‬ ‫که‬ ‫کنند‬ ‫ترجمه‬ ‫را‬ ‫طرح‬ ‫این‬ ‫که‬ ‫است‬ ‫این‬ ‫بعدی‬ ‫مرحله‬ ‫در‬ ‫شده‬ ‫بیان‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫منطقی‬ ‫مدل‬ ‫خروجی‬ ‫و‬ ،‫منطقی‬ ‫‌های‬ ‫ه‬‫داد‬ ‫پایگاه‬ ‫طراحی‬ ‫نام‬ ‫به‬ ‫اغلب‬ ‫فرایند‬ ‫این‬ .‫‌است‬ ‫ه‬‫داد‬ ‫پایگاه‬ ‫فناوری‬ ‫انتخاب‬ ‫از‬ ‫مستقل‬ )‫حداقل‬ ‫تئوری‬ ‫(در‬ ‫مفهومی‬ ‫داده‬ ‫مدل‬ ‫که‬ ‫حالی‬ ‫در‬ .‫است‬ ‫طرح‬ ‫یک‬ ‫قالب‬ ‫توسط‬ ‫شده‬ ‫پشتیبانی‬ ‫خاص‬ ‫داده‬ ‫پایگاه‬ ‫مدل‬ ‫یک‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫منطقی‬ ‫مدل‬ ،‫‌است‬ ‫ه‬‫داد‬ DBMS .‫‌کند‬ ‫ی‬‫م‬ ‫انتخاب‬ ‫را‬ ‫با‬ ‫ما‬ ‫مقاله‬ ‫این‬ ‫در‬ ‫اما‬ ،‫‌شود‬ ‫ی‬‫م‬ ‫استفاده‬ ‫یکدیگر‬ ‫جای‬ ‫به‬ ‫اغلب‬ ‫‌باشد‬ ‫ی‬‫م‬ ‫داده‬ ‫پایگاه‬ ‫مدل‬ ‫و‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫شرایط‬ ‫(مدل‬ ‫طراحی‬ ‫بیان‬ ‫‌سازی‬ ‫ل‬‫مد‬ ‫نماد‬ ‫برای‬ ‫داده‬ ‫پایگاه‬ ‫مدل‬ ‫و‬ ،‫خاص‬ ‫داده‬ ‫پایگاه‬ ‫یک‬ ‫طراحی‬ ‫برای‬ ‫داده‬ ‫مدل‬ ‫از‬ ‫استفاده‬ ‫عنوان‬ ‫به‬ ‫‌ای‬ ‫ه‬‫رابط‬ ‫مدل‬ ،‫تر‬ ‫دقیق‬ ‫یا‬ ،‫‌ای‬ ‫ه‬‫رابط‬ ‫مدل‬ ‫دادٔه‬ ‫پایگاه‬ ‫‌ترین‬ ‫ب‬‫محبو‬ ‫داده‬ ‫پایگاه‬ ‫مدل‬ )‫‌کنیم‬ ‫ی‬‫م‬ ‫استفاده‬ ‫زبان‬ SQL ‫روش‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫مدل‬ ‫این‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫منطقی‬ ‫داده‬ ‫پایگاه‬ ‫طراحی‬ ‫یک‬ ‫ایجاد‬ ‫روند‬ .‫‌است‬ ‫ه‬‫داد‬ ‫نشان‬ ‫که‬ ‫است‬ »‫«حقیقت‬ ‫ابتدا‬ ‫در‬ ‫که‬ ‫‌شود‬ ‫ی‬‫م‬ ‫حاصل‬ ‫اطمینان‬ .‫است‬ ‫عادی‬ ‫روش‬ ‫عنوان‬ ‫به‬ ‫شده‬ ‫شناخته‬ ‫روشمند‬ .‫‌شود‬ ‫ی‬‫م‬ ‫انجام‬ ‫انسجام‬ ‫حفظ‬ ‫برای‬ ‫خودکار‬ ‫صورت‬ ‫به‬ ‫حذف‬ ‫و‬ ‫روزرسانی‬ ‫به‬ ‫‌طوری‬ ‫ه‬‫ب‬ ،‫شده‬ ‫ثبت‬ ‫مکان‬ ‫یک‬ ‫در‬ ‫تنها‬ ‫و‬ ،‫امنیت‬ ،‫بهبود‬ ،‫پذیری‬ ‫مقیاس‬ ،‫عملکرد‬ ‫برای‬ ‫‌گیری‬ ‫م‬‫تصمی‬ ‫که‬ ‫است‬ ‫این‬ ‫داده‬ ‫پایگاه‬ ‫طراحی‬ ‫از‬ ‫نهایی‬ ‫مرحله‬ ‫مرحله‬ ‫این‬ ‫در‬ ‫کلیدی‬ ‫هدف‬ .‫‌شود‬ ‫ی‬‫م‬ ‫نامیده‬ ‫فیزیکی‬ ‫‌های‬ ‫ه‬‫داد‬ ‫پایگاه‬ ‫طراحی‬ ‫اغلب‬ ‫که‬ ‫‌گذارد‬ ‫ی‬‫م‬ ‫تأثیر‬ ‫آن‬ ‫مانند‬ ‫باشد‬ ‫نامرئی‬ ‫باید‬ ‫عملکرد‬ ‫‌سازی‬ ‫ه‬‫بهین‬ ‫اهداف‬ ‫برای‬ ‫شده‬ ‫اتخاذ‬ ‫تصمیمات‬ ‫که‬ ‫معنی‬ ‫این‬ ‫به‬ ،‫‌است‬ ‫ه‬‫داد‬ ‫استقالل‬ ‫رانده‬ ‫نیاز‬ ‫مورد‬ ‫عملکرد‬ ‫توسط‬ ً‫عمدتا‬ ‫فیزیکی‬ ‫طراحی‬ .‫است‬ ‫کاربردی‬ ‫‌های‬ ‫ه‬‫برنام‬ ‫و‬ ‫کاربران‬ ‫به‬ ‫دادن‬ ‫پایان‬ ‫برای‬ ‫که‬ ‫ارائه‬ ‫‌های‬ ‫ی‬‫ویژگ‬ ‫از‬ ‫عمیق‬ ‫درک‬ ‫و‬ ،‫‌رود‬ ‫ی‬‫م‬ ‫انتظار‬ ‫دسترسی‬ ‫و‬ ‫کار‬ ‫حجم‬ ‫الگوهای‬ ‫از‬ ‫خوبی‬ ‫دانش‬ ‫به‬ ‫نیاز‬ ‫و‬ ،‫‌شود‬ ‫ی‬‫م‬ ‫توسط‬ ‫شده‬ DBMS ‫این‬ .‫است‬ ‫امنیتی‬ ‫فیزیکی‬ ‫‌های‬ ‫ه‬‫داد‬ ‫پایگاه‬ ‫طراحی‬ ‫جنبه‬ ‫از‬ ‫دیگر‬ ‫یکی‬ .‫‌است‬ ‫ه‬‫شد‬ ‫انتخاب‬ ‫برای‬ ‫روش‬ ‫و‬ ‫امنیتی‬ ‫سطوح‬ ‫تعریف‬ ‫همچنین‬ ‫و‬ ‫داده‬ ‫پایگاه‬ ‫اشیاء‬ ‫به‬ ‫دسترسی‬ ‫کنترل‬ ‫تعریف‬ ‫دو‬ ‫هر‬ ‫شامل‬ .‫است‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫تخصصی‬ ‫و‬ ‫اجرایی‬ ‫بحث‬ ‫بدون‬ ‫خود‬ ‫‌ای‬ ‫ه‬‫حرف‬ ‫زندگی‬ ‫آغاز‬ ‫در‬ ‫که‬ ‫هستند‬ ‫غیرمتخصص‬ ‫کدنویسان‬ ‫برخی‬ ‫اطالعاتی‬ ‫بانک‬ ‫ساخت‬ ‫زمینه‬ ‫در‬ ‫جدولی‬ ‫بین‬ ‫ارتباطات‬ ‫ایجاد‬ ‫حتی‬ ‫یا‬ ‫جداول‬ ‫ساخت‬ ‫به‬ ‫اقدام‬ ‫اطالعاتی‬ ‫بانک‬ ‫سرور‬ ‫‌های‬ ‫ه‬‫پای‬ ‫با‬ ‫ساختاری‬ ‫آشنایی‬ ( ‫‌کنند‬ ‫ی‬‫م‬ relations ‫یا‬ RDBMS ‫جمله‬ ‫از‬ ‫است‬ ‫مطرح‬ ‫همیشه‬ ‫ثابت‬ ‫بحث‬ ‫چند‬ ‫اطالعاتی‬ ‫بانک‬ ‫طراحی‬ ‫در‬ .) ،)‫سرعت‬ ‫افزایش‬ ‫برای‬ ‫تکرار‬ ‫برای‬ ‫(تالش‬ ‫‌سازی‬ ‫ل‬‫نانرما‬ ،)‫حجم‬ ‫در‬ ‫‌جویی‬ ‫ه‬‫صرف‬ ‫برای‬ ‫تکرار‬ ‫از‬ ‫(اجتناب‬ ‫‌سازی‬ ‫ل‬‫نرما‬ ‫با‬ ‫آشنایی‬ indexing ‫همان‬ ً‫(تقریبا‬ ‫ایندکس‬ ‫کالسترد‬ ‫شامل‬ ‫حروف‬ ‫اساس‬ ‫بر‬ ‫هدفمند‬ ‫‌سازی‬ ‫ب‬‫مرت‬ ‫یا‬ PKs ‫و‬ ) ‫ردیف‬ ‫کالستردایندکس‬ ‫به‬ ‫یافتن‬ ‫از‬ ‫پس‬ ‫نام‬ ‫ایندکس‬ ‫مثال‬ ‫(برای‬ ‫دوم‬ ‫‌آپ‬ ‫ک‬‫لو‬ ‫مبحث‬ ‫با‬ ‫دوم‬ ‫‌های‬ ‫س‬‫ایندک‬ ً‫ال‬‫معمو‬ ‫که‬ ‫خودش‬ PK ‫مانند‬ ‫‌هایی‬ ‫ث‬‫بح‬ ‫و‬ )‫کند‬ ‫استخراج‬ ‫را‬ ‫ردیف‬ ‫تا‬ ‫‌کند‬ ‫ی‬‫م‬ ‫مراجعه‬ ‫است‬ B-tree ‫به‬ ‫برخی‬ ‫که‬ ‫خود‬ ‫که‬ ‫معنی‬ ‫بدان‬ ‫است‬ ‫‌شونده‬ ‫ل‬‫متعاد‬-‫خود‬ ‫درخت‬ ‫واقع‬ ‫در‬ ‫اما‬ ‫‌گیرند‬ ‫ی‬‫م‬ ‫اشتباه‬ ‫باینری‬ ‫درخت‬ ‫با‬ ‫را‬ ‫آن‬ ‫اشتباه‬ ‫دسته‬ ‫دسته‬ ‫را‬ ‫‌ها‬ ‫س‬‫ایندک‬ ‫مرحله‬ ‫چند‬ ‫تا‬ ‫که‬ ‫‌گیرد‬ ‫ی‬‫م‬ ‫تصمیم‬ ‫اطالعاتی‬ ‫جدول‬ ‫‌های‬ ‫ف‬‫ردی‬ ‫تعداد‬ ‫اساس‬ ‫بر‬ ‫سرور‬ .‫برسد‬ ‫نظر‬ ‫مورد‬ ‫ردیف‬ ‫‌های‬ ‫ه‬‫داد‬ ‫به‬ ‫ممکن‬ ‫زمان‬ ‫‌ترین‬ ‫ع‬‫سری‬ ‫در‬ ‫جستجو‬ ‫مورد‬ ‫مقدار‬ ‫مقایسه‬ ‫با‬ ‫بتواند‬ ‫تا‬ ‫کند‬
  • 21. ‫با‬ ‫شاخه‬ ‫‌های‬ ‫ه‬‫گر‬ ،)‫آغازین‬ ‫‌بندی‬ ‫ه‬‫دست‬ ‫(تنها‬ ‫روت‬ ‫یا‬ ‫ریشه‬ ‫گره‬ ‫گونه‬ ‫سه‬ ‫به‬ ‫‌ها‬ ‫ی‬‫‌بند‬ ‫ه‬‫دست‬ ‫این‬ ‫مختلف‬ ‫سطوح‬ ‫مهم‬ ‫مباحث‬ ‫جمله‬ ‫از‬ .‫دارند‬ ‫وجود‬ )‫(پایانی‬ ‫‌شوند‬ ‫ی‬‫‌م‬ ‫ه‬‫شناخت‬ ‫پیجز‬ ‫لیف‬ ‫به‬ ‫که‬ ‫لیفز‬ ‫یا‬ ‫برگ‬ ‫‌های‬ ‫ه‬‫گر‬ ‫و‬ )‫(میانی‬ ‫برنچ‬ ‫زمان‬ ‫در‬ ‫که‬ ‫است‬ ‫جستجو‬ ‫نوع‬ ‫با‬ ‫متناسب‬ ‫کامپوزیت‬ ‫یا‬ ‫ترکیبی‬ ‫‌های‬ ‫س‬‫ایندک‬ ‫ایجاد‬ ‫اطالعاتی‬ ‫بانک‬ ‫کارایی‬ ‫افزایش‬ ‫مانند‬ ‫سرورها‬ ‫برخی‬ ‫در‬ ‫مباحث‬ ‫این‬ ‫تمام‬ ‫بین‬ ‫در‬ .‫است‬ ‫برخوردار‬ ‫مهمی‬ ‫اهمیت‬ ‫از‬ ‫جداول‬ ‫بین‬ ‫ارتباطات‬ ‫ایجاد‬ ‫اطالعاتی‬ ‫موتور‬ ‫نوع‬ ‫چه‬ ‫از‬ ‫اینکه‬ ‫‌کیوال‬ ‫س‬‫‌ا‬ ‫ی‬‫ما‬ MyISAM ‫یا‬ InnoDB ‫زیرا‬ ‫است‬ ‫سواالت‬ ‫اولین‬ ‫از‬ ‫شود‬ ‫استفاده‬ ‫هم‬ ‫و‬ ‫ثبت‬ ‫هم‬ ‫سرعت‬ ‫در‬ ‫تعادل‬ ‫نماینده‬ ‫دومی‬ ‫و‬ )‫بایگانی‬ ً‫ال‬‫(معمو‬ ‫است‬ ‫اطالعات‬ ‫ثبت‬ ‫در‬ ‫سرعت‬ ‫نماینده‬ ‫اولی‬ ‫غیرترزاکشن‬ ‫یا‬ ‫غیرتراکنشی‬ ‫عنوان‬ ‫با‬ ‫و‬ ‫‌کند‬ ‫ی‬‫م‬ ‫قفل‬ ‫را‬ ‫جدول‬ ‫کل‬ ‫داده‬ ‫ثبت‬ ‫زمان‬ ‫در‬ ‫اولی‬ ‫در‬ ‫دلیل‬ ‫این‬ ‫به‬ ‫خواندن‬ .‫‌کند‬ ‫ی‬‫م‬ ‫قفل‬ ‫را‬ ‫‌ها‬ ‫ف‬‫ردی‬ ‫و‬ ‫است‬ ‫برعکس‬ ‫دومی‬ ‫که‬ ‫حالی‬ ‫در‬ ‫‌شود‬ ‫ی‬‫م‬ ‫شناخته‬ ‫نیز‬ ‫مدل‬ ‫طراحی‬ ‫مرحله‬ ‫که‬ ‫‌شود‬ ‫ی‬‫م‬ ‫آغاز‬ ‫مغز‬ ‫یا‬ ‫فکر‬ ‫طوفان‬ ‫مرحله‬ ‫از‬ ‫پس‬ ‫اطالعاتی‬ ‫بانک‬ ‫طراحی‬ ‫فرایند‬ ً‫ال‬‫معمو‬ ‫مانند‬ ‫شده‬ ‫استفاده‬ ‫فکر‬ ‫طوفان‬ ‫برای‬ ‫که‬ ‫شود‬ ‫انجام‬ ‫محیطی‬ ‫همان‬ ‫در‬ ‫است‬ ‫ممکن‬ MS Visio ‫پس‬ ً‫ال‬‫معمو‬ ‫اما‬ ‫استودیوهای‬ ‫در‬ ‫مستقیم‬ ‫داده‬ ‫پایگاه‬ ‫طراحی‬ ‫و‬ ‫‌کشی‬ ‫ل‬‫مد‬ ‫مرحله‬ ،‫پروژه‬ ‫ساختار‬ ‫دربارٔه‬ ‫تصمیمات‬ ‫شدن‬ ‫قطعی‬ ‫از‬ ‫مانند‬ ‫اطالعاتی‬ ‫بانک‬ ‫طراحی‬ MySQL Workbench ‫یا‬ SQL server management studio ‫از‬ ‫‌شود‬ ‫ی‬‫م‬ ‫انجام‬ ‫تحت‬ ‫پروژه‬ ‫چه‬ ‫رو‬ ‫این‬ RUP .‫شود‬ ‫اعمال‬ ‫اصلی‬ ‫مدل‬ ‫در‬ ‫بالفاصله‬ ‫‌تواند‬ ‫ی‬‫م‬ ‫تغییرات‬ ‫شود‬ ‫اجرا‬ ‫اجیل‬ ‫یا‬ ‫برنامه‬ ‫روی‬ ‫اطالعاتی‬ ‫بانک‬ ‫مدل‬ ‫میانی‬ ‫الیه‬ ‫عملکرد‬ ‫نحوه‬ ‫با‬ ‫پیش‬ ‫از‬ ‫که‬ ‫باشد‬ ‫‌ای‬ ‫ه‬‫گون‬ ‫به‬ ‫باید‬ ‫پایگاه‬ ‫طراحی‬ ‫نه‬ ‫اما‬ ‫‌شود‬ ‫ی‬‫م‬ ‫ساخته‬ ‫موجود‬ ‫اطالعاتی‬ ‫بانک‬ ‫اساس‬ ‫بر‬ ‫برنامه‬ ‫برعکس‬ ‫(گاهی‬ ‫باشد‬ ‫هماهنگ‬ ‫‌کننده‬ ‫ه‬‫استفاد‬ ‫کاربران‬ ‫تعداد‬ ‫و‬ ‫پروژه‬ ‫وسعت‬ ‫میزان‬ ‫به‬ ‫بسته‬ ‫مثال‬ ‫برای‬ )‫است‬ ‫طراحی‬ ‫حال‬ ‫در‬ ‫پروژه‬ ‫مختص‬ ‫داده‬ ‫پایگاه‬ ‫زمانی‬ ‫داده‬ ‫‌کشی‬ ‫ه‬‫نقش‬ ‫الگوی‬ ‫الیه‬ ‫از‬ ‫است‬ ‫ممکن‬ ( en ) ( Datamapper ‫نسبت‬ ‫‌تر‬ ‫م‬‫عظی‬ ‫‌های‬ ‫ه‬‫پروژ‬ ‫برای‬ ‫باالتر‬ ‫سرعت‬ ‫با‬ ) ( ‫کنشور‬ ‫ثبت‬ ‫الگوی‬ ‫به‬ AR ‫است‬ ‫ممکن‬ ‫مواردی‬ ‫در‬ ‫حتی‬ ‫شود‬ ‫استفاده‬ ‫است‬ ‫برخوردار‬ ‫‌تری‬ ‫ن‬‫‌پایی‬ ‫ت‬‫سرع‬ ‫از‬ ‫که‬ ) ‫الیه‬ ‫‌گونه‬ ‫چ‬‫هی‬ ‫از‬ ‫استفاده‬ ‫امکان‬ ORM ‫تراکنش‬ ‫گونه‬ ‫هر‬ ‫امنیتی‬ ‫مسائل‬ ‫خاطر‬ ‫به‬ ‫مثال‬ ‫برای‬ ‫باشد‬ ‫نداشته‬ ‫وجود‬ ‫بواسطه‬ ‫اطالعاتی‬ ‫بانک‬ procedure ‫یا‬ ‫افزودن‬ ‫اجازه‬ ‫و‬ ‫شود‬ ‫انجام‬ ‫ایمن‬ ‫شده‬ ‫‌نوشته‬ ‫ش‬‫پی‬ ‫از‬ ‫‌های‬ ‫ن‬‫روتی‬ ‫و‬ ‫ها‬ ‫از‬ ‫که‬ ‫‌است‬ ‫ه‬‫شد‬ ‫توصیه‬ ً‫اکثرا‬ .‫باشد‬ ‫نداشته‬ ‫وجود‬ ‫سرور‬ ‫کاربران‬ ‫برای‬ ‫اطالعاتی‬ ‫بانک‬ ‫سرور‬ ‫روی‬ ‫ویرایش‬ AR ‫برای‬ ‫‌های‬ ‫ک‬‫بان‬ ‫مبحث‬ ‫در‬ .‫است‬ ‫بهتر‬ ‫گزینه‬ ‫دیتامپر‬ ‫عوض‬ ‫در‬ ‫نشود‬ ‫استفاده‬ ‫دارند‬ ‫بسیار‬ ‫کاربران‬ ‫که‬ ‫‌هایی‬ ‫ه‬‫پروژ‬ ‫تضاد‬ ‫در‬ ‫دومین‬ ‫الیه‬ ‫‌ها‬ ‫ن‬‫آ‬ ‫از‬ ‫یکی‬ ‫‌شود‬ ‫ی‬‫م‬ ‫استفاده‬ ‫متفاوتی‬ ً‫ال‬‫کام‬ ‫امور‬ ‫برای‬ ‫دامنه‬ ‫یا‬ ‫دومین‬ ‫عبارت‬ ‫از‬ ‫اطالعاتی‬ ‫دیگری‬ ‫و‬ ‫‌هاست‬ ‫ه‬‫داد‬ ‫ریلیشن‬ ‫بررسی‬ ‫و‬ ‫ویرایش‬ ‫و‬ ‫ثبت‬ ‫‌کننده‬ ‫ل‬‫کنتر‬ ‫الیه‬ ‫یکی‬ ‫که‬ ‫است‬ ‫دیتامپر‬ ‫در‬ ‫بیزینس‬ ‫الیه‬ ‫با‬ .‫‌کند‬ ‫ی‬‫م‬ ‫استفاده‬ ‫اول‬ ‫الیه‬ ‫از‬ ‫که‬ ‫برنامه‬ ‫در‬ ‫‌سازی‬ ‫ل‬‫مد‬ ‫الیه‬
  • 22. ‫‌کیوال‬ ‫س‬‫‌ا‬ ‫ی‬‫ما‬ :‫انگلیسی‬ ‫(به‬ MySQL ‫اوراکل‬ ‫شرکت‬ ‫توسط‬ ‫که‬ ‫است‬ ‫‌باز‬ ‫ن‬‫مت‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫پایگاه‬ ‫مدیریت‬ ‫سامانه‬ ‫یک‬ ) .‫‌شود‬ ‫ی‬‫م‬ ‫پشتیبانی‬ ‫و‬ ،‫توزیع‬ ،‫توسعه‬ .‫‌دهد‬ ‫ی‬‫م‬ ‫را‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫از‬ ‫‌زمان‬ ‫م‬‫ه‬ ‫استفاده‬ ‫اجازه‬ ‫کاربر‬ ‫چندین‬ ‫به‬ ‫‌کیوال‬ ‫س‬‫‌ا‬ ‫ی‬‫ما‬ ‫سرور‬ ‫‌ها‬ ‫ت‬‫مزی‬ :‫است‬ ‫‌مند‬ ‫ه‬‫بهر‬ ‫زیر‬ ‫‌های‬ ‫ت‬‫مزی‬ ‫از‬ ‫‌کیوال‬ ‫س‬‫‌ا‬ ‫ی‬‫ما‬ • ‫انعطاف‬ ‫قابلیت‬ ‫و‬ ‫‌پذیری‬ ‫س‬‫مقیا‬ • ‫باال‬ ‫عملکرد‬ • ‫باال‬ ‫بودن‬ ‫دسترس‬ ‫در‬ • ‫‌ها‬ ‫ش‬‫تراکن‬ ‫از‬ ‫پشتیبانی‬ • ‫داده‬ ‫از‬ ‫محافظت‬ • ‫مدیریت‬ ‫بودن‬ ‫آسان‬ • ‫برنامه‬ ‫بودن‬ ‫آزاد‬ • ‫‌روزی‬ ‫ه‬‫شبان‬ ‫پشتیبانی‬ ‫تاریخچه‬ ‫سال‬ ‫در‬ ‫‌کیوال‬ ‫س‬‫‌ا‬ ‫ی‬‫ما‬ ‫توسعه‬ ۱۹۹۴ ‫در‬ ‫داخلی‬ ‫نسخه‬ ‫اولین‬ ‫شد‬ ‫آغاز‬ ‫آکسمارک‬ ‫دیوید‬ ‫و‬ ‫وایدنیوس‬ ‫مایکل‬ ‫توسط‬ ۲۳ ‫می‬ ۱۹۹۵ ‫سال‬ ‫در‬ .‫شد‬ ‫عرضه‬ ۲۰۰۸ ‫اوراکل‬ ‫شرکت‬ .‫کرد‬ ‫خریداری‬ ‫را‬ ‫‌بی‬ ‫ی‬‫ا‬ ‫‌کیوال‬ ‫س‬‫‌ا‬ ‫ی‬‫ما‬ ‫میکروسیستمز‬ ‫سان‬ ‫در‬ ‫را‬ ‫میکروسیستمز‬ ‫سان‬ ۲۷ ‫ژانویه‬ ۲۰۱۰ .‫کرد‬ ‫خریداری‬ ‫‌ها‬ ‫ت‬‫قابلی‬ ‫داده‬ ‫انواع‬ :‫است‬ ‫زیر‬ ‫موارد‬ ‫شامل‬ ‫‌کیوال‬ ‫س‬‫‌ا‬ ‫ی‬‫ما‬ ‫در‬ ‫شده‬ ‫پشتیبانی‬ ‫‌های‬ ‫ه‬‫داد‬ ‫انواع‬ • ‫عددی‬ • ‫کاراکتری‬ • ( ‫شمارشی‬ Enum ) • ‫تاریخ‬ ‫و‬ ‫زمان‬
  • 23. • ‫دودویی‬ • :‫انگلیسی‬ ‫(به‬ ‫فضایی‬ ‫‌های‬ ‫ه‬‫داد‬ ‫‌های‬ ‫ع‬‫نو‬ Spatial ) ‫‌سازی‬ ‫ه‬‫ذخیر‬ ‫موتورهای‬ .‫‌کنند‬ ‫ی‬‫م‬ ‫عمل‬ ‫مختلف‬ ‫جدول‬ ‫‌های‬ ‫ع‬‫نو‬ ‫عنوان‬ ‫به‬ ‫که‬ ‫‌کند‬ ‫ی‬‫م‬ ‫پشتیبانی‬ ‫‌سازی‬ ‫ه‬‫ذخیر‬ ‫موتور‬ ‫چندین‬ ‫از‬ ‫‌کیوال‬ ‫س‬‫‌ا‬ ‫ی‬‫ما‬ .‫هستند‬ ‫ناامن‬ ‫‌ها‬ ‫ش‬‫تراکن‬ ‫برابر‬ ‫در‬ ‫دیگر‬ ‫برخی‬ ‫و‬ ،‫امن‬ ‫‌ها‬ ‫ش‬‫تراکن‬ ‫برابر‬ ‫در‬ ‫‌سازی‬ ‫ه‬‫ذخیر‬ ‫موتورهای‬ ‫انواع‬ ‫برخی‬ :‫است‬ ‫زیر‬ ‫موارد‬ ‫شامل‬ ‫‌کیوال‬ ‫س‬‫‌ا‬ ‫ی‬‫ما‬ ‫‌سازی‬ ‫ه‬‫ذخیر‬ ‫موتورهای‬ ‫لیست‬ • ‫‌بی‬ ‫ی‬‫اینود‬ :‫انگلیسی‬ ‫(به‬ InnoDB ‫خارجی‬ ‫کلید‬ ‫جامعیت‬ ‫قواعد‬ ‫از‬ .‫است‬ ‫‌ها‬ ‫ش‬‫تراکن‬ ‫برابر‬ ‫در‬ ‫امن‬ :) ‫‌کیوال‬ ‫س‬‫‌ا‬ ‫ی‬‫ما‬ ‫از‬ .‫‌کند‬ ‫ی‬‫م‬ ‫پشتیبانی‬ ۵٫۵٫۵ .‫است‬ ‫‌کیوال‬ ‫س‬‫‌ا‬ ‫ی‬‫ما‬ ‫‌فرض‬ ‫ش‬‫پی‬ ‫‌سازی‬ ‫ه‬‫ذخیر‬ ‫موتور‬ • ‫‌سم‬ ‫ی‬‫‌آ‬ ‫ی‬‫ما‬ :‫انگلیسی‬ ‫(به‬ MyISAM ‫نسخه‬ ‫از‬ ‫قبل‬ :) ۵٫۵٫۵ ‫‌کیوال‬ ‫س‬‫‌ا‬ ‫ی‬‫ما‬ ‫‌فرض‬ ‫ش‬‫پی‬ ‫‌سازی‬ ‫ه‬‫ذخیر‬ ‫موتور‬ .‫بود‬ • ‫حافظه‬ :‫انگلیسی‬ ‫(به‬ Memory .‫‌کند‬ ‫ی‬‫م‬ ‫نگهداری‬ ‫حافظه‬ ‫در‬ ‫سریع‬ ‫دسترسی‬ ‫منظور‬ ‫به‬ ‫را‬ ‫داده‬ ‫تمام‬ :) • ‫ادغام‬ :‫انگلیسی‬ ‫(به‬ Merge ‫‌ها‬ ‫ن‬‫آ‬ ‫به‬ ‫ارجاع‬ ‫و‬ ‫مشابه‬ ‫‌سم‬ ‫ی‬‫‌آ‬ ‫ی‬‫ما‬ ‫جدول‬ ‫چندین‬ ‫کردن‬ ‫‌بندی‬ ‫ه‬‫گرو‬ ‫قابلیت‬ :) .‫‌دهد‬ ‫ی‬‫م‬ ‫را‬ ‫جدول‬ ‫یک‬ ‫عنوان‬ ‫به‬ • ‫آرشیو‬ :‫انگلیسی‬ ‫(به‬ Archive .‫‌شود‬ ‫ی‬‫م‬ ‫ارجاع‬ ‫‌ها‬ ‫ن‬‫آ‬ ‫به‬ ‫ندرت‬ ‫به‬ ‫که‬ ‫آرشیوی‬ ‫‌های‬ ‫ه‬‫داد‬ ‫نگهداری‬ ‫برای‬ :) • ‫متحد‬ :‫انگلیسی‬ ‫(به‬ Federated ‫یک‬ ‫ایجاد‬ ‫برای‬ ‫مجزا‬ ‫‌کیوال‬ ‫س‬‫‌ا‬ ‫ی‬‫ما‬ ‫سرور‬ ‫چندین‬ ‫زدن‬ ‫پیوند‬ ‫برای‬ :) .‫فیزیکی‬ ‫سرور‬ ‫چندین‬ ‫از‬ ‫منطقی‬ ‫‌داده‬ ‫ه‬‫پایگا‬ • ‫‌وی‬ ‫س‬‫‌ا‬ ‫ی‬‫س‬ :‫انگلیسی‬ ‫(به‬ CSV ‫‌سازی‬ ‫ه‬‫ذخیر‬ ‫کاما‬ ‫با‬ ‫جداشده‬ ‫مقادیر‬ ‫قالب‬ ‫با‬ ‫متنی‬ ‫‌های‬ ‫ل‬‫فای‬ ‫در‬ ‫را‬ ‫داده‬ :) .‫‌کند‬ ‫ی‬‫م‬ • ‫‌چاله‬ ‫ه‬‫سیا‬ :‫انگلیسی‬ ‫(به‬ Blackhole .‫‌کند‬ ‫ی‬‫نم‬ ‫ذخیره‬ ‫را‬ ‫آن‬ ‫ولی‬ ،‫‌کند‬ ‫ی‬‫م‬ ‫قبول‬ ‫را‬ ‫داده‬ ‫ورودی‬ :) ‫‌شده‬ ‫ه‬‫ذخیر‬ ‫‌های‬ ‫ه‬‫برنام‬ .‫‌است‬ ‫ه‬‫شد‬ ‫تشکیل‬ ‫‌کیوال‬ ‫س‬‫ا‬ ‫عبارات‬ ‫از‬ ‫که‬ ‫است‬ ‫بدنه‬ ‫یک‬ ‫شامل‬ ‫‌شده‬ ‫ه‬‫ذخیر‬ ‫برنامه‬ ‫هر‬ ‫‌کیوال‬ ‫س‬‫‌ا‬ ‫ی‬‫ما‬ ‫در‬ ‫توسط‬ ‫شده‬ ‫(ایجاد‬ ‫باشند‬ ‫داشته‬ ‫خروجی‬ ‫مقادیر‬ ‫‌توانند‬ ‫ی‬‫م‬ ‫‌شده‬ ‫ه‬‫ذخیر‬ ‫‌های‬ ‫ه‬‫برنام‬ CREATE PROCEDURE ‫یا‬ ) ‫توسط‬ ‫شده‬ ‫(ایجاد‬ ‫باشند‬ ‫نداشته‬ CREATE FUNCTION ‫‌توان‬ ‫ی‬‫م‬ ‫آن‬ ‫از‬ ،‫باشد‬ ‫داشته‬ ‫خروجی‬ ‫برنامه‬ ‫یک‬ ‫اگر‬ .) ‫‌وجوی‬ ‫س‬‫پر‬ ‫در‬ SELECT .‫کرد‬ ‫استفاده‬ :‫کرد‬ ‫اشاره‬ ‫‌توان‬ ‫ی‬‫م‬ ‫زیر‬ ‫موارد‬ ‫به‬ ‫‌کیوال‬ ‫س‬‫‌ا‬ ‫ی‬‫ما‬ ‫سرشناس‬ ‫کاربران‬ ‫از‬ • ‫‌پدیا‬ ‫ی‬‫ویک‬ • ‫‌بوک‬ ‫س‬‫فی‬
  • 24. • ‫لینکداین‬ • ‫نوکیا‬ • ‫دیگ‬ • ‫فلیکر‬ RDBMS Terminology Before we proceed to explain the MySQL database system, let us revise a few definitions related to the database. Database − A database is a collection of tables, with related data. Table − A table is a matrix with data. A table in a database looks like a simple spreadsheet. Column − One column (data element) contains data of one and the same kind, for example the column postcode. Row − A row (= tuple, entry or record) is a group of related data, for example the data of one subscription. Redundancy − Storing data twice, redundantly to make the system faster. Primary Key − A primary key is unique. A key value can not occur twice in one table. With a key, you can only find one row. Foreign Key − A foreign key is the linking pin between two tables.
  • 25. Compound Key − A compound key (composite key) is a key that consists of multiple columns, because one column is not sufficiently unique. Index − An index in a database resembles an index at the back of a book. Referential Integrity − Referential Integrity makes sure that a foreign key value always points to an existing row. MySQL Database MySQL is a fast, easy-to-use RDBMS being used for many small and big businesses. MySQL is developed, marketed and supported by MySQL AB, which is a Swedish company. MySQL is becoming so popular because of many good reasons − MySQL is released under an open-source license. So you have nothing to pay to use it. MySQL is a very powerful program in its own right. It handles a large subset of the functionality of the most expensive and powerful database packages. MySQL uses a standard form of the well-known SQL data language. MySQL works on many operating systems and with many languages including PHP, PERL, C, C++, JAVA, etc. MySQL works very quickly and works well even with large data sets. MySQL is very friendly to PHP, the most appreciated language for web development.
  • 26. MySQL supports large databases, up to 50 million rows or more in a table. The default file size limit for a table is 4GB, but you can increase this (if your operating system can handle it) to a theoretical limit of 8 million terabytes (TB). MySQL is customizable. The open-source GPL license allows programmers to modify the MySQL software to fit their own specific environments.
  • 76. ‫تفاوت‬ mysql ‫و‬ mariadb : Mysql ‫سال‬ ‫در‬ ‫بار‬ ‫اولین‬ ‫دیتابیس‬ ‫سرویس‬ ‫این‬ : 1995 ‫های‬ ‫شرکت‬ ‫در‬ ‫زمان‬ ‫آن‬ ‫از‬ ‫که‬ ‫شد‬ ‫ساخته‬ ‫و‬ ‫منتشر‬ ‫ترین‬ ‫رایج‬ ‫و‬ ‫شود‬ ‫می‬ ‫استفاده‬ ..‫و‬ ‫فلیکس‬ ‫نت‬ – ‫ناسا‬ – ‫پال‬ ‫پی‬ – ‫توییتر‬ – ‫فیسبوک‬ ‫همچون‬ ‫مشهوری‬ ‫اکنون‬ ‫هم‬ ‫آن‬ ‫نسخه‬ ‫آخرین‬ ‫که‬ ‫میباشد‬ ‫حاضر‬ ‫حال‬ ‫در‬ ‫انجین‬ ‫دیتابیس‬ ‫سرویس‬ Mysql 5.7 ‫سرویس‬ .‫میباشد‬ mysql ‫زبان‬ ‫به‬ C ‫و‬ C ‫های‬ ‫عامل‬ ‫سیستم‬ ‫در‬ ‫و‬ ‫است‬ ‫شده‬ ‫نویسی‬ ‫برنامه‬ ++ Microsoft Windows, OS X, Linux, AIX, BSDi, FreeBSD, HP-UX, IRIX, NetBSD, Novell Netware .‫شود‬ ‫می‬ ‫پشتیبانی‬ ‫بخوبی‬ MariaDB ‫بزرگی‬ ‫های‬ ‫کمپانی‬ ‫و‬ ‫ها‬ ‫شرکت‬ ‫در‬ ‫امروزه‬ ‫که‬ ‫میباشد‬ ‫دیتابیس‬ ‫برای‬ ‫تری‬ ‫بهینه‬ ‫و‬ ‫جدید‬ ‫انجین‬ : ‫سال‬ ‫در‬ ‫بار‬ ‫اولین‬ ‫و‬ ‫میشود‬ ‫استفاده‬ 2008 ‫بنام‬ ‫شخصی‬ ‫آن‬ ‫اصلی‬ ‫نویس‬ ‫برنامه‬ ‫و‬ .‫شد‬ ‫معرفی‬ ‫و‬ ‫آمد‬ ‫بوجود‬ Michael “Monty” Widenius ‫سرویس‬ ‫گذاران‬ ‫بنیان‬ ‫از‬ ‫خود‬ ‫که‬ ‫میباشد‬ Mysql .‫است‬ ‫بوده‬ MariaDB ‫در‬ ‫مانند‬ ‫مشهوری‬ ‫و‬ ‫بزرگ‬ ‫بسیار‬ ‫های‬ ‫شرکت‬ Google, Craigslist, Wikipedia, archlinux, RedHat, CentOS, and Fedora ‫دی‬ ‫ماریا‬.‫باشد‬ ‫می‬ ‫طرفدار‬ ‫پر‬ ‫بسیار‬ ‫لینوکس‬ ‫عامل‬ ‫سیستم‬ ‫در‬ ‫و‬ ‫شود‬ ‫می‬ ‫استفاده‬ ‫حاضر‬ ‫حال‬ ‫در‬ ‫های‬ ‫زبان‬ ‫بوسیله‬ ‫بی‬ C ‫و‬ ++ Perl ‫و‬ Bash ‫های‬ ‫عامل‬ ‫سیستم‬ ‫در‬ ‫و‬ ‫است‬ ‫شده‬ ‫نوشته‬ Microsoft Windows, Linux, OS X, FreeBSD, OpenBSD, Solaris ‫میشود‬ ‫پشتیبانی‬ ‫بخوبی‬
  • 77. ‫میتوان‬ ‫اختصار‬ ‫بطور‬ MariaDB ‫یافته‬ ‫بهینه‬ ‫نسخه‬ ‫را‬ Mysql ‫و‬ ‫میباشد‬ ‫تر‬ ‫بهینه‬ ‫بسیار‬ ‫عملکرد‬ ‫در‬ ‫چون‬ ‫نامید‬ ‫منابع‬ ‫اینکه‬ ‫همه‬ ‫تر‬ ‫مهم‬ ‫و‬ ‫میکند‬ ‫عمل‬ ‫سریعتر‬ ‫ها‬ ‫کوئری‬ ‫به‬ ‫پاسخگویی‬ ‫در‬ ‫و‬ ‫دارد‬ ‫بهتری‬ ‫امنیت‬ ‫همچنین‬ ‫سایت‬ ‫وب‬ ‫زیادی‬ ‫تعداد‬ ‫که‬ ‫هایی‬ ‫هاستینگ‬ ‫و‬ ‫بازدید‬ ‫پر‬ ‫های‬ ‫سایت‬ ‫وب‬ ‫برای‬ ‫پس‬ ‫میکند‬ ‫مصرف‬ ‫نیز‬ ‫کمتری‬ ‫روی‬ ‫با‬ ‫که‬ ‫هایی‬ ‫سایت‬ ‫معموال‬ .‫بود‬ ‫خواهد‬ ‫مطلوب‬ ‫بسیار‬ ‫میکنند‬ ‫میزبانی‬ Mysql 5.6 ‫میکنند‬ ‫کار‬ ‫بخوبی‬ ‫باال‬ ‫به‬ ‫با‬ Maria DB ‫به‬ ‫ارتقاء‬ ‫از‬ ‫پس‬ ‫ناسازگاری‬ ‫عدم‬ ‫مشکالت‬ ‫برای‬ ‫نگرانی‬ ‫جای‬ ‫و‬ ‫کرد‬ ‫خواهند‬ ‫کار‬ ‫بخوبی‬ ‫نیز‬ MariaDB .‫دهید‬ ‫انجام‬ ‫اینکارو‬ ‫میتوانید‬ ‫اطمینان‬ ‫با‬ ‫و‬ ‫ندارد‬ ‫وجود‬
  • 81. ‫لینوکس‬ ‫در‬ ‫داده‬ ‫پایگاه‬ ‫انواع‬ ‫سیستم‬ ‫در‬ ‫معروف‬ ‫جمله‬ ‫از‬ ‫که‬ ‫دارند‬ ‫وجود‬ ‫داده‬ ‫پایگاه‬ ‫افزارهای‬ ‫نرم‬ ‫از‬ ‫مختلفی‬ ‫انواع‬ ‫لینوکس‬ ‫عامل‬ : ‫نمود‬ ‫اشاره‬ ‫زیر‬ ‫موارد‬ ‫به‬ ‫میتوان‬ ‫آنها‬ ‫ترین‬ • mysql • MariaDB • PostgerSQL • MongoDB • Oracle . • SQLit • ms sql • … ‫اوراکل‬ ‫داده‬ ‫پایگاه‬ ‫راهبر‬ ‫یک‬ ‫پایه‬ ‫وظایف‬ ‫لیست‬ ‫چک‬ DBA ( ‫اوراکل‬ ‫داده‬ ‫پایگاه‬ ‫مدیر‬ ‫یک‬ ‫نقش‬ Oracle DBA ‫اوراکل‬ ‫یک‬ .‫باشد‬ ‫پیچیده‬ ‫بسیار‬ ‫‌تواند‬ ‫ی‬‫م‬ ) DBA ‫به‬ ‫باید‬ ‫تنها‬ ‫نه‬ ‫فضای‬ ‫مدیریت‬ ‫و‬ ‫کاربران‬ ‫مدیریت‬ Tablespace ‫و‬ ‫جداول‬ ‫و‬ ‫ها‬ View ‫و‬ ‫ها‬ Index ‫بررسی‬ ‫به‬ ‫نیاز‬ ‫بلکه‬ ‫بپردازد‬ ‫ها‬ Object ‫قبیل‬ ‫از‬ ‫داده‬ ‫پایگاه‬ ‫داخلی‬ ‫های‬ Trigger ‫و‬ ‫ها‬ Procedure ‫و‬ ‫ها‬ Function ‫آن‬ ‫همراه‬ ‫‌های‬ ‫ه‬‫بست‬ ‫و‬ ‫ها‬ ‫نیز‬ ‫ها‬ .‫دارد‬ .‫است‬ ‫برخوردار‬ ‫خاصی‬ ‫اهمیت‬ ‫از‬ ‫نیز‬ ‫داده‬ ‫پایگاه‬ ‫تحوالت‬ ‫و‬ ‫تغییر‬ ‫جاری‬ ‫روند‬ ‫بررسی‬ ‫این‬ ‫بر‬ ‫عالوه‬ .‫پذیرند‬ ‫صورت‬ ‫باید‬ ‫روزمره‬ ‫های‬ ‫فعالیت‬ ‫از‬ ‫انبوهی‬ ‫روزانه‬ ‫وظایف‬ ‫شرح‬ ‫عنوان‬ ‫به‬ ‫آنان‬ ‫از‬ ‫برخی‬ ‫حتی‬ ‫که‬ ‫داده‬ ‫پایگاه‬ ‫نگهداشت‬ ‫و‬ ‫مدیریت‬ ‫خودکار‬ ‫ابزارهای‬ ‫وجود‬ ‫از‬ ‫سال‬ ‫چندین‬ ‫گذشت‬ ‫وجود‬ ‫با‬ ‫این‬ ‫در‬ ‫هنوز‬ ‫‌اند‬ ‫ه‬‫شد‬ ‫عرضه‬ ‫جانبی‬ ‫کنندگان‬ ‫تولید‬ ‫طریق‬ ‫از‬ ‫نیز‬ ‫دیگر‬ ‫برخی‬ ‫و‬ ‫دارند‬ ‫وجود‬ ‫نیز‬ ‫اوراکل‬ ‫خود‬ ‫در‬ ‫نیز‬ ‫یک‬ ‫که‬ ‫است‬ ‫شرایط‬ ‫این‬ ‫در‬ ‫و‬ ‫است‬ ‫نشده‬ ‫معرفی‬ ‫خصوص‬ ‫این‬ ‫در‬ ‫جامعی‬ ‫ابزار‬ ‫نوپا‬ ‫بسیار‬ ‫بازار‬ DBA ‫به‬ ‫مبرم‬ ‫نیاز‬ .‫نمود‬ ‫خواهد‬ ‫احساس‬ ‫شدت‬ ‫به‬ ‫را‬ ‫خویش‬ ‫فعالیت‬ ‫حوزه‬ ‫وظایف‬ ‫از‬ ‫مشروح‬ ‫لیست‬ ‫یک‬ ‫تهیه‬ ‫خواهند‬ ‫وجود‬ ‫نیز‬ ‫دیگری‬ ‫ضروری‬ ‫های‬ ‫فعالیت‬ ‫قطعا‬ ‫و‬ ‫پرداخت‬ ‫خواهیم‬ ‫بحث‬ ‫به‬ ‫مذکور‬ ‫لیست‬ ‫خصوص‬ ‫در‬ ‫هر‬ ‫و‬ ‫نیامده‬ ‫بحث‬ ‫این‬ ‫در‬ ‫که‬ ‫داشت‬ DBA ‫تهیه‬ ‫را‬ ‫خویش‬ ‫عملیاتی‬ ‫حوزه‬ ‫نیازهای‬ ‫با‬ ‫مطابق‬ ‫لیستی‬ ‫باید‬ ْ‫شخصا‬ .‫نماید‬
  • 82. ‫بازگردانی‬ ‫و‬ ‫‌گیری‬ ‫ن‬‫پشتیبا‬ ‫یک‬ DBA ‫خوانایی‬ ‫وضعیت‬ ‫و‬ ‫صحت‬ ‫از‬ ‫ولی‬ ‫‌نماید‬ ‫ی‬‫م‬ ‫پشتیبان‬ ‫تهیه‬ ‫به‬ ‫اقدام‬ ‫قطعا‬ Tape ‫خود‬ ‫پشتیبان‬ ‫فرآیند‬ ‫چرخه‬ ‫خصوص‬ ‫در‬ ‫دارد؟‬ ‫اطمینان‬ Tape ‫نیاز‬ ‫مورد‬ ‫مواقع‬ ‫در‬ ‫آن‬ ‫عملکرد‬ ‫صحت‬ ‫از‬ ‫کامل‬ ‫اطمینان‬ ‫و‬ ‫است؟‬ ‫چگونه‬ ‫وضعیت‬ ‫همچنین‬ Control file ‫که‬ ‫زمانی‬ .‫نکنید‬ ‫فراموش‬ ‫را‬ ‫ها‬ Instance ‫را‬ Shutdown ‫اجرای‬ ‫از‬ ‫پس‬ ‫و‬ ‫‌نمایید‬ ‫ی‬‫م‬ BACKUP CONTROL FILES TO TRACE ‫فایل‬ Trace ‫در‬ ‫پشتیبان‬ ‫انجام‬ ‫از‬ ‫قبل‬ ‫و‬ ‫یافته‬ ‫را‬ Tape ‫به‬ ‫نسبت‬ .‫نمایید‬ ‫اقدام‬ ‫آن‬ ‫انتقال‬ ‫و‬ ‫تغییرنام‬ ‫از‬ ‫‌گیری‬ ‫ن‬‫پشتیبا‬ ‫خصوص‬ ‫در‬ ‫همچنین‬ init.ora ‫نظیر‬ ‫داده‬ ‫پایگاه‬ ‫اساسی‬ ‫‌های‬ ‫ل‬‫فای‬ ‫دیگر‬ ‫و‬ listener.ora ‫و‬ login.sql .‫شود‬ ‫الزم‬ ‫توجه‬ ‫باید‬ Shutdown/Restart ‫به‬ ‫اقدام‬ ‫‌ای‬ ‫ه‬‫دور‬ ‫صورت‬ ‫به‬ ‫که‬ ‫فرض‬ ‫این‬ ‫با‬ Shutdown ‫و‬ Restart ‫پاکسازی‬ ‫موجب‬ ‫عمل‬ ‫این‬ ،‫شود‬ ‫داده‬ ‫پایگاه‬ ‫مسیر‬ Trace file ‫یک‬ ‫ایجاد‬ ‫و‬ Error log .‫‌شود‬ ‫ی‬‫م‬ ‫جدید‬ ‫از‬ ‫پس‬ Restart ‫یک‬ Instance ‫یک‬ ‫که‬ ‫کنید‬ ‫دقت‬ Data cache ‫برخی‬ ‫‌توانید‬ ‫ی‬‫م‬ ‫لذا‬ ،‫داشت‬ ‫خواهید‬ ‫خالی‬ Package ‫و‬ ‫ها‬ Procedure ‫حافظه‬ ‫در‬ ‫را‬ ‫ها‬ Pin ‫صورت‬ ‫این‬ ‫در‬ ‫نمایید‬ Package header ‫حافظه‬ ‫در‬ ‫ها‬ Cache ‫برخی‬ ‫اجرای‬ ‫به‬ ‫نیاز‬ ‫شاید‬ ‫حال‬ ‫این‬ ‫با‬ .‫شد‬ ‫خواهند‬ ‫بارگذاری‬ ‫سیستم‬ Procedure ‫از‬ ‫قبل‬ ‫ها‬ Package body ‫ها‬ ‫تمامی‬ ‫منظور‬ ‫این‬ ‫به‬ ،‫باشد‬ Package ‫مقدار‬ ‫با‬ ‫تنها‬ ‫را‬ ‫ها‬ Null ‫از‬ ‫پس‬ ‫اجرا‬ ‫برای‬ ‫‌ها‬ ‫ن‬‫آ‬ ‫نمودن‬ ‫فعال‬ ‫جهت‬ ‫تنها‬ Startup ‫و‬ ‫سیستم‬ Pin .‫کنید‬ ‫اجرا‬ ‫حافظه‬ ‫در‬ ‫‌ها‬ ‫ن‬‫آ‬ ‫نمودن‬ ‫مدیریت‬ Tablespace ‫روی‬ ‫اصلی‬ ‫اطالعات‬ Tablespace ‫سیستمی‬ ‫جداول‬ ‫وسیله‬ ‫به‬ ‫ها‬ DBA_TABLESPACES، DBA_DATA_FILES ‫و‬ V$FATAFILE .‫‌شود‬ ‫ی‬‫م‬ ‫نگهداری‬ ‫وضعیت‬ ‫بررسی‬ ‫برای‬ Tablespace ‫درخواست‬ ‫سیستم‬ ‫در‬ DBA_FREE_SPACE .‫شود‬ ‫اجرا‬ ‫هر‬ ‫باقیمانده‬ ‫میزان‬ ‫درصد‬ Tablespace .‫شود‬ ‫بررسی‬ ‫هر‬ ‫از‬ ‫باقیمانده‬ ‫فضای‬ ‫میزان‬ Tablespace ‫درخواست‬ ‫با‬ DBA_EXTENTS .‫شود‬ ‫بررسی‬ ‫دستور‬ .‫‌ها‬ ‫ه‬‫داد‬ ‫انتخاب‬ ‫بازه‬ ‫در‬ ‫مربوطه‬ ‫اثر‬ ‫و‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫‌ای‬ ‫ه‬‫زنجیر‬ ‫سطرهای‬ ‫بررسی‬ ANALYZE TABLE ‫جدول‬ ‫نام‬ LIST CHAINED ROWS ‫جدول‬ ‫به‬ ‫را‬ ‫دیتا‬ ، CHAINED_ROWS ‫توجه‬ ‫کار‬ ‫این‬ ‫انجام‬ ‫از‬ ‫قبل‬ ‫ولی‬ ‫‌نماید‬ ‫ی‬‫م‬ ‫اضافه‬ ‫ابتدا‬ ‫که‬ ‫باشید‬ ‫داشته‬ UTLCHAIN.SQL .‫شود‬ ‫اجرا‬ ‫موقت‬ ‫جدول‬ ‫یک‬ ‫کمک‬ ‫با‬ ‫سطر‬ ‫مجدد‬ ‫ورود‬ ‫و‬ ‫حذف‬ ‫به‬ ‫نسبت‬ ‫باید‬ ،‫شد‬ ‫پیدا‬ ‫‌ای‬ ‫ه‬‫زنجیر‬ ‫سطر‬ ‫یک‬ ‫که‬ ‫هنگامی‬ ‫که‬ ‫شود‬ ‫توجه‬ ،‫داده‬ ‫پایگاه‬ ‫‌اندازی‬ ‫ه‬‫را‬ ‫و‬ ‫طراحی‬ ‫زمان‬ ‫در‬ .‫شود‬ ‫اقدام‬ Tablespace ‫و‬ Rollback segment ‫تنها‬ ‫ها‬ .‫باشند‬ ‫جداول‬ ‫از‬ ‫نوع‬ ‫یک‬ ‫شامل‬
  • 83. Redo Logs ‫مدیریت‬ ‫و‬ ‫کنترل‬ Redo log .‫شود‬ ‫سپرده‬ ‫فراموشی‬ ‫به‬ ‫نباید‬ ‫ولی‬ ‫است‬ ‫آسان‬ ‫بسیار‬ ‫ها‬ ‫درخواست‬ ‫با‬ V$LOGFILE ‫و‬ V$LOG ‫و‬ ‫جاری‬ ‫وضعیت‬ Online ‫تمام‬ ‫بودن‬ Log .‫شوند‬ ‫بررسی‬ ‫‌ها‬ ‫ه‬‫گرو‬ ‫و‬ ‫ها‬ Rollback Segments ‫از‬ ‫معروفی‬ ‫جمله‬ Kevin Loney ‫مدیریت‬ .‫دارد‬ ‫وجود‬ ‫مورد‬ ‫این‬ ‫در‬ ”‫خانواده‬ ‫ناخلف‬ ‫“فرزند‬ Rollback Segment .‫شود‬ ‫پرداخته‬ ‫آن‬ ‫به‬ ‫جداگانه‬ ‫مقاله‬ ‫دریک‬ ‫باید‬ ‫که‬ ‫است‬ ‫مبحثی‬ ‫ها‬ ‫یک‬ ‫که‬ ‫باشید‬ ‫داشته‬ ‫یاد‬ ‫به‬ Instance ‫ایجاد‬ ‫برای‬ Rollback ‫پارامترهای‬ ‫اساس‬ ‫بر‬ ‫نیاز‬ ‫مورد‬ ‫تعداد‬ ‫به‬ init.ora ‫و‬ TRANSACTIONS ‫بر‬ ‫تقسیم‬ TRANSACTIONS_PER_ROLLBACK_SEGMENT .‫نمود‬ ‫خواهد‬ ‫اقدام‬ ‫بیشتر‬ ‫تعدادی‬ ‫یا‬ ‫یک‬ ‫باید‬ ‫داده‬ ‫پایگاه‬ ‫هر‬ ‫شرایط‬ ‫بهترین‬ ‫در‬ Tablespace ‫برای‬ ‫تنها‬ Rollback segment ‫ها‬ ‫این‬ ‫در‬ ‫اندازه‬ ‫از‬ ‫بیش‬ ‫انتشار‬ ‫و‬ ‫رشد‬ ،‫باشد‬ ‫داشته‬ Tablespace ‫طبیعی‬ ‫غیر‬ ‫بالاستفاده‬ ‫فضای‬ ‫ایجاد‬ ‫موجب‬ ‫ها‬ .‫‌شود‬ ‫ی‬‫م‬ DBA ‫منظور‬ ‫به‬ Offline ‫یا‬ Online ‫دستور‬ ‫از‬ ‫استفاده‬ ‫به‬ ‫نیاز‬ ‫‌ساز‬ ‫ه‬‫ذخیر‬ ‫در‬ ‫تغییر‬ ‫یا‬ ‫و‬ ALTER ROLLBACK SEGMENT .‫دارد‬ ‫سیستمی‬ ‫جدول‬ DBA_ROLLBACK_SEGS ‫‌های‬ ‫ت‬‫سگمن‬ Rollback ‫به‬ ‫را‬ Tablespace ‫دارد‬ ‫وجود‬ ‫آن‬ ‫در‬ ‫که‬ .‫‌سازد‬ ‫ی‬‫م‬ ‫مرتبط‬ ‫مدیریت‬ Table ‫تمام‬ ‫اینکه‬ ‫از‬ ‫سریع‬ ‫سنجی‬ ‫صحت‬ ‫و‬ ‫بررسی‬ Index ‫خود‬ ‫مناسب‬ ‫محل‬ ‫در‬ ‫دارد‬ ‫نیاز‬ ‫‌ها‬ ‫ن‬‫آ‬ ‫به‬ ‫که‬ ‫جدولی‬ ‫هر‬ ‫برای‬ ‫ها‬ .‫است‬ ‫مفیدی‬ ‫فرآیند‬ ،‫دارند‬ ‫قرار‬ ‫مناسبی‬ ‫وضعیت‬ ‫در‬ ْ‫کامال‬ ‫و‬ ‫دارد‬ ‫قرار‬ ‫تمامی‬ ‫بازسازی‬ Index “ ‫ساختار‬ ‫‌شود‬ ‫ی‬‫م‬ ‫‌بینی‬ ‫ش‬‫پی‬ ‫که‬ ‫جداولی‬ ‫برای‬ ‫ها‬ btree “ ‫به‬ ‫‌ها‬ ‫ن‬‫آ‬ ” skewed ‫همراه‬ ‫به‬ ” ‫جدول‬ .‫‌گردد‬ ‫ی‬‫م‬ ‫پیشنهاد‬ ،‫شود‬ ‫تبدیل‬ ‫حذف‬ ‫و‬ ‫اضافه‬ ‫جدول‬ ‫زیادی‬ ‫تعداد‬ SYS.DBA_INDEXES ‫اطالعاتی‬ ‫شامل‬ ‫و‬ ‫جدول‬ ‫هر‬ ‫خصوص‬ ‫در‬ Index ‫به‬ ‫بیشتری‬ ‫میزان‬ ‫نیاز‬ ‫درصورت‬ .‫است‬ ‫غیره‬ ‫و‬ ‫رشد‬ ‫میزان‬ ‫و‬ ‫حجم‬ ‫قبیل‬ ‫از‬ ‫ها‬ .‫دهید‬ ‫اختصاص‬ ‫‌توان‬ ‫ی‬‫م‬ ‫آینده‬ ‫در‬ ‫رشد‬ ‫منظور‬ ‫‌سازی‬ ‫ه‬‫بهین‬ ‫اطالعات‬ ‫و‬ ‫آمار‬ ‫قابل‬ ‫رشد‬ ‫دارای‬ ‫که‬ ‫جداولی‬ ‫روی‬ ‫بر‬ ،‫‌کنید‬ ‫ی‬‫م‬ ‫استفاده‬ ‫محور‬ ‫هزینه‬ ‫‌سازی‬ ‫ه‬‫بهین‬ ‫روش‬ ‫از‬ ‫شما‬ ‫اینکه‬ ‫فرض‬ ‫با‬ ‫دستور‬ ‫هستند‬ ‫‌ای‬ ‫ه‬‫مالحظ‬ ANALYZE TABLE COMPUTE STATISTICS ‫و‬ ‫الزم‬ ‫اعمال‬ ‫این‬ .‫کنید‬ ‫اجرا‬ ‫را‬ ‫پرکاربرد‬ ‫جداول‬ ‫از‬ ‫شناختی‬ ‫باشید‬ ‫نداشته‬ ‫دست‬ ‫در‬ ‫اطمینانی‬ ‫قابل‬ ‫آمار‬ ‫شما‬ ‫که‬ ‫زمانی‬ ‫تا‬ ‫لذا‬ ‫یکدیگرند‬ ‫ملزوم‬ ‫قرار‬ ‫شما‬ ‫اختیار‬ ‫در‬ ‫مناسبی‬ ‫اطالعات‬ ‫سامانه‬ ‫تجاری‬ ‫کاربری‬ ‫از‬ ‫کافی‬ ‫دانش‬ ‫شرایط‬ ‫این‬ ‫در‬ ،‫داشت‬ ‫نخواهیم‬ .‫داد‬ ‫خواهد‬ ‫پردازشی‬ ‫بار‬ ،‫داده‬ ‫پایگاه‬ ‫بزرگ‬ ‫جداول‬ ‫در‬ COMPUTE STATISTICS ‫بررسی‬ ‫شامل‬ ‫که‬ ،‫بود‬ ‫خواهد‬ ‫باال‬ ‫مقداری‬
  • 84. ‫یک‬ ‫ساخت‬ ‫میزان‬ ‫به‬ ‫‌رود‬ ‫ی‬‫م‬ ‫انتظار‬ ‫و‬ ‫است‬ ‫جدول‬ ‫کامل‬ Index ‫مقدار‬ ‫به‬ ‫همچنین‬ ‫و‬ ‫انجامد‬ ‫طول‬ ‫به‬ ‫کامل‬ ‫بخش‬ ‫فضای‬ ‫از‬ ‫باالیی‬ Temporary )‫جدول‬ ‫‌های‬ ‫ن‬‫ستو‬ ‫میزان‬ ‫به‬ ‫(حداقل‬ ‫دارد‬ ‫نیاز‬ ‫با‬ ‫که‬ ‫جداولی‬ ‫بین‬ ‫پردازشی‬ ‫بار‬ ‫منظور‬ ‫این‬ ‫به‬ COMPUTE ‫با‬ ‫که‬ ‫جداولی‬ ‫و‬ ‫است‬ ‫شده‬ ‫تحلیل‬ ESTIMATE ‫به‬ ‫فرض‬ ‫پیش‬ ‫طور‬ ‫به‬ .‫‌شود‬ ‫ی‬‫م‬ ‫تقسیم‬ ‫متناسب‬ ‫طور‬ ESTIMATE ‫تنها‬ ۱۰۶۴ ‫که‬ ‫خواند‬ ‫خواهد‬ ‫را‬ ‫ابتدایی‬ ‫سطر‬ .‫دارد‬ ‫وجود‬ ‫نیز‬ ‫آزمایشی‬ ‫حجم‬ ‫تعریف‬ ‫امکان‬ ‫البته‬ ‫خیر‬ ‫یا‬ ‫باشد‬ ‫شما‬ ‫‌های‬ ‫ه‬‫داد‬ ‫گویای‬ ‫شاید‬ ‫منطقی‬ ‫صحت‬ ‫مستندات‬ ‫توسط‬ ‫‌ها‬ ‫ت‬‫سای‬ ‫برخی‬ ‫در‬ ‫که‬ ‫دارد‬ ‫وجود‬ ‫بررسی‬ ‫جهت‬ ‫متعددی‬ ‫مناطق‬ DBA ‫نقاط‬ ‫این‬ ‫بررسی‬ ‫به‬ ‫بدون‬ ‫درخواست‬ ‫هر‬ ‫از‬ ‫گیری‬ ‫گزارش‬ ،‫موجود‬ ‫فرزندی‬-‫والد‬ ‫ارتباطات‬ ‫نظیر‬ ‫‌شود‬ ‫ی‬‫م‬ ‫پرداخته‬ Header ‫این‬ ‫البته‬ ، ‫وظایف‬ ‫از‬ ‫فعالیت‬ DBA ‫دهد؟‬ ‫انجام‬ ‫‌تواند‬ ‫ی‬‫م‬ ‫فردی‬ ‫چه‬ ‫ولی‬ ‫نیست‬ ‫وسیله‬ ‫به‬ ‫‌تواند‬ ‫ی‬‫م‬ ‫فعالیت‬ ‫این‬ Trigger .‫شود‬ ‫انجام‬ ‫سامانه‬ ‫در‬ ‫شده‬ ‫تعریف‬ ‫های‬ ‫صحت‬ Object ‫داده‬ ‫پایگاه‬ ‫های‬ ‫تمام‬ ‫نام‬ ‫روی‬ ‫مختصر‬ ‫گزارش‬ Package ‫و‬ ‫ها‬ Procedure ‫و‬ ‫ها‬ Function ‫دو‬ ‫یا‬ ‫یک‬ ‫که‬ ‫شرایطی‬ ‫در‬ ،‫ها‬ Object ‫جهت‬ ‫یا‬ ‫و‬ ‫یافته‬ ‫تغییر‬ ‫شخصی‬ ‫توسط‬ Re-Compilation .‫‌اند‬ ‫ه‬‫شد‬ ‫انتخاب‬ ‫جدول‬ SYS.DBA_SOURCE ‫نگهداری‬ ‫منظور‬ ‫به‬ Object ‫مانند‬ ‫داده‬ ‫پایگاه‬ ‫داخلی‬ ‫های‬ Package ‫و‬ ‫ها‬ Package body ‫و‬ ‫ها‬ Procedure ‫مالک‬ ‫توسط‬ ‫غیره‬ ‫و‬ ‫ها‬ Schema .‫‌شود‬ ‫ی‬‫م‬ ‫مدیریت‬ ‫امنیت‬ Role ‫کاربر‬ ‫و‬ ‫در‬ ‫کاربران‬ ‫اطالعات‬ ‫بر‬ ‫مختصر‬ ‫بررسی‬ ‫یک‬ SYS.DBA_USERS ‫صحت‬ ‫از‬ ‫اطمینان‬ ‫برای‬ Tablespace ‫های‬ ‫(از‬ ‫موقتی‬ ‫و‬ ‫‌فرض‬ ‫ش‬‫پی‬ Tablespace ‫عنوان‬ ‫به‬ ‫سیستم‬ Tablespace )‫نشود‬ ‫استفاده‬ ‫کاربری‬ ‫هیچ‬ ‫‌فرض‬ ‫ش‬‫پی‬ ‫جدول‬ ‫در‬ ‫کاربر‬ ‫هر‬ ‫‌های‬ ‫ی‬‫دسترس‬ DBA_SYS_PRIVS .‫است‬ ‫شده‬ ‫ذخیره‬ ‫از‬ ‫اگر‬ Role ‫در‬ ،‫‌شود‬ ‫ی‬‫م‬ ‫استفاده‬ ‫پروفایلی‬ ‫یا‬ SYS.DBA_ROLES ‫و‬ DBA_ROLE_PRIVS ‫و‬ DBA_PROFILES .‫بیابید‬ ‫را‬ ‫آنها‬ ‫‌توانید‬ ‫ی‬‫م‬ ‫بررسی‬ ‫به‬ ‫نیاز‬ ‫است‬ ‫شده‬ ‫تعریف‬ ‫‌ها‬ ‫ن‬‫ستو‬ ‫یا‬ ‫جدول‬ ‫سطح‬ ‫در‬ ‫خاصی‬ ‫امنیت‬ ‫که‬ ‫صورتی‬ ‫در‬ DBA_COL_PRIVS، DBA_COL_PRIVS_MADE، DBA_COL_PRIVS_RECD .‫دارد‬ ‫وجود‬ ‫از‬ ‫کاربر‬ ‫یک‬ ‫سهم‬ ‫‌توانید‬ ‫ی‬‫م‬ ‫راحتی‬ ‫به‬ ‫که‬ ‫باشید‬ ‫داشته‬ ‫توجه‬ Tablespace ‫ایجاد‬ ‫از‬ ‫جلوگیری‬ ‫منظور‬ ‫به‬ ‫را‬ Object .‫دهید‬ ‫قرار‬ ‫صفر‬ ‫برابر‬ ‫ظرفیت‬ ‫‌ریزی‬ ‫ه‬‫برنام‬ ‫حداکثر‬ ‫میزان‬ ‫به‬ ‫‌توان‬ ‫ی‬‫م‬ ‫مستندات‬ ‫این‬ ‫بررسی‬ ‫با‬ ‫و‬ ‫است‬ ‫شده‬ ‫ثبت‬ ‫سایت‬ ‫استاندارد‬ ‫مستندات‬ ‫در‬ ‫مورد‬ ‫این‬ ‫فضای‬ Tablespace .‫‌برد‬ ‫ی‬‫پ‬ ‫غیره‬ ‫و‬ ‫جداول‬ ‫قبیل‬ ‫این‬ ‫افزایش‬ ‫نرخ‬ ‫الگوی‬ ‫یک‬ ‫تشکیل‬ ‫به‬ ‫اصلی‬ ‫جداول‬ ‫کلی‬ ‫حجم‬ ‫آوردن‬ ‫دست‬ ‫به‬ ‫مدت‬ ‫بلند‬ ‫در‬ ‫شاید‬
  • 85. ‫برخی‬ .‫کند‬ ‫کمک‬ DBA ‫در‬ ‫را‬ ‫نتایج‬ ‫این‬ ،‫ظرفیت‬ ‫‌ریزی‬ ‫ه‬‫برنام‬ ‫برای‬ ‫بررسی‬ ‫منظور‬ ‫به‬ ‫ها‬ DBA Schema ‫قرار‬ .‫‌دهند‬ ‫ی‬‫م‬ ‫آخرین‬ ‫اجرای‬ ‫لحظه‬ ‫تا‬ ‫ارقام‬ ‫و‬ ‫آمار‬ ‫این‬ ‫که‬ ‫نکنید‬ ‫فراموش‬ ANALYZE TABLE COMPUTE STATISTICS ‫‌روز‬ ‫ه‬‫ب‬ .‫‌باشد‬ ‫ی‬‫م‬ ‫برای‬ ‫بلکه‬ ‫نیست‬ ‫جداول‬ ‫نیاز‬ ‫مورد‬ ‫میزان‬ ‫جانب‬ ‫از‬ ‫تنها‬ ‫ظرفیت‬ ‫‌ریزی‬ ‫ه‬‫برنام‬ ‫دیگر‬ ‫جنبه‬ Rollback segment ‫و‬ ‫ها‬ Temporary segment .‫‌شود‬ ‫ی‬‫م‬ ‫استفاده‬ ‫نیز‬ ‫دارند‬ ‫داده‬ ‫پایگاه‬ ‫مانند‬ ‫ظرفیت‬ ‫افزایش‬ ‫به‬ ‫نیاز‬ ‫که‬ ‫ها‬ ‫برای‬ ‫است‬ ‫ممکن‬ ‫نیز‬ ‫اضافی‬ ‫‌های‬ ‫ل‬‫دیتافای‬ Rollback segment ‫و‬ ‫ها‬ Temporary segment ‫نیاز‬ ‫جدید‬ ‫ها‬ .‫باشد‬ ‫برخی‬ DBA ‫تعداد‬ ‫نمودن‬ ‫اضافه‬ ‫سیاست‬ ‫ها‬ Redo log file groups ‫کاربران‬ ‫تعداد‬ ‫اساس‬ ‫بر‬ ‫ها‬ Online .‫دارند‬ ‫اقدامات‬ ‫آخرین‬ .‫دارد‬ ‫وجود‬ ‫انجام‬ ‫برای‬ ‫مواردی‬ ‫همیشه‬ ‫تمام‬ ‫وضعیت‬ ‫بررسی‬ ‫مانند‬ Tablespace ‫و‬ ‫ها‬ Rollback segment ‫وضعیت‬ ‫در‬ ‫که‬ ‫ها‬ Online .‫باشند‬ ‫اینکه‬ ‫و‬ SQL*Net listener .‫باشد‬ ‫فعالیت‬ ‫حال‬ ‫در‬ .‫باشد‬ ‫راهگشا‬ ‫بسیار‬ ‫‌تواند‬ ‫ی‬‫م‬ ‫موارد‬ ‫این‬ ‫بررسی‬ ‫خصوص‬ ‫در‬ ‫مختصر‬ ‫مستند‬ ‫یک‬ ‫بنابراین‬ ‫‌بندی‬ ‫ع‬‫جم‬ ‫و‬ ‫باشد‬ ‫لیست‬ ‫چک‬ ‫مختصر‬ ‫‌های‬ ‫م‬‫آیت‬ ‫یکسری‬ ‫عنوان‬ ‫به‬ ‫تنها‬ ‫‌تواند‬ ‫ی‬‫م‬ ‫موارد‬ ‫این‬ ،‫شد‬ ‫اشاره‬ ‫ابتدا‬ ‫در‬ ‫که‬ ‫همانطور‬ ‫هر‬ DBA .‫نماید‬ ‫تهیه‬ ‫را‬ ‫خود‬ ‫تجربه‬ ‫اساس‬ ‫بر‬ ‫متناسب‬ ‫لیست‬ ‫باید‬ ‫دیگران‬ ‫برای‬ ‫‌تواند‬ ‫ی‬‫م‬ ‫نظر‬ ‫به‬ ‫و‬ ‫داشته‬ ‫را‬ ‫کاربرد‬ ‫بیشترین‬ ْ‫شخصا‬ ‫که‬ ‫است‬ ‫شده‬ ‫ذکر‬ ‫دلیل‬ ‫این‬ ‫به‬ ‫تنها‬ ‫موارد‬ ‫این‬ .‫باشد‬ ‫مفید‬ ‫نیز‬
  • 86. ‫نصب‬ ‫جهت‬ ‫را‬ ‫زیر‬ ‫مراحل‬ MySQL ‫نمایید‬ ‫پیگیری‬ ‫ترتیب‬ ‫به‬ : 1 . ‫دریافت‬ MySQL Yum Repository # wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm --------------- On RHEL/CentOS 6 --------------- # wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm --------------- On RHEL/CentOS 5 --------------- # wget http://dev.mysql.com/get/mysql57-community-release-el5-7.noarch.rpm --------------- On Fedora 23 --------------- # wget http://dev.mysql.com/get/mysql57-community-release-fc23-7.noarch.rpm --------------- On Fedora 22 --------------- # wget http://dev.mysql.com/get/mysql57-community-release-fc22-7.noarch.rpm --------------- On Fedora 21 --------------- # wget http://dev.mysql.com/get/mysql57-community-release-fc21-7.noarch.rpm # yum install mysql-community-server # dnf install mysql-community-server
  • 87. . Start ‫سرور‬ ‫کردن‬ MySQL ‫آمیز‬ ‫موفقیت‬ ‫نصب‬ ‫از‬ ‫بعد‬ MySQL ‫سرور‬ ‫که‬ ‫رسیده‬ ‫آن‬ ‫زمان‬ ، MySQL ‫زیر‬ ‫دستور‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫را‬ Start ‫کنیم‬ . #service mysql start or systemctl start mariadb ‫ورژن‬ ‫به‬ ‫توان‬ ‫می‬ ‫زیر‬ ‫دستور‬ ‫با‬ mysql : ‫برد‬ ‫پی‬
  • 88. ‫امن‬ ‫نصب‬ MySQL ‫دستور‬ mysql_secure_installation ‫نصب‬ ‫که‬ ‫میدهد‬ ‫اجازه‬ ‫شما‬ ‫به‬ MySQL ‫بوسیله‬ ‫ایمن‬ ‫بصورت‬ ‫را‬ ‫خود‬ ‫جمله‬ ‫از‬ ‫مهمی‬ ‫تنظیمات‬ ‫انجام‬ : root password ‫کاربران‬ ‫حذف‬ ، anonymous ‫حذف‬ ، rootlogin ‫و‬ ... ‫انجام‬ ‫دهید‬ . ‫نکته‬ : MySQL ‫نسخه‬ 5.7 ‫مسیر‬ ‫در‬ ‫موقتی‬ ‫رندم‬ ‫عبور‬ ‫کلمه‬ ‫یک‬ ‫بعدی‬ ‫های‬ ‫نسخه‬ ‫و‬ / var.log/mysqld.log ‫امن‬ ‫اجرای‬ ‫از‬ ‫قبل‬ ‫را‬ ‫عبور‬ ‫کلمه‬ ‫زیر‬ ‫دستور‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫میتوانید‬ ‫که‬ ‫میکنند‬ ‫تولید‬ MySQL ‫نمایید‬ ‫مشاهده‬ . # grep 'temporary password' /var/log/mysqld.log ‫نصب‬ ‫زیر‬ ‫دستور‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫توانید‬ ‫می‬ ،‫میدانید‬ ‫را‬ ‫عبور‬ ‫کلمه‬ ‫که‬ ‫حال‬ MySQL ‫انجام‬ ‫امن‬ ‫بصورت‬ ‫را‬ ‫خود‬ ‫دهید‬ : # mysql_secure_installation ‫نکته‬ : ‫جدید‬ ‫عبور‬ ‫کلمه‬ ‫کردن‬ ‫وارد‬ Root ‫فایل‬ ‫از‬ ‫شما‬ ‫موقتی‬ ‫عبور‬ ‫کلمه‬ ‫که‬ ‫معناست‬ ‫این‬ ‫به‬ / var/log/mysqld.log ‫میباشد‬ .
  • 90. ‫عبور‬ ‫کلمه‬ ‫و‬ ‫کاربر‬ ‫ایجاد‬ ‫در‬ ‫داده‬ ‫پایگاه‬ MySQL ‫نام‬ ‫به‬ ‫مدیر‬ ‫کاربر‬ ‫یک‬ ‫دارای‬ root ‫است‬ . ‫برای‬ ‫عبوری‬ ‫کلمه‬ ‫زیر‬ ‫دستور‬ ‫با‬ ‫باید‬ root ‫تعیین‬ ‫کنیم‬ . ‫مدیریتی‬ ‫ابزار‬ ‫از‬ ‫کار‬ ‫این‬ ‫برای‬ mysqladmin ‫میکنیم‬ ‫استفاده‬ . ‫به‬ ‫که‬ ‫است‬ ‫مدیریتی‬ ‫دستور‬ ‫یک‬ ،‫ابزار‬ ‫این‬ ‫بسته‬ ‫همراه‬ mysql ‫میشود‬ ‫نصب‬ . ‫سوئیچ‬ ‫زیر‬ ‫خط‬ ‫در‬ - u ‫کننده‬ ‫تعیین‬ Username ‫سوئیچ‬ ‫و‬ password ‫تعیین‬ ‫کننده‬ Password ‫است‬ ‫کاربر‬ ‫برای‬ ‫عبور‬ ‫کلمه‬ ‫یا‬ . ‫است‬ ‫زیر‬ ‫بصورت‬ ‫کاربر‬ ‫یک‬ ‫برای‬ ‫پسورد‬ ‫تعیین‬ ‫کلی‬ ‫شکل‬ # mysqladmin -u < Username > password < Your – Password > ‫کاربر‬ ‫پسورد‬ ‫تعیین‬ ‫برای‬ ‫مثال‬ ‫بطور‬ root ‫کلمه‬ ‫را‬ ‫کاربر‬ ‫پسورد‬ ‫که‬ ‫مینویسیم‬ ‫را‬ ‫زیر‬ ‫خط‬ P@ssw0rd ‫کاربر‬ ‫پس‬ ‫این‬ ‫از‬ ‫و‬ ‫میکند‬ ‫تعیین‬ root ‫وارد‬ ‫میتواند‬ ‫کلمه‬ ‫این‬ ‫با‬ MySQL ‫شود‬ # mysqladmin -u root password P@ssw0rd ‫به‬ ‫اتصال‬ MySQL Server ‫فرمان‬ ‫خط‬ ‫محیط‬ ‫وارد‬ ‫چگونه‬ MySQL ‫شویم؟‬ ‫شویم‬ ‫سیستم‬ ‫وارد‬ ‫میتوانیم‬ ،‫پسوردش‬ ‫و‬ ‫کاربر‬ ‫هر‬ ‫ایجاد‬ ‫از‬ ‫پس‬ . ‫محیط‬ ‫به‬ ‫ورود‬ ‫برای‬ MySQL ‫محیط‬ ‫این‬ ‫در‬ ‫که‬ ‫و‬ ‫کاربران‬ ‫به‬ ‫مجوزها‬ ‫اعطای‬ ‫و‬ ‫کاربران‬ ‫حذف‬ ،‫ایجاد‬ ‫مانند‬ ‫مدیریتی‬ ‫اعمال‬ ‫میتوانیم‬ ... ‫دهیم‬ ‫راانجام‬ . ‫دستور‬ ‫از‬ ‫باید‬ ‫محیط‬ ‫این‬ ‫به‬ ‫ورود‬ ‫برای‬ mysql ‫کنیم‬ ‫استفاده‬ ‫زیر‬ ‫کلی‬ ‫شکل‬ ‫به‬ . ‫از‬ ‫زیر‬ ‫کلی‬ ‫شکل‬ ‫در‬ ‫دستور‬ mysql ‫سوئیچ‬ - u ‫یا‬ ‫کاربری‬ ‫نام‬ ‫تعیین‬ ‫برای‬ Username ‫سو‬ ‫و‬ ‫ئیچ‬ - p ‫است‬ ‫پسورد‬ ‫کردن‬ ‫وارد‬ ‫معرف‬ . ‫سوئیچ‬ ‫جلوی‬ ‫بیشتر‬ ‫امنیت‬ ‫برای‬ - p ‫زدن‬ ‫و‬ ‫زیر‬ ‫کلی‬ ‫شکل‬ ‫نوشتن‬ ‫از‬ ‫پس‬ ‫بلکه‬ ‫نویسیم‬ ‫نمی‬ ‫را‬ ‫پسورد‬ Enter ‫یک‬ ‫شود‬ ‫می‬ ‫داده‬ ‫نمایش‬ ‫شما‬ ‫از‬ ‫پسورد‬ ‫گرفتن‬ ‫برای‬ ‫اعالن‬ # mysql -u Username -p ‫کاربر‬ ‫برای‬ ‫مثال‬ ‫بطور‬ root ‫است‬ ‫زیر‬ ‫بصورت‬ # mysql -u root -p ‫از‬ ‫پس‬ Enter ‫اعالن‬ ‫باال‬ ‫خط‬ ‫زدن‬ Enter Password ‫کاربر‬ ‫پسورد‬ ‫باید‬ ‫که‬ ‫میشود‬ ‫داده‬ ‫نشان‬ root ‫کنید‬ ‫وارد‬ ‫را‬ . ‫فرمان‬ ‫خط‬ ‫محیط‬ ‫اعالن‬ ‫باشید‬ ‫کرده‬ ‫وارد‬ ‫درست‬ ‫را‬ ‫پسورد‬ ‫اگر‬ MySQL . ‫میشود‬ ‫داده‬ ‫نشان‬ ‫زیر‬ ‫بصورت‬ Mysql >
  • 91. ‫میتوانید‬ ‫پس‬ ‫این‬ ‫از‬ Query ‫کنید‬ ‫اجرا‬ ‫را‬ ‫ها‬ . ‫سرویس‬ ‫دلیلی‬ ‫هر‬ ‫به‬ ‫اگر‬ mariadb | mysqld ‫یا‬ ‫شد‬ ‫مشکل‬ ‫دچار‬ ‫یا‬ ‫مجدد‬ ‫اندازی‬ ‫راه‬ ‫آنرا‬ ‫میخواهید‬ ‫اینکه‬ reset ‫دهید‬ ‫انجام‬ ‫را‬ ‫کار‬ ‫این‬ ‫زیر‬ ‫های‬ ‫دستور‬ ‫از‬ ‫یکی‬ ‫با‬ ‫کنید‬ . ‫که‬ ‫تفاوتی‬ ‫بین‬ reload ‫و‬ restart ‫با‬ ‫که‬ ‫است‬ ‫این‬ ‫دارد‬ ‫وجود‬ reload ‫سرور‬ ‫به‬ ‫کاربران‬ ‫ارتباط‬ ‫کردن‬ mysql ‫با‬ ‫ولی‬ ‫شد‬ ‫نخواهد‬ ‫قطع‬ restart ‫یکبار‬ ‫سرویس‬ ‫کردن‬ stop ‫نو‬ ‫از‬ ‫و‬ start ‫ارتباط‬ ‫قطع‬ ‫باعث‬ ‫که‬ ‫شود‬ ‫می‬ ‫میشود‬ . ‫را‬ ‫سرویس‬ ‫هم‬ ‫دستور‬ ‫سومین‬ stop ‫میکند‬ #systemctl reload mysqld |mariadb # systemctl restart mysqld |mariadb # systemctl stop mysqld |mariadb ‫دستور‬ ‫دو‬ ‫با‬ mysqladmin ‫و‬ mysql ‫شدیم‬ ‫آشنا‬ . ‫می‬ ‫استفاده‬ ‫مدیریتی‬ ‫کارهای‬ ‫برای‬ ‫دستور‬ ‫اولین‬ ‫دستور‬ ‫و‬ ‫شود‬ mysql ‫های‬ ‫سوئیچ‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫است‬ ‫زیادی‬ ‫های‬ ‫سوئیچ‬ ‫ای‬ ‫دار‬ ‫که‬ - u ‫و‬ - p ‫محیط‬ ‫وارد‬ MySQL ‫بشویم‬ . ‫محیط‬ ‫یک‬ ‫وارد‬ ‫ما‬ ‫باال‬ ‫مثال‬ ‫در‬ MySQL ‫در‬ Localhost ‫کالینت‬ ‫یک‬ ‫از‬ ‫میتوانیم‬ ‫ولی‬ ‫شدیم‬ MySQL ‫سرور‬ ‫از‬ ‫یا‬ MySQL ‫سرور‬ ‫یک‬ ‫وارد‬ ‫دیگری‬ MySQL .‫شویم‬ ‫معماری‬ ‫حالت‬ ‫این‬ ‫به‬ Client/Server . ‫گویند‬ ‫دستور‬ ‫بررسی‬ ‫به‬ ‫آینده‬ ‫در‬ : ‫نکته‬ mysqladmin . ‫پرداخت‬ ‫خواهیم‬ ‫محیط‬ ‫دستورهای‬ ‫اجرای‬ MySQL ‫با‬ ‫باشید‬ ‫توانسته‬ ‫اگر‬ Username/Password ‫محیط‬ ‫وارد‬ MySQL ، ‫باشید‬ ‫شده‬ ‫کنید‬ ‫اجرا‬ ‫که‬ ‫دستوری‬ ‫اولین‬ help ‫است‬ . ‫میدهد‬ ‫نشان‬ ‫را‬ ‫محیط‬ ‫این‬ ‫فرامین‬ ‫تمامی‬ ‫لیست‬ ‫دستور‬ ‫این‬ . ‫در‬ ‫دستورها‬ ‫تمامی‬ ‫کنید‬ ‫(دقت‬ MySQL ‫خود‬ ‫و‬ ‫هستند‬ ‫کوچک‬ MySQL ) ‫است‬ ‫حساس‬ ‫کوچکی‬ ‫و‬ ‫بزرگی‬ ‫به‬
  • 92. ‫مانند‬ ‫ای‬ ‫شده‬ ‫خالصه‬ ‫شکل‬،‫دستورهای‬ ‫تمامی‬ c ‫ندارد‬ ‫تفاوتی‬ ‫دستور‬ ‫کامل‬ ‫نوشتن‬ ‫با‬ ‫که‬ ‫دارند‬ ‫را‬ . ‫د‬ ‫پرداخت‬ ‫خواهیم‬ ‫آنها‬ ‫از‬ ‫برخی‬ ‫توضیح‬ ‫به‬ ‫ادامه‬ ‫ر‬ :  ‫دستور‬ connect : ‫برای‬ connect ‫یا‬ ‫مجدد‬ reconnect ‫است‬ ‫شدن‬ . ‫می‬ ‫و‬ ‫است‬ ‫زیر‬ ‫بصورت‬ ‫آن‬ ‫کلی‬ ‫شکل‬ ‫نوشتن‬ ‫جای‬ ‫به‬ ‫توانید‬ connect ‫از‬ r ‫کنید‬ ‫استفاده‬ . ‫پارامترهای‬ db_name ‫و‬ host_name ‫و‬ ‫هستند‬ ‫اختیاری‬ ‫دستور‬ ‫نوشتن‬ connect ‫یا‬ ‫تنهایی‬ ‫به‬ r ‫کند‬ ‫می‬ ‫کفایت‬ . connect [db_name host_name]], r [db_name host_name ]] ‫دستور‬ system : ‫مانند‬ ‫عامل‬ ‫سیستم‬ ‫دستور‬ ‫یک‬ ‫اجرای‬ ‫باعث‬ ls ‫یا‬ ‫و‬ ‫لینوکس‬ ‫در‬ dir ‫محیط‬ ‫درون‬ ‫از‬ ‫ویندوز‬ ‫در‬ MySQL ‫میشود‬ . ‫است‬ ‫زیر‬ ‫بصورت‬ ‫آن‬ ‫کلی‬ ‫شکل‬ . ‫جای‬ command ‫بنویسید‬ ‫توانید‬ ‫می‬ ‫را‬ ‫دستوری‬ ‫هر‬ . ‫خالصه‬ ‫شکل‬ ‫دستور‬ ‫شده‬ system ‫نماد‬ ! ‫است‬ . system command, ! command ‫دستور‬ status : ‫یا‬ ‫حالت‬ ‫نمایش‬ Status ‫به‬ ‫مربوط‬ Connection ‫دهد‬ ‫می‬ ‫نشان‬ ‫را‬ ‫فعلی‬ . ‫همچون‬ ‫اطالعاتی‬ : Session ID ‫امن‬ ‫پروتکل‬ ‫از‬ ‫آیا‬ ،‫است‬ ‫شده‬ ‫وارد‬ ‫ماشین‬ ‫کدام‬ ‫از‬ ‫و‬ ‫کاربری‬ ‫نام‬ ، SSL ‫و‬ ‫است‬ ‫شده‬ ‫استفاده‬ … ‫را‬ ‫دهد‬ ‫می‬ ‫نشان‬ . ‫یک‬ ‫ورود‬ ‫که‬ ‫است‬ ‫عبور‬ ‫کلمه‬ ‫و‬ ‫کاربری‬ ‫نام‬ ‫یک‬ ‫کردن‬ ‫وارد‬ ‫به‬ ‫نیاز‬ ‫ارتباط‬ ‫هر‬ ‫ایجاد‬ ‫برای‬ Session ‫ترکیب‬ ‫برای‬ Username/Password ‫شود‬ ‫می‬ ‫ایجاد‬ . ‫های‬ ‫ماشین‬ ‫از‬ ‫یا‬ ‫ماشین‬ ‫یک‬ ‫از‬ ‫که‬ ‫است‬ ‫ممکن‬ ‫البته‬ ‫کاربری‬ ‫نام‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫و‬ ‫متفاوت‬ / ‫چندین‬ ‫یکسان‬ ‫عبور‬ ‫کلمه‬ Session
  • 93. ‫کدام‬ ‫هر‬ ‫که‬ ‫شود‬ ‫ایجاد‬ ID ‫دارند‬ ‫را‬ ‫خودشان‬ ‫خاص‬ . ‫کردن‬ ‫محدود‬ ‫امکان‬ ‫البته‬ Session ‫هر‬ ‫برای‬ ‫ها‬ Username ‫است‬ ‫مقدور‬ . ‫است‬ ‫زیر‬ ‫بصورت‬ ‫آن‬ ‫از‬ ‫استفاده‬ ‫کلی‬ ‫شکل‬ status , s ‫دستور‬ quit ‫سرور‬ ‫با‬ ‫ارتباط‬ ‫قطع‬ ‫برای‬ : MySQL ‫دستور‬ ‫از‬ ‫توان‬ ‫می‬ quit ‫یا‬ q .‫نمود‬ ‫استفاده‬ mysql > quit Bye ‫ترکیبی‬ ‫های‬ ‫کلمه‬ ‫فشردن‬ ‫با‬ ‫ارتباط‬ ‫میتوان‬ ‫همچنین‬ Ctrl+D .‫کرد‬ ‫قطع‬ ‫نیز‬ :‫نمایید‬ ‫مراجعه‬ ‫زیر‬ ‫آدرس‬ ‫به‬ ‫توانید‬ ‫می‬ ‫بیشتر‬ ‫اطالعات‬ ‫کسب‬ ‫جهت‬ http://dev.mysql.com/doc/refman/5.0/en/mysql-commands.html ‫فایل‬ my.cnf ‫پیکربندی‬ ‫فایلی‬ MySQL / ‫دایرکتوری‬ ‫دردرون‬ ‫که‬ ‫است‬ etc .‫دارد‬ ‫قرار‬ ‫فایل‬،‫دیگر‬ ‫فایل‬ .‫میشود‬ ‫بررسی‬ ‫فایل‬ ‫این‬،‫فصل‬ ‫این‬ ‫مطالب‬ ‫ادامه‬ ‫در‬ Log ‫سرویس‬ mysqld ‫در‬ ‫که‬ ‫است‬ / ‫مسیر‬ var/log ‫نام‬ ‫به‬ ‫و‬ mysqld.log . ‫دارد‬ ‫قرار‬ : ‫داده‬ ‫پایگاه‬ ‫ایجاد‬ ‫داده‬ ‫پایگاه‬ ‫ایجاد‬ ‫برای‬ tmp1 : ‫کنیم‬ ‫می‬ ‫عمل‬ ‫زیر‬ ‫بصورت‬
  • 94. : ‫نکته‬ ‫عبارت‬ ‫فوق‬ ‫دستور‬ ‫اجرای‬ ‫از‬ ‫پس‬ ‫صورتیکه‬ ‫در‬ query was correct ‫یا‬ Query OK ‫به‬ ،‫شود‬ ‫داده‬ ‫نمایش‬ ‫که‬ ‫معناست‬ ‫این‬ database ‫است‬ ‫شده‬ ‫ایجاد‬ ‫موفقیت‬ ‫با‬ . ‫از‬ ‫استفاده‬ ‫با‬ ‫را‬ ‫موضوع‬ ‫این‬ ‫صحت‬ ‫میتوانید‬ ‫شما‬ : ‫نمایید‬ ‫بررسی‬ ‫زیر‬ ‫دستور‬ ‫توجه‬ : ‫است‬ ‫بزرگ‬ ‫و‬ ‫کوچک‬ ‫حروف‬ ‫به‬ ‫حساس‬ ‫داده‬ ‫پایگاه‬ ‫نام‬ ‫لینوکس‬ ‫در‬ . ‫انتخاب‬ database ‫که‬ ‫دارید‬ ‫نیاز‬ ‫شما‬ ‫حال‬ database ‫نمایید‬ ‫انتخاب‬ ‫آن‬ ‫روی‬ ‫بر‬ ‫کار‬ ‫جهت‬ ‫اید‬ ‫کرده‬ ‫ایجاد‬ ‫قبل‬ ‫مرحله‬ ‫در‬ ‫که‬ ‫را‬ . ‫برای‬ ‫کنید‬ ‫استفاده‬ ‫زیر‬ ‫دستور‬ ‫از‬ ‫میتوانید‬ ‫منظور‬ ‫این‬
  • 95. ‫می‬ ‫دفعات‬ ‫به‬ ‫و‬ ‫شده‬ ‫ایجاد‬ ‫یکبار‬ ‫تنها‬ ‫داده‬ ‫پایگاه‬ ‫کرد‬ ‫انتخاب‬ ‫را‬ ‫آن‬ ‫توان‬ . ‫همزمان‬ ‫را‬ ‫نظر‬ ‫مورد‬ ‫داده‬ ‫پایگاه‬ ‫میتوان‬ ‫سرور‬ ‫با‬ ‫ارتباط‬ ‫برقراری‬ ‫با‬ MySQL : ‫نمود‬ ‫مشخص‬ ‫زیر‬ ‫دستور‬ ‫طریق‬ ‫از‬ # mysql -h <host-name or IP-Address> -u <username> -p <database-name> Enter password: ******* ‫در‬ ‫جداول‬ ‫ایجاد‬ MySQL ‫نمایید‬ ‫استفاده‬ ‫زیر‬ ‫دستور‬ ‫از‬ ‫جدول‬ ‫ایجاد‬ ‫برای‬ ،‫آن‬ ‫انتخاب‬ ‫و‬ ‫داده‬ ‫پایگاه‬ ‫ایجاد‬ ‫از‬ ‫بعد‬ . ‫قصد‬ ‫من‬ ‫مثال‬ ‫عنوان‬ ‫به‬ ‫نام‬ ‫به‬ ‫جدول‬ ‫یک‬ ‫دارم‬ tbyashar : ‫کنم‬ ‫ایجاد‬
  • 96. . ‫نپذیرد‬ ‫خالی‬ ‫مقادیر‬ ‫که‬ ‫جدول‬ ‫ایجاد‬
  • 98. ‫داده‬ ‫انواع‬ ‫در‬ ‫ها‬ MySQL ‫در‬ MySQL ‫دارد‬ ‫وجود‬ ‫داده‬ ‫اصلی‬ ‫نوع‬ ‫سه‬ : ‫تارخ‬ ‫نوع‬ ‫و‬ ‫عددی‬ ‫نوع‬ ،‫متنی‬ ‫نوع‬ / ‫زمان‬ • ‫متنی‬ ‫های‬ ‫داده‬
  • 101. : ‫جدول‬ ‫به‬ ‫جدید‬ ‫ستون‬ ‫کردن‬ ‫اضافه‬ ‫جدول‬ ‫های‬ ‫فیلد‬ ‫در‬ ‫مقادیر‬ ‫کردن‬ ‫وارد‬
  • 102. : ‫کوئری‬ ‫یک‬ ‫در‬ ‫مقادیر‬ ‫چندین‬ ‫کردن‬ ‫وارد‬
  • 103. : ‫جدول‬ ‫ستون‬ ‫در‬ ‫فیلد‬ ‫نام‬ ‫تعغییر‬ : ‫جدول‬ ‫ستون‬ ‫از‬ ‫فیلد‬ ‫حذف‬
  • 104. : ‫داده‬ ‫پایگاه‬ ‫از‬ ‫جدول‬ ‫حذف‬ : ‫داده‬ ‫پایگاه‬ ‫حذف‬
  • 106. ‫دستور‬ select : ‫کلی‬ ‫ساختار‬ select : ‫باشد‬ ‫می‬ ‫زیر‬ ‫قرار‬ ‫به‬ SELECT field1, field2,...fieldN FROM table_name1, table_name2… [WHERE Clause] [OFFSET M ] [LIMIT N] You can use one or more tables separated by comma to include various conditions using a WHERE clause, but the WHERE clause is an optional part of the SELECT command. • You can fetch one or more fields in a single SELECT command. • You can specify star (*) in place of fields. In this case, SELECT will return all the fields. • You can specify any condition using the WHERE clause. • You can specify an offset using OFFSET from where SELECT will start returning records. By default, the offset starts at zero. • You can limit the number of returns using the LIMIT attribute
  • 107. ‫ساختار‬ WHERE clause : : ‫باشد‬ ‫می‬ ‫زیر‬ ‫شرح‬ ‫به‬ ‫کلی‬ ‫شکل‬ SELECT field1, field2,...fieldN table_name1, table_name2... [WHERE condition1 [AND [OR]] condition2..... You can use one or more tables separated by a comma to include various conditions using a WHERE clause, but the WHERE clause is an optional part of the SELECT command. • You can specify any condition using the WHERE clause. • You can specify more than one condition using the AND or the OR operators. • A WHERE clause can be used along with DELETE or UPDATE SQL command also to specify a condition. The WHERE clause works like an if condition in any programming language. This clause is used to compare the given value with the field value available in a MySQL table. If the given value from outside is equal to the available field value in the MySQL table, then it returns that row. Here is the list of operators, which can be used with the WHERE clause. Assume field A holds 10 and field B holds 20, then −
  • 108. update : ‫جداول‬ ‫های‬ ‫داده‬ ‫کردن‬ : ‫باشد‬ ‫می‬ ‫زیر‬ ‫شرح‬ ‫به‬ ‫کلی‬ ‫ساختار‬ UPDATE table_name SET field1 = new-value1, field2 = new-value2 [WHERE Clause]
  • 110. ‫ساختار‬ ‫ایجاد‬ auto number : update : ‫کردن‬ : ‫هست‬ ‫شکل‬ ‫این‬ ‫به‬ ‫دستور‬ ‫کلی‬ ‫شکل‬ UPDATE table_name SET field1 = new-value1, field2 = new-value2 [WHERE Clause]
  • 111. update ‫با‬ replace : ‫ساختار‬ ‫کلی‬ ‫شکل‬ replace : ‫باشد‬ ‫می‬ ‫زیر‬ ‫قرار‬ ‫به‬ replace(FIELD_NAME, 'find this string', 'replace found string with this string'); replace ‫با‬ select :
  • 113. ‫از‬ ‫جدول‬ ‫ایجاد‬ select : : ‫باشد‬ ‫می‬ ‫زیر‬ ‫شرح‬ ‫به‬ ‫دستور‬ ‫کلی‬ ‫ساختار‬ CREATE TABLE table_name [ ( column_name [, ...] ) ] AS select [ * ! ( column_name [, ...] ) ] FROM source_table_name
  • 114. : ‫جدول‬ ‫از‬ ‫داده‬ ‫حذف‬ : ‫باشد‬ ‫می‬ ‫زیر‬ ‫شرح‬ ‫به‬ ‫کلی‬ ‫شکل‬ DELETE FROM table_name [WHERE Clause]
  • 115. ( ‫گیری‬ ‫گزارش‬ like : ) : ‫باشد‬ ‫می‬ ‫زیر‬ ‫شرح‬ ‫به‬ ‫کلی‬ ‫شکل‬ SELECT field1, field2,...fieldN table_name1, table_name2... WHERE field1 LIKE condition1 [AND [OR]] filed2 = 'somevalue' • You can specify any condition using the WHERE clause. • You can use the LIKE clause along with the WHERE clause. • You can use the LIKE clause in place of the equals to sign. • When LIKE is used along with % sign then it will work like a meta character search. • You can specify more than one condition using AND or OR operators. • A WHERE...LIKE clause can be used along with DELETE or UPDATE SQL command also to specify a condition.
  • 117. " ‫عبارات‬ ‫جستجو‬ ‫در‬ ‫نخواهیم‬ ‫اگر‬ b", "s " ‫یا‬ ," p ‫؟‬ ‫کرد‬ ‫باید‬ ‫چه‬ ‫نشود‬ ‫شامل‬ ‫را‬ " SELECT * FROM Customers WHERE City LIKE '[!bsp]%'; : ‫شود‬ ‫شامل‬ ‫را‬ ‫ما‬ ‫نظر‬ ‫مد‬ ‫عبارت‬ ‫تا‬ ‫عبارت‬ ‫هر‬ SELECT * FROM Customers WHERE City LIKE '_erlin'; : ‫شود‬ ‫ها‬ ‫کاراکتر‬ ‫این‬ ‫شامل‬ ‫ما‬ ‫عبارت‬ SELECT * FROM Customers WHERE City LIKE 'L_n_on';
  • 118. : ‫سازی‬ ‫مرتب‬ . ‫باشد‬ ‫می‬ ‫زیر‬ ‫شرح‬ ‫به‬ ‫کلی‬ ‫ساختار‬ SELECT field1, field2,...fieldN table_name1, table_name2... ORDER BY field1, [field2...] [ASC [DESC]] • You can sort the returned result on any field, if that field is being listed out. • You can sort the result on more than one field. • You can use the keyword ASC or DESC to get result in ascending or descending order. By default, it's the ascending order. • You can use the WHERE...LIKE clause in the usual way to put a condition. : ‫تعداد‬ ‫شمارش‬ : ‫بازگشتی‬ ‫تابع‬
  • 120. Lpad :
  • 125. : ‫جدول‬ ‫از‬ ‫مقدار‬ ‫بیشترین‬ ‫کردن‬ ‫پیدا‬
  • 127. join :
  • 130. : ‫رود‬ ‫می‬ ‫کار‬ ‫به‬ ‫مدیریتی‬ ‫ساختارهای‬ ‫انجام‬ ‫برای‬ ‫دستور‬ ‫این‬ : ‫باشد‬ ‫می‬ ‫زیر‬ ‫صورت‬ ‫به‬ ‫برنامه‬ ‫کلی‬ ‫شکل‬ mysqladmin [options] command [command-arg] [command [command-arg]] ... create db_name Create a new database named db_name. • debug Tell the server to write debug information to the error log. The connected user must have the SUPER privilege. Format and content of this information is subject to change. This includes information about the Event Scheduler. See Section 23.4.5, “Event Scheduler Status”. • drop db_name Delete the database named db_name and all its tables. • extended-status Display the server status variables and their values. • flush-hosts Flush all information in the host cache. • flush-logs [log_type ...] Flush all logs. The mysqladmin flush-logs command permits optional log types to be given, to specify which logs to flush. Following the flush-logs command, you can provide a space-separated list of one or more of the following log types: binary, engine, error, general, relay, slow. These correspond to the log types that can be specified for the FLUSH LOGS SQL statement. • flush-privileges Reload the grant tables (same as reload). • flush-status Clear status variables.
  • 131. • flush-tables Flush all tables. • flush-threads Flush the thread cache. • kill id,id,... Kill server threads. If multiple thread ID values are given, there must be no spaces in the list. To kill threads belonging to other users, the connected user must have the CONNECTION_ADMIN or SUPER privilege. • password new_password Set a new password. This changes the password to new_password for the account that you use with mysqladmin for connecting to the server. Thus, the next time you invoke mysqladmin (or any other client program) using the same account, you will need to specify the new password. ping Check whether the server is available. The return status from mysqladmin is 0 if the server is running, 1 if it is not. This is 0 even in case of an error such as Access denied, because this means that the server is running but refused the connection, which is different from the server not running. • processlist Show a list of active server threads. This is like the output of the SHOW PROCESSLIST statement. If the --verbose option is given, the output is like that of SHOW FULL PROCESSLIST. (See Section 13.7.6.29, “SHOW PROCESSLIST Syntax”.) • reload Reload the grant tables. • refresh Flush all tables and close and open log files. • shutdown Stop the server. • start-slave Start replication on a slave server. • status
  • 132. Display a short server status message. • stop-slave Stop replication on a slave server. • variables Display the server system variables and their values. • version Display version information from the server. Uptime The number of seconds the MySQL server has been running. • Threads The number of active threads (clients). • Questions The number of questions (queries) from clients since the server was started. • Slow queries The number of queries that have taken more than long_query_time seconds. See Section 5.4.5, “The Slow Query Log”. • Opens The number of tables the server has opened. • Flush tables The number of flush-*, refresh, and reload commands the server has executed. • Open tables
  • 133. The number of tables that currently are open. Mysqlcheck :
  • 136. mysqldump mysqldump ‫گرفتن‬ ‫برای‬ ‫ابزاری‬ dump ‫باشد‬ ‫می‬ ‫زیر‬ ‫صورت‬ ‫به‬ ‫دستور‬ ‫کلی‬ ‫شکل‬ . ‫هست‬ ‫داده‬ ‫پایگاه‬ ‫از‬ mysqldump [options] > dump.sql : ‫نمونه‬ ‫برای‬ mysqldump -u[username] -p[password] databasename > databasefilename.sql mysqldump -u root -p TUTORIALS tutorials_tbl > dump.txt mysqldump --user=user --password --host=db.example.com --all-databases > db.sql : ‫نظر‬ ‫مد‬ ‫بیس‬ ‫دیتا‬ mysqldump --user=user --password --host=db.example.com tmpdb > db.sql ‫سازی‬ ‫فشرده‬ dump : mysqldump --user=user --password=pass --host=db.example.com wikidb |gzip -cq9 > db.sql.gz SELECT * FROM tutorials_tbl INTO OUTFILE '/tmp/tutorials.txt';
  • 138. import mysql --user=user --password=pass db < db.sql mysqlimport [options] db_name textfile1 [textfile2 ...]
  • 140. mysqlimport --lines-terminated-by="rn" world City.txt mysqlimport --ignore-lines=1 --fields-terminated-by=, --verbose --local -u [user] - p [database] /path/to/address.csv
  • 142. : ‫داده‬ ‫پایگاه‬ ‫کانسپت‬ ‫در‬ ‫ها‬ ‫نقش‬ ‫و‬ ‫افراد‬ ‫انواع‬ • Customer • Business analyst • Database designer • Database administrator • Application developer • Interface designer • Project manager mysqldumpslow mysql> SET GLOBAL slow_query_log = 'ON'; mysql> SET GLOBAL slow_query_log_file = '/var/log/mysql/localhost-slow.log'; mysql> SET GLOBAL log_queries_not_using_indexes = 'ON'; mysql> SET SESSION long_query_time = 1; mysql> SET SESSION min_examined_row_limit = 100; SHOW GLOBAL VARIABLES LIKE 'slow_query_log';
  • 145. . ‫باشد‬ ‫می‬ ‫موجود‬ ‫مختلفی‬ ‫ابزارهای‬ ‫فرم‬ ‫ساخت‬ ‫برای‬ ‫در‬ ‫ساده‬ ‫ساختار‬ ‫زیر‬ ‫در‬ php . ‫شود‬ ‫می‬ ‫بررسی‬
  • 146. Function : <html> <head> <title>PHP with MySQL</title> </head> <body> <?php $retval = mysql_function(value, [value,...]); if( !$retval ) { die ( "Error: a related error message" ); } // Otherwise MySQL or PHP Statements ?> </body> </html> connection : <html> <head> <title>Connecting MySQL Server</title> </head> <body> <?php $dbhost = 'localhost:3306'; $dbuser = 'guest'; $dbpass = 'guest123'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($conn); ?> </body> </html> create database : <html> <head> <title>Creating MySQL Database</title> </head> <body> <?php $dbhost = 'localhost:3036'; $dbuser = 'root'; $dbpass = 'rootpassword'; $conn = mysql_connect($dbhost, $dbuser, $dbpass);
  • 147. if(! $conn ) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully<br />'; $sql = 'CREATE DATABASE TUTORIALS'; $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not create database: ' . mysql_error()); } echo "Database TUTORIALS created successfullyn"; mysql_close($conn); ?> </body> </html> Drop database : <html> <head> <title>Deleting MySQL Database</title> </head> <body> <?php $dbhost = 'localhost:3036'; $dbuser = 'root'; $dbpass = 'rootpassword'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully<br />'; $sql = 'DROP DATABASE TUTORIALS'; $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not delete database: ' . mysql_error()); } echo "Database TUTORIALS deleted successfullyn"; mysql_close($conn); ?> </body> </html> Use database : <html> <head> <title>Selecting MySQL Database</title> </head> <body> <?php $dbhost = 'localhost:3036'; $dbuser = 'guest'; $dbpass = 'guest123'; $conn = mysql_connect($dbhost, $dbuser, $dbpass);
  • 148. if(! $conn ) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_select_db( 'TUTORIALS' ); mysql_close($conn); ?> </body> </html> create tables : <html> <head> <title>Creating MySQL Tables</title> </head> <body> <?php $dbhost = 'localhost:3036'; $dbuser = 'root'; $dbpass = 'rootpassword'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully<br />'; $sql = "CREATE TABLE tutorials_tbl( ". "tutorial_id INT NOT NULL AUTO_INCREMENT, ". "tutorial_title VARCHAR(100) NOT NULL, ". "tutorial_author VARCHAR(40) NOT NULL, ". "submission_date DATE, ". "PRIMARY KEY ( tutorial_id )); "; mysql_select_db( 'TUTORIALS' ); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not create table: ' . mysql_error()); } echo "Table created successfullyn"; mysql_close($conn); ?> </body> </html> Drop tables : <html> <head> <title>Creating MySQL Tables</title> </head> <body> <?php $dbhost = 'localhost:3036';
  • 149. $dbuser = 'root'; $dbpass = 'rootpassword'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully<br />'; $sql = "DROP TABLE tutorials_tbl"; mysql_select_db( 'TUTORIALS' ); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not delete table: ' . mysql_error()); } echo "Table deleted successfullyn"; mysql_close($conn); ?> </body> </html> Insert : <html> <head> <title>Add New Record in MySQL Database</title> </head> <body> <?php if(isset($_POST['add'])) { $dbhost = 'localhost:3036'; $dbuser = 'root'; $dbpass = 'rootpassword'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } if(! get_magic_quotes_gpc() ) { $tutorial_title = addslashes ($_POST['tutorial_title']); $tutorial_author = addslashes ($_POST['tutorial_author']); } else { $tutorial_title = $_POST['tutorial_title']; $tutorial_author = $_POST['tutorial_author']; } $submission_date = $_POST['submission_date']; $sql = "INSERT INTO tutorials_tbl ". "(tutorial_title,tutorial_author, submission_date) "."VALUES ". "('$tutorial_title','$tutorial_author','$submission_date')"; mysql_select_db('TUTORIALS'); $retval = mysql_query( $sql, $conn );
  • 150. if(! $retval ) { die('Could not enter data: ' . mysql_error()); } echo "Entered data successfullyn"; mysql_close($conn); } else { ?> <form method = "post" action = "<?php $_PHP_SELF ?>"> <table width = "600" border = "0" cellspacing = "1" cellpadding = "2"> <tr> <td width = "250">Tutorial Title</td> <td> <input name = "tutorial_title" type = "text" id = "tutorial_title"> </td> </tr> <tr> <td width = "250">Tutorial Author</td> <td> <input name = "tutorial_author" type = "text" id = "tutorial_author"> </td> </tr> <tr> <td width = "250">Submission Date [ yyyy-mm-dd ]</td> <td> <input name = "submission_date" type = "text" id = "submission_date"> </td> </tr> <tr> <td width = "250"> </td> <td> </td> </tr> <tr> <td width = "250"> </td> <td> <input name = "add" type = "submit" id = "add" value = "Add Tutorial"> </td> </tr> </table> </form> <?php } ?> </body> </html> Select :
  • 151. <?php $dbhost = 'localhost:3036'; $dbuser = 'root'; $dbpass = 'rootpassword'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } $sql = 'SELECT tutorial_id, tutorial_title, tutorial_author, submission_date FROM tutorials_tbl'; mysql_select_db('TUTORIALS'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not get data: ' . mysql_error()); } while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { echo "Tutorial ID :{$row['tutorial_id']} <br> ". "Title: {$row['tutorial_title']} <br> ". "Author: {$row['tutorial_author']} <br> ". "Submission Date : {$row['submission_date']} <br> ". "--------------------------------<br>"; } echo "Fetched data successfullyn"; mysql_close($conn); ?> where clause : <?php $dbhost = 'localhost:3036'; $dbuser = 'root'; $dbpass = 'rootpassword'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } $sql = 'SELECT tutorial_id, tutorial_title, tutorial_author, submission_date FROM tutorials_tbl WHERE tutorial_author = "Sanjay"'; mysql_select_db('TUTORIALS'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not get data: ' . mysql_error()); } while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) {
  • 152. echo "Tutorial ID :{$row['tutorial_id']} <br> ". "Title: {$row['tutorial_title']} <br> ". "Author: {$row['tutorial_author']} <br> ". "Submission Date : {$row['submission_date']} <br> ". "--------------------------------<br>"; } echo "Fetched data successfullyn"; mysql_close($conn); ?> update : <?php $dbhost = 'localhost:3036'; $dbuser = 'root'; $dbpass = 'rootpassword'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } $sql = 'UPDATE tutorials_tbl SET tutorial_title="Learning JAVA" WHERE tutorial_id=3'; mysql_select_db('TUTORIALS'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not update data: ' . mysql_error()); } echo "Updated data successfullyn"; mysql_close($conn); ?> delete query : <?php $dbhost = 'localhost:3036'; $dbuser = 'root'; $dbpass = 'rootpassword'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } $sql = 'DELETE FROM tutorials_tbl WHERE tutorial_id=3'; mysql_select_db('TUTORIALS'); $retval = mysql_query( $sql, $conn );
  • 153. if(! $retval ) { die('Could not delete data: ' . mysql_error()); } echo "Deleted data successfullyn"; mysql_close($conn); ?> like clause : <?php $dbhost = 'localhost:3036'; $dbuser = 'root'; $dbpass = 'rootpassword'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } $sql = 'SELECT tutorial_id, tutorial_title, tutorial_author, submission_date FROM tutorials_tbl WHERE tutorial_author LIKE "%jay%"'; mysql_select_db('TUTORIALS'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not get data: ' . mysql_error()); } while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { echo "Tutorial ID :{$row['tutorial_id']} <br> ". "Title: {$row['tutorial_title']} <br> ". "Author: {$row['tutorial_author']} <br> ". "Submission Date : {$row['submission_date']} <br> ". "--------------------------------<br>"; } echo "Fetched data successfullyn"; mysql_close($conn); ?> sorting :
  • 154. <?php $dbhost = 'localhost:3036'; $dbuser = 'root'; $dbpass = 'rootpassword'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } $sql = 'SELECT tutorial_id, tutorial_title, tutorial_author, submission_date FROM tutorials_tbl ORDER BY tutorial_author DESC'; mysql_select_db('TUTORIALS'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not get data: ' . mysql_error()); } while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { echo "Tutorial ID :{$row['tutorial_id']} <br> ". "Title: {$row['tutorial_title']} <br> ". "Author: {$row['tutorial_author']} <br> ". "Submission Date : {$row['submission_date']} <br> ". "--------------------------------<br>"; } echo "Fetched data successfullyn"; mysql_close($conn); ?>
  • 156. ‫دارد؟‬ ‫وظایفی‬ ‫چه‬ ‫سازی‬ ‫ذخیره‬ ‫موتور‬ ( ‫اطالعات‬ ‫مشاهده‬ ‫و‬ ‫حذف‬ ،‫بروزرسانی‬ ،‫ایجاد‬ ‫مسئول‬ ‫سازی‬ ‫ذخیره‬ ‫موتورهای‬ CRUD ‫می‬ ‫داد‬ ‫پایگاه‬ ‫جداول‬ ‫)در‬ ‫داده‬ ‫پایگاه‬ ‫در‬ .‫باشند‬ MySQL ‫سازی‬ ‫ذخیره‬ ‫موتور‬ ‫دو‬ InnoDB ‫و‬ MyISAM .‫دارد‬ ‫وجود‬ … ‫و‬ ‫ها‬ ‫داده‬ ‫به‬ ‫دسترسی‬ ‫سرعت‬ ‫جدول‬ ‫هر‬ InnoDB ( ‫ای‬ ‫خوشه‬ ‫اندیس‬ ‫بنام‬ ‫خاص‬ ‫اندیس‬ ‫یک‬ clusterd index ‫ذخیره‬ ‫آن‬ ‫در‬ ‫رکوردها‬ ‫که‬ ‫دارد‬ ) ‫و‬ ‫رکورد‬ ‫هر‬ ‫های‬ ‫داده‬ ‫که‬ ‫است‬ ‫سریعتر‬ ‫علت‬ ‫این‬ ‫به‬ ‫جستجو‬ ‫اندیس‬ ‫طریق‬ ‫از‬ ‫ها‬ ‫داده‬ ‫به‬ ‫دسترسی‬ .‫شوند‬ ‫می‬ ‫کاهش‬ ‫باعث‬ ‫اغلب‬ ‫ای‬ ‫خوشه‬ ‫اندیس‬ ‫ساختار‬ ،‫بزرگ‬ ‫جداول‬ ‫در‬ .‫دارند‬ ‫قرار‬ ‫صفحه‬ ‫یک‬ ‫در‬ ‫آن‬ ‫جستجوی‬ ‫اندیس‬ ‫عملیات‬ I/O .‫شود‬ ‫می‬ ‫دارند‬ ‫قرار‬ ‫متفاوتی‬ ‫صفحات‬ ‫در‬ ‫داده‬ ‫و‬ ‫اندیس‬ ‫که‬ ‫ساختارهایی‬ ‫به‬ ‫نسبت‬ MyISAM ‫از‬ .‫کند‬ ‫می‬ ‫استفاده‬ ‫ها‬ ‫اندیس‬ ‫جهت‬ ‫دیگری‬ ‫فایل‬ ‫و‬ ‫رکوردها‬ ‫ذخیره‬ ‫جهت‬ ‫فایل‬ ‫یک‬ ‫در‬ InnoDB ( ‫ثانویه‬ ‫های‬ ‫اندیس‬ ‫بخش‬ ‫در‬ .‫شود‬ ‫می‬ ‫ایجاد‬ ‫اصلی‬ ‫کلید‬ ‫اساس‬ ‫بر‬ ‫ای‬ ‫خوشه‬ ‫اندیس‬ secondary indexes ‫نیز‬ ) InnoDB ‫را‬ ‫اصلی‬ ‫کلید‬ ‫های‬ ‫ستون‬ ،‫خود‬ ‫های‬ ‫ستون‬ ‫بر‬ ‫عالوه‬ ‫ها‬ ‫اندیس‬ ‫این‬ .‫دارد‬ ‫بهتری‬ ‫عملکرد‬ ‫و‬ ‫گیرند‬ ‫می‬ ‫بر‬ ‫در‬ ‫نیز‬ InnoDB .‫کند‬ ‫می‬ ‫استفاده‬ ‫ای‬ ‫خوشه‬ ‫اندیس‬ ‫در‬ ‫جستجو‬ ‫برای‬ ‫اصلی‬ ‫کلید‬ ‫مقدار‬ ‫از‬ ‫در‬ MySQL .‫شوند‬ ‫می‬ ‫کش‬ ‫حافظه‬ ‫بافرهای‬ ‫در‬ ‫ها‬ ‫داده‬ ،‫کارایی‬ ‫و‬ ‫سرعت‬ ‫افزایش‬ ‫جهت‬ MyISAM ‫بافرهای‬ ‫از‬ ‫بنام‬ ‫خاصی‬ Key cache ‫از‬ ‫دیگر‬ ‫های‬ ‫داده‬ ‫کردن‬ ‫کش‬ ‫برای‬ ‫و‬ ‫کند‬ ‫می‬ ‫استفاده‬ ‫ها‬ ‫اندیس‬ ‫کردن‬ ‫کش‬ ‫منظور‬ ‫به‬ ‫مقابل‬ ‫در‬ .‫کند‬ ‫می‬ ‫استفاده‬ ‫عامل‬ ‫سیستم‬ ‫حافظه‬ ‫بافرهای‬ InnoDB ‫موسوم‬ ‫فضایی‬ ‫در‬ ‫را‬ ‫ها‬ ‫داده‬ ‫و‬ ‫ها‬ ‫اندیس‬ ‫به‬ buffer pool ‫های‬ ‫درخت‬ ‫قالب‬ ‫در‬ ‫و‬ B-Tree .‫کند‬ ‫می‬ ‫کش‬ ‫ها‬ ‫تراکنش‬ ‫از‬ ‫پشتیبانی‬ ‫طراحی‬ InnoDB ‫مدل‬ ‫اساس‬ ‫بر‬ ACID ‫همچون‬ ‫هایی‬ ‫قابلیت‬ ‫با‬ ‫ها‬ ‫تراکنش‬ ‫که‬ ‫است‬ commit ، roll back ‫و‬ ‫در‬ .‫کند‬ ‫می‬ ‫پشتیبانی‬ ‫را‬ ‫کرش‬ ‫زمان‬ ‫در‬ ‫بازیابی‬ InnoDB ‫حالت‬ ‫بودن‬ ‫فعال‬ ‫با‬ autocommit ‫کاربر‬ ‫فعالیت‬ ‫تمام‬ ، ‫اگر‬ .‫گیرد‬ ‫می‬ ‫انجام‬ ‫تراکش‬ ‫درون‬ autocommit ‫از‬ ‫دستی‬ ‫بصورت‬ ‫توان‬ ‫می‬ ‫نباشد‬ ‫فعال‬ commit ‫و‬ roll back .‫نمود‬ ‫استفاده‬ Commit ‫و‬ ‫کند‬ ‫می‬ ‫ثبت‬ ‫دائمی‬ ‫بصورت‬ ‫را‬ ‫فعلی‬ ‫تراکنش‬ ‫در‬ ‫شده‬ ‫انجام‬ ‫تغییرات‬ roll back ‫تمام‬ .‫کند‬ ‫می‬ ‫لغو‬ ‫را‬ ‫جاری‬ ‫تراکنش‬ ‫تغییرات‬ ‫موتور‬ ،‫مقابل‬ ‫در‬ MyISAM .‫کند‬ ‫نمی‬ ‫پشتیبانی‬ ‫ها‬ ‫تراکنش‬ ‫از‬ ‫سازی‬ ‫موازی‬ ‫بزرگ‬ ‫مشکالت‬ ‫از‬ ‫یکی‬ MyISAM ‫در‬ .‫است‬ ‫داده‬ ‫ردیف‬ ‫سطح‬ ‫کردن‬ ‫قفل‬ ‫قابلیت‬ ‫نداشتن‬ InnoDB ‫که‬ ‫هنگامی‬ ‫اجرا‬ ‫همزمان‬ ‫بطور‬ ‫توانند‬ ‫می‬ ‫عملیات‬ ‫این‬ ،‫ردیف‬ ‫سطح‬ ‫قفل‬ ‫به‬ ‫توجه‬ ‫با‬ ‫دارد‬ ‫وجود‬ ‫نوشتن‬ ‫عملیات‬ ‫زیادی‬ ‫تعداد‬
  • 157. ‫در‬ ‫جدول‬ ‫سطح‬ ‫کردن‬ ‫قفل‬ ‫قابلیت‬ ‫اما‬ ‫شوند‬ MyISAM .‫دهد‬ ‫نمی‬ ‫را‬ ‫کاری‬ ‫چنین‬ ‫اجازه‬ InnoDB ‫باالی‬ ‫سطوح‬ ‫در‬ .‫شود‬ ‫می‬ ‫استفاده‬ ‫موضوع‬ ‫این‬ ‫برای‬ ‫هم‬ ‫باز‬ ‫ولی‬ ‫دارد‬ ‫را‬ ‫ناسازگار‬ ‫دو‬ ‫به‬ ‫دو‬ ‫کردن‬ ‫قفل‬ ‫مشکل‬ ‫سازی‬ ‫موازی‬ ‫نگهداری‬ ‫و‬ ‫پایداری‬ ‫موتور‬ .‫شوند‬ ‫دیدگی‬ ‫آسیب‬ ‫دچار‬ ‫است‬ ‫ممکن‬ ‫افزار‬ ‫سخت‬ ‫شدن‬ ‫خراب‬ ‫یا‬ ‫کردن‬ ‫کرش‬ ‫اثر‬ ‫در‬ ‫ها‬ ‫دیتابیس‬ MyISAM ‫داده‬ ‫سازی‬ ‫یکپارچه‬ ‫به‬ ‫که‬ ‫مکانیزمی‬ ‫وجود‬ ‫عدم‬ ‫بدلیل‬ ‫و‬ ‫گیرد‬ ‫می‬ ‫قرار‬ ‫عوامل‬ ‫این‬ ‫تاثیر‬ ‫تحت‬ ‫بسادگی‬ ‫به‬ ‫نیاز‬ ،‫کند‬ ‫کمک‬ ‫ها‬ repair ‫اما‬ .‫ندارد‬ ‫وجود‬ ‫ها‬ ‫داده‬ ‫کامل‬ ‫بازیابی‬ ‫برای‬ ‫ضمانتی‬ ‫هیچ‬ ‫ضمنا‬ ‫و‬ ‫دارد‬ InnoDB ‫حد‬ ‫تا‬ ‫افزاری‬ ‫سخت‬ ‫مشکالت‬ ‫وقوع‬ ‫هنگام‬ ‫خصوصا‬ ‫و‬ ‫کند‬ ‫تضمین‬ ‫را‬ ‫پایداری‬ ‫و‬ ‫دوام‬ ‫که‬ ‫شده‬ ‫طراحی‬ ‫ای‬ ‫بگونه‬ .‫هد‬ ‫می‬ ‫کاهش‬ ‫را‬ ‫ها‬ ‫داده‬ ‫خرابی‬ ‫زیادی‬ ( ‫پشتیبان‬ ‫های‬ ‫فایل‬ ‫ایجاد‬ Back-up ) ‫در‬ InnoDB ‫اصطالحا‬ ‫روش‬ ‫این‬ ‫به‬ .‫کرد‬ ‫تهیه‬ ‫پشتیبان‬ ‫نسخه‬ ‫دیتابیس‬ ‫فعالیت‬ ‫حین‬ ‫در‬ ‫بسادگی‬ ‫توان‬ ‫می‬ hot back-up ‫در‬ ‫اما‬ .‫شود‬ ‫می‬ ‫گفته‬ MyISAM ‫و‬ ‫جداول‬ ‫شدن‬ ‫قفل‬ ‫به‬ ‫منجر‬ ‫پشتیبان‬ ‫فایل‬ ‫ایجاد‬ Read only ‫شدن‬ ‫تکنیک‬ ‫بزرگ‬ ‫مقیاس‬ ‫در‬ .‫گردد‬ ‫می‬ ‫آنها‬ replication ‫مشکل‬ ‫این‬ ‫بر‬ ‫غلبه‬ ‫برای‬ ‫دیگر‬ ‫سرور‬ ‫یک‬ ‫ایجاد‬ ‫و‬ MyISAM .‫رود‬ ‫می‬ ‫بکار‬ ‫تکنیک‬ ‫در‬ replication ‫سرور‬ ‫یک‬ Master ‫سرور‬ ‫چندین‬ ‫و‬ Slave ‫تغییر‬ ‫به‬ ‫منجر‬ ‫که‬ ‫عملیاتی‬ ‫تمام‬ .‫داریم‬ ‫سرور‬ ‫روی‬ ‫بر‬ ‫فقط‬ ‫شوند‬ ‫می‬ ‫دیتابیس‬ Master ‫یک‬ ‫و‬ ‫شده‬ ‫اجرا‬ log ‫سرورهای‬ ‫سپس‬ .‫شود‬ ‫می‬ ‫ایجاد‬ ‫آنها‬ ‫از‬ Slave ‫این‬ ‫کمک‬ ‫به‬ log ‫سرور‬ ‫با‬ ‫را‬ ‫خود‬ Master ‫سرورهای‬ ‫معمول‬ ‫حالت‬ ‫در‬ .‫کنند‬ ‫می‬ )‫(همگام‬ ‫سینک‬ Slave ‫های‬ ‫سرور‬ ‫از‬ ‫یک‬ ‫هر‬ .‫شوند‬ ‫می‬ ‫استفاده‬ ‫اطالعات‬ ‫خواندن‬ ‫جهت‬ ‫تنها‬ Slave ‫از‬ ‫پشتیبان‬ ‫نسخه‬ ‫یک‬ ‫نقش‬ ‫موتور‬ ‫آنالین‬ ‫گیری‬ ‫پشتیبان‬ ‫مشکل‬ ‫حل‬ ‫جهت‬ ‫راهکاری‬ ‫و‬ ‫دارند‬ ‫را‬ ‫دیتابیس‬ ‫اطالعات‬ MyISAM ‫می‬ ‫محسوب‬ .‫گردد‬ ‫دیگر‬ ‫های‬ ‫تفاوت‬ ‫رکوردها‬ ‫تعداد‬ ‫ذخیره‬ · ‫در‬ InnoDB ‫خالف‬ ‫بر‬ MyISAM ‫دستور‬ ‫از‬ ‫و‬ ‫شود‬ ‫نمی‬ ‫ذخیره‬ ‫رکوردها‬ ‫تعداد‬ count ‫رکوردها‬ ‫تعداد‬ ‫تعیین‬ ‫جهت‬ ‫شرط‬ ‫با‬ ‫دستور‬ ‫این‬ ‫از‬ ‫استفاده‬ .‫شود‬ ‫می‬ ‫استفاده‬ where ‫بهتر‬ ‫و‬ ‫است‬ ‫زمانبر‬ ‫شرط‬ ‫این‬ ‫بدون‬ ‫اما‬ ‫است‬ ‫معمول‬ .‫گردد‬ ‫استفاده‬ ‫جایگزین‬ ‫های‬ ‫روش‬ ‫است‬ ‫خاصیت‬ · Full text ‫ها‬ ‫اندیس‬ ‫در‬
  • 158. ‫جستجوی‬ Full text ‫برخالف‬ like .‫دهد‬ ‫می‬ ‫انجام‬ ‫کلمات‬ ‫روی‬ ‫را‬ ‫جو‬ ‫و‬ ‫پرس‬ ،‫کند‬ ‫می‬ ‫عمل‬ ‫کاراکترها‬ ‫روی‬ ‫بر‬ ‫که‬ ‫با‬ ،‫باشیم‬ ‫رکورد‬ ‫میلیون‬ ‫چندین‬ ‫روی‬ ‫بر‬ ‫ترکیب‬ ‫یک‬ ‫جستجوی‬ ‫در‬ ‫اگر‬ ‫مثال‬ ‫بعنوان‬ like ‫چندین‬ ‫است‬ ‫ممکن‬ ‫با‬ ‫ولی‬ ‫دقیقه‬ Full text search .‫شود‬ ‫می‬ ‫انجام‬ ‫ثانیه‬ ‫چند‬ ‫طی‬ ‫های‬ ‫نسخه‬ ‫تمام‬ ‫در‬ MyISAM ‫از‬ ‫ها‬ ‫اندیس‬ ، Full text ‫از‬ ‫تنها‬ ‫اما‬ ‫کنند‬ ‫می‬ ‫پشتیبانی‬ MySQL 5.6.4 ‫در‬ ‫بعد‬ ‫به‬ ‫موتور‬ InnoDB ‫جستجوی‬ ‫از‬ ‫توان‬ ‫می‬ Full text ‫از‬ ‫گسترده‬ ‫بصورت‬ ‫حاضر‬ ‫حال‬ ‫در‬ .‫گرفت‬ ‫بهره‬ ‫ها‬ ‫اندیس‬ ‫روی‬ ‫بر‬ ‫خاصیت‬ ‫این‬ InnoDB .‫شود‬ ‫نمی‬ ‫استفاده‬ ‫از‬ ‫استفاده‬ ‫دلیل‬ myISAM ‫خیلی‬ ‫؟‬ ‫است‬ ‫ان‬ ‫بودن‬ ‫انتخاب‬ ‫قابل‬ ‫یا‬ ‫سیستم‬ ‫در‬ ‫بودن‬ ‫فرض‬ ‫پیش‬ ‫خاطر‬ ‫به‬ ‫فقط‬ ‫؟‬ ‫موارد‬ ‫از‬ ‫بسیاری‬ ‫در‬ ‫متاسفانه‬ ‫داده‬ ‫پایگاه‬ ‫مدیران‬ ! ‫باشد‬ ‫می‬ ‫دیتابیس‬ ‫معمار‬ ‫یک‬ ‫برای‬ ‫مهمی‬ ‫سوال‬ ‫این‬ ‫ها‬ ‫وقت‬ ‫بودن‬ ‫فرض‬ ‫پیش‬ ‫دلیل‬ ‫به‬ myISAM ‫به‬ ‫سازی‬ ‫ذخیره‬ ‫موتور‬ ‫این‬ ‫از‬ ‫هم‬ ‫مواردی‬ ‫در‬ ‫ولی‬ ‫کنند‬ ‫می‬ ‫استفاده‬ ‫آن‬ ‫از‬ . ‫شود‬ ‫می‬ ‫استفاده‬ ‫شده‬ ‫بهینه‬ ‫و‬ ‫هوشمندانه‬ ‫کامال‬ ‫شکل‬ ‫منفی‬ ‫و‬ ‫مثبت‬ ‫جوانب‬ ‫از‬ ‫مقایسه‬ ، ‫داده‬ ‫پایگاه‬ ‫در‬ ‫سازی‬ ‫ذخیره‬ ‫های‬ ‫موتور‬ ‫اصلی‬ ‫نوع‬ ‫دو‬ ‫در‬ myISAM & InnoDB ‫کرد‬ ‫اشاره‬ ‫زیر‬ ‫موارد‬ ‫به‬ ‫توان‬ ‫می‬ : innoDB ‫که‬ ‫حالی‬ ‫در‬ ‫است‬ ‫تری‬ ‫جدید‬ ‫ساز‬ ‫ذخیره‬ ‫موتور‬ myISAM ‫است‬ ‫تر‬ ‫گسترده‬ . innoDB ‫به‬ ‫نسبت‬ ‫بیشتری‬ ‫های‬ ‫پیچیدگی‬ MyISAM ‫دارد‬ ‫ساده‬ . innoDB ‫نسبت‬ ‫به‬ ‫است‬ ‫تر‬ ‫پاسخگو‬ ‫ها‬ ‫داده‬ ‫نگهداشت‬ ‫در‬ myisam Innodb ‫از‬ transaction ‫که‬ ‫حالی‬ ‫در‬ ‫کند‬ ‫می‬ ‫پشتیبانی‬ ‫ها‬ myISAM ‫ندارد‬ ‫را‬ ‫قابلیت‬ ‫این‬ . innoDB ‫که‬ ‫حالی‬ ‫در‬ ‫محدود‬ ‫های‬ ‫ارتباط‬ ‫برای‬ ‫خارجی‬ ‫کلید‬ ‫قابلیت‬ ‫دارای‬ myisam ‫کند‬ ‫نمی‬ ‫پشتیبانی‬ ‫را‬ ‫ان‬ . myISAM ‫قابلیت‬ full-text ‫ولی‬ ‫دارد‬ ‫را‬ ‫ها‬ ‫ایندکس‬ ‫در‬ InnoDB ‫کند‬ ‫نمی‬ ‫پشتیبانی‬ . ‫باال‬ ‫موارد‬ ‫از‬ ‫بسیاری‬ ‫در‬ ‫است‬ ‫درست‬ Innodb ‫دوتا‬ ‫این‬ ‫از‬ ‫کدام‬ ‫هر‬ ‫ولی‬ ‫است‬ ‫شده‬ ‫مطرح‬ ‫که‬ ‫دارد‬ ‫قوتی‬ ‫نقاط‬ ‫را‬ ‫یکی‬ ‫میتواند‬ ‫نیاز‬ ‫اساس‬ ‫بر‬ ‫پروژه‬ ‫دیتابیس‬ ‫معمار‬ ‫که‬ ‫دارند‬ ‫را‬ ‫هایی‬ ‫ضعف‬ ‫و‬ ‫توانایی‬ ‫سازی‬ ‫ذخیره‬ ‫موتور‬ ‫کند‬ ‫انتخاب‬ . ‫از‬ ‫استفاده‬ ‫معایب‬ Innodb : ‫در‬ ‫اینکه‬ ‫دلیل‬ ‫به‬ Innodb ‫معمار‬ ‫لذا‬ ‫دارید‬ ‫را‬ ‫داده‬ ‫پایگاه‬ ‫درون‬ ‫جداول‬ ‫بین‬ ‫روابط‬ ‫تمام‬ ‫از‬ ‫مراقبت‬ ‫به‬ ‫نیاز‬ ‫شما‬ ‫نسبت‬ ‫به‬ ‫طراحی‬ ‫برای‬ ‫بیشتری‬ ‫زمان‬ ‫گذاشتن‬ ‫به‬ ‫نیاز‬ ‫شما‬ ‫دیتابیس‬ myisam ‫باشد‬ ‫می‬ . ‫به‬ ‫نسبت‬ ‫بیشتری‬ ‫سیستم‬ ‫اصلی‬ ‫فضا‬ ‫از‬ ‫استفاده‬ Myisam ‫باشد‬ ‫می‬ . ‫خود‬ ‫سایت‬ ‫در‬ ‫وقتی‬ ‫البته‬ ‫که‬ mysql ‫یا‬ ‫حالت‬ ‫در‬ ‫شما‬ ‫داده‬ ‫پایگاه‬ ‫ساختار‬ ‫که‬ ‫صورتی‬ ‫در‬ ‫که‬ ‫دارد‬ ‫اشاره‬ ‫نکته‬ ‫این‬ ‫بر‬ ‫اکیدا‬ ‫کنید‬ ‫می‬ ‫مطالعه‬ ‫شما‬ ‫اوراکل‬ Innodb ‫موتور‬ ‫باشد‬ ‫نمی‬ Innodb ‫شده‬ ‫نصب‬ ( ‫سرویس‬ ) ‫کنید‬ ‫خاموش‬ ‫را‬ ‫ان‬ . ‫های‬ ‫قابلیت‬ ‫از‬ ‫پشتیبانی‬ ‫در‬ ‫ناتوانی‬ transaction ‫حساس‬ ‫های‬ ‫داده‬ ‫پایگاه‬ ‫برای‬ ‫از‬ ‫استفاده‬ ‫مزایای‬ Myisam : ‫باشد‬ ‫می‬ ‫داده‬ ‫پایگاه‬ ‫های‬ ‫پروژه‬ ‫در‬ ‫مبتدیان‬ ‫برای‬ ‫راهکار‬ ‫بهترین‬ ‫بنابراین‬ ، ‫ساده‬ ‫بسیار‬ ‫سازی‬ ‫پیاده‬ ‫و‬ ‫طراحی‬ . ‫جداول‬ ‫بین‬ ‫در‬ ‫خارجی‬ ‫روابط‬ ‫برای‬ ‫طراحی‬ ‫به‬ ‫نیاز‬ ‫عدم‬ ‫از‬ ‫تر‬ ‫سریع‬ ‫بسیار‬ ، ‫سبک‬ ‫های‬ ‫داده‬ ‫پایگاه‬ ‫در‬ innodb ‫تر‬ ‫پایین‬ ‫نیز‬ ‫هم‬ ‫سرور‬ ‫نگهداری‬ ‫هزینه‬ ‫پس‬ ، ‫باشد‬ ‫می‬ ‫است‬ .
  • 159. ‫هنگام‬ ‫در‬ ‫بیشتر‬ ‫سرعت‬ ‫برای‬ ‫ها‬ ‫داده‬ ‫سازی‬ ‫فشرده‬ ‫امکان‬ select ‫جداول‬ ‫از‬ ‫گرفتن‬ ‫معایب‬ myISAM : ‫واقع‬ ‫در‬ ‫باشد‬ ‫داشته‬ ‫وجود‬ ‫عیب‬ ‫این‬ ‫که‬ ‫هنگامی‬ ، ‫جداول‬ ‫بین‬ ‫ارتباط‬ ، ‫ها‬ ‫داده‬ ‫تمامیت‬ ‫مدیریت‬ ‫عدم‬ ‫پروژه‬ ‫های‬ ‫نویس‬ ‫برنامه‬ ‫برای‬ ‫شود‬ ‫می‬ ‫سربار‬ ‫فرآیندی‬ ‫جداول‬ ‫بین‬ ‫رابطه‬ ‫کردن‬ ‫درست‬ ‫مسئولیت‬ . ‫از‬ ‫پشتیبانی‬ ‫توانایی‬ transaction ‫می‬ ‫توجه‬ ‫مورد‬ ‫بسیار‬ ‫بانکداری‬ ‫مانند‬ ‫حساس‬ ‫و‬ ‫کاربردی‬ ‫های‬ ‫برنامه‬ ‫در‬ ‫که‬ ‫ها‬ . ‫ندارد‬ ‫را‬ ‫باشند‬ ‫از‬ ‫تر‬ ‫کند‬ ‫بسیار‬ ، ‫داده‬ ‫پایگاه‬ ‫توسط‬ ‫شوند‬ ‫مدیریت‬ ‫باال‬ ‫ها‬ ‫رکورد‬ ‫است‬ ‫قرار‬ ‫که‬ ‫حالتی‬ ‫در‬ InnoDB ‫مثال‬ ‫باشد‬ ‫می‬ ‫می‬ ‫انجام‬ ‫را‬ ‫جدول‬ ‫سازی‬ ‫آزاد‬ ‫کار‬ ‫اتمام‬ ‫از‬ ‫بعد‬ ‫و‬ ‫کند‬ ‫می‬ ‫قفل‬ ‫را‬ ‫جدول‬ ‫کل‬ ، ‫خاص‬ ‫رکورد‬ ‫یک‬ ‫کردن‬ ‫اضافه‬ ‫برای‬ ‫دهد‬ . ‫نتیجه‬ : ‫از‬ ‫باید‬ ‫باشیم‬ ‫داشته‬ ‫مکرر‬ ‫ها‬ ‫رسانی‬ ‫روز‬ ‫به‬ ‫سیستم‬ ‫در‬ ‫بخواهیم‬ ‫اگر‬ ‫کرد‬ ‫ساده‬ ‫توان‬ ‫می‬ ‫را‬ ‫مقایسه‬ Innodb ‫کردن‬ ‫اضافه‬ ‫و‬ ‫نمایش‬ ‫و‬ ‫انتخاب‬ ‫به‬ ‫کلی‬ ‫نیاز‬ ‫سیستم‬ ‫در‬ ‫فقط‬ ، ‫دیگر‬ ‫سوی‬ ‫از‬ ‫اگر‬ ‫و‬ ‫کنیم‬ ‫استفاده‬ ‫حتما‬ ‫از‬ ‫حتما‬ ‫باشد‬ ‫می‬ ‫تر‬ ‫ساده‬ ‫های‬ ‫پروژه‬ ‫حد‬ ‫در‬ ‫ها‬ ‫رکورد‬ myISAM ‫کنید‬ ‫استفاده‬ . ‫پ‬ . ‫ن‬ : Full Text Search ‫امکان‬ index ‫در‬ ‫کلیدی‬ ‫لغات‬ ‫مبنای‬ ‫بر‬ ‫را‬ ‫متنی‬ ‫دیتای‬ ‫جستجوی‬ ‫و‬ ‫کردن‬ SQL Server ‫کند‬ ‫می‬ ‫فراهم‬ . ‫خالف‬ ‫بر‬ LIKE ، ‫کاراکترهاست‬ ‫روی‬ ‫آن‬ ‫عمل‬ ‫محدوده‬ ‫که‬ Full Text Search ‫روی‬ ‫بر‬ ‫دهد‬ ‫می‬ ‫انجام‬ ‫جو‬ ‫و‬ ‫پرس‬ ، ‫متن‬ ‫زبان‬ ‫مبنای‬ ‫بر‬ ‫کلمات‬ . ‫سرعت‬ ‫اختالف‬ Full Text Search ‫و‬ LIKE ‫که‬ ‫زمانی‬ ‫در‬ ‫یک‬ ‫خواهیم‬ ‫می‬ Query ‫است‬ ‫مشهود‬ ‫بسیار‬ ‫کنیم‬ ‫اجرا‬ ‫رکورد‬ ‫میلیون‬ ‫چند‬ ‫روی‬ ‫بر‬ ‫را‬ . ‫با‬ ‫اگر‬ LIKE ‫یک‬ ‫دنبال‬ ‫از‬ ‫استفاده‬ ‫که‬ ‫حالی‬ ‫در‬ ‫بکشد‬ ‫طول‬ ‫دقیقه‬ ‫چندین‬ ‫است‬ ‫ممکن‬ ‫گزارش‬ ‫تهیه‬ ، ‫بگردیم‬ ‫ترکیب‬ Full Text Search ‫دهد‬ ‫می‬ ‫کاهش‬ ‫ثانیه‬ ‫چند‬ ‫به‬ ‫را‬ ‫آن‬ . ‫از‬ ‫توان‬ ‫می‬ ‫چگونه‬ ‫اما‬ ‫و‬ full text search : ‫کرد‬ ‫استفاده‬ : ‫باشد‬ ‫می‬ ‫زیر‬ ‫شرح‬ ‫به‬ ‫آن‬ ‫ساختار‬ ‫کلی‬ ‫شکل‬ MATCH (col1,col2,col3...) AGAINST (expr [search_modifier]) SELECT * FROM table_name WHERE MATCH(col1, col2) AGAINST('search terms' IN NATURAL LANGUAGE MODE)
  • 160. ‫هر‬ ‫های‬ ‫ویژگی‬ ‫اما‬ engine : ‫است‬ ‫صورتی‬ ‫چه‬ ‫به‬
  • 163. . ‫است‬ ‫سازی‬ ‫پیاده‬ ‫قابل‬ ‫جدول‬ ‫هر‬ ‫ساختار‬ ‫هر‬ ‫در‬ ‫و‬ ‫فرض‬ ‫پیش‬ ‫صورت‬ ‫به‬ ‫روند‬ ‫این‬
  • 166. InnoDB’s history InnoDB has a complex release history, but it’s very helpful to understand it. In 2008,the so- called InnoDB plugin was released for MySQL 5.1. This was the next generation of InnoDB created by Oracle, which at that time owned InnoDB but not MySQL. For various reasons that are great to discuss over beers, MySQL continued shipping the older version of InnoDB, compiled into the server. But you could disable this and install the newer, better-performing, more scalable InnoDB plugin if you wished. Eventually, Oracle acquired Sun Microsystems and thus MySQL, and removed the older codebase, replacing it with the “plugin” by default in MySQL 5.5. (Yes, this means that now the “plugin” is actually compiled in, not installed as a plugin. Old terminology dies hard.) The modern version of InnoDB, introduced as the InnoDB plugin in MySQL 5.1, sports new features such as building indexes by sorting, the ability to drop and add indexes without rebuilding the whole table, and a new storage format that offers compression, a new way to store large values such as BLOB columns, and file format management. Many people who use MySQL 5.1 don’t use the plugin, sometimes because they aren’t aware of it. If you’re using MySQL 5.1, please ensure that you’re using the InnoDB plugin. It’s much better than the older version of InnoDB. InnoDB is such an important engine that many people and companies have invested in developing it, not just Oracle’s team. Notable contributions have come from Google, Yasufumi Kinoshita, Percona, and Facebook, among others. Some of these improve-ments have been included into the official InnoDB source code, and many others have been reimplemented in slightly different ways by the InnoDB team. In general,InnoDB’s development has accelerated greatly in the last few years, with major im- provements to instrumentation, scalability, configurability, performance, features, and support for Windows, among other notable items. MySQL 5.6 lab previews and mile- stone releases include a remarkable palette of new features for InnoDB, too. Oracle is investing tremendous resources in improving InnoDB performance, and doing a great job of it (a considerable amount of external contribution has helped with this,too). In the second edition of this book, we noted that InnoDB failed pretty miserably beyond four CPU cores. It now scales well to 24 CPU cores, and arguably up to 32 or even more cores depending on the scenario. Many improvements are slated for the upcoming 5.6 release, but there are still opportunities for enhancement.
  • 167. Column-oriented storage engines MySQL is row-oriented by default, meaning that each row’s data is stored together, and the server works in units of rows as it executes queries. But for very large volumes of data, a column-oriented approach can be more efficient; it allows the engine to re-trieve less data when full rows aren’t needed, and when each column is stored sepa-rately, it can often be compressed more effectively. Community storage engines A full list of community storage engines would run into the scores, and perhaps even to triple digits if we researched them exhaustively. However, it’s safe to say that most of them serve very limited niches, and many aren’t known or used by more than a few people. We’ll just mention a few of them. We haven’t seen most of these in production use. Caveat emptor! Aria Aria, formerly named Maria, is the original MySQL creator’s planned successor to MyISAM. It’s available in MariaDB. Many of the features that were planned for it seem to have been deferred in favor of improvements elsewhere in the MariaDB server. At the time of writing it is probably best to describe it as a crash-safe version of MyISAM, with several other improvements such as the ability to cache data (not just indexes) in its own memory. Groonga This is a full-text search storage engine that claims to offer accuracy and high speed. OQGraph This engine from Open Query supports graph operations (think “find the shortest path between nodes”) that are impractical or impossible to perform in SQL. Q4M This engine implements a queue inside MySQL, with support for operations that SQL itself makes quite difficult or impossible to do in a single statement. SphinxSE This engine provides a SQL interface to the Sphinx full-text search server, which we discuss more in Appendix F. Spider This engine partitions data into several partitions, effectively implementing trans- parent sharding, and executes your queries in parallel across shards, which can be
  • 168. located on different servers. VPForMySQL This engine supports vertical partitioning of tables through a sort of proxy storage engine. That is, you can chop a table into several sets of columns and store those independently, but query them as a single table. It’s by the same author as the Spider engine.
  • 174. ‫باال‬ ‫کارایی‬ ‫و‬ ‫پرفرمنس‬ : ‫فصل‬
  • 175. ‫؟‬ ‫معناست‬ ‫چه‬ ‫به‬ ‫داده‬ ‫پایگاه‬ ‫در‬ ‫بندی‬ ‫پارتیشن‬ ‫ورژن‬ ‫از‬ ‫که‬ ‫است‬ ‫کاربردی‬ ‫ویژگی‬ ‫یک‬ ‫ویژگی‬ ‫این‬ 5.5 ‫بعد‬ ‫به‬ Mysql . ‫شد‬ ‫گنجانده‬ ‫فهرست‬ ‫جدولی‬ ‫در‬ ‫اگر‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫است‬ ‫‌تر‬ ‫ل‬‫مستق‬ ‫‌های‬ ‫ت‬‫قسم‬ ‫به‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫تقسیم‬ ،‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫از‬ ‫منظور‬ ‫جدول‬ ‫همان‬ ‫در‬ ...‫و‬ ‫تولد‬ ‫سال‬ ،‫جنسیت‬ ‫همچون‬ ‫معیارهایی‬ ‫با‬ ‫را‬ ‫‌ها‬ ‫ن‬‫آ‬ ‫توانید‬ ‫می‬ ،‫دارید‬ ‫می‬ ‫نگه‬ ‫را‬ ‫اشخاص‬ .‫شود‬ ‫می‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫بیشتر‬ ‫پذیری‬ ‫دسترس‬ ‫نتیجه‬ ‫در‬ ‫و‬ ‫کارایی‬ ‫افزایش‬ ‫سبب‬ ‫کار‬ ‫این‬ .‫نمایید‬ ‫‌بندی‬ ‫ه‬‫دست‬ : ‫آن‬ ‫های‬ ‫معیار‬ ‫و‬ ‫بندی‬ ‫پارتیشن‬ ‫انواع‬ ‫این‬ ‫برای‬ .‫دارد‬ ‫وجود‬ ‫داده‬ ‫پایگاه‬ ‫تقسیم‬ ‫جهت‬ ‫گوناگونی‬ ‫ضوابط‬ ‫و‬ ‫معیارها‬ ‫‌ای‬ ‫ه‬‫رابط‬ ‫داده‬ ‫‌های‬ ‫ه‬‫پایگا‬ ‫نوع‬ ‫در‬ ( ‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫کلید‬ ‫یک‬ ‫ابتدا‬ ،‫منظور‬ Partitioning Key ‫معیارهای‬ ‫و‬ ‫آن‬ ‫اساس‬ ‫بر‬ ‫سپس‬ ‫و‬ ‫کرده‬ ‫تعریف‬ ‫را‬ ) :‫از‬ ‫عبارتند‬ ‫معیارها‬ ‫‌ترین‬ ‫ی‬‫عموم‬ .‫‌کنند‬ ‫ی‬‫م‬ ‫تقسیم‬ ‫مختلف‬ ‫‌های‬ ‫ن‬‫پارتیش‬ ‫را‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫مشخص‬ ( ‫‌ای‬ ‫ه‬‫محدود‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ Range partitioning ) ‫ده‬ ‫کدپستی‬ ‫اطالعات‬ ‫که‬ ‫کنید‬ ‫فرض‬ .‫‌پذیرد‬ ‫ی‬‫م‬ ‫صورت‬ ‫شده‬ ‫داده‬ ‫کلید‬ ‫و‬ ‫آن‬ ‫محدوده‬ ‫براساس‬ ‫پارتیشن‬ ‫انتخاب‬ ‫در‬ ‫داده‬ ‫پایگاه‬ ‫در‬ ‫رقمی‬ ۹ ‫دسته‬ ۱۰۰۰۰۰۰۰۰۰ ‫این‬ ‫از‬ ‫یکی‬ ‫در‬ ‫شده‬ ‫داده‬ ‫کلید‬ ‫که‬ ‫صورتی‬ ‫در‬ .‫اند‬ ‫شده‬ ‫تقسیم‬ ۹ ‫کلید‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫گرفت‬ ‫خواهند‬ ‫قرار‬ ‫بررسی‬ ‫مورد‬ ‫محدوده‬ ‫آن‬ ‫در‬ ‫موجود‬ ‫اطالعات‬ ‫فقط‬ ،‫باشد‬ ‫محدوده‬ )‫(کدپستی‬ ۶۸۹۵۶۳۲۶۵۳ ‫محدوده‬ ‫فقط‬ ‫که‬ ‫کند‬ ‫می‬ ‫مشخص‬ ۶۰۰۰۰۰۰۰۰۰ ‫تا‬ ۶۹۹۹۹۹۹۹۹۹ ‫یعنی‬ .‫شود‬ ‫بررسی‬ ‫تقریبا‬ ۱/۹ .‫نظر‬ ‫مورد‬ ‫جدول‬ ‫اطالعات‬ ‫کل‬ ( ‫‌وار‬ ‫ت‬‫فهرس‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ List partitioning ) ‫مرکزی‬ ،‫شرقی‬ ،‫غربی‬ ‫‌های‬ ‫ن‬‫استا‬ ‫فهرست‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫‌شوند‬ ‫ی‬‫م‬ ‫مشخص‬ ‫فهرست‬ ‫یک‬ ‫اساس‬ ‫بر‬ ‫‌ها‬ ‫ن‬‫پارتیش‬ ‫‌های‬ ‫ن‬‫استا‬ ‫عنوان‬ ‫با‬ ‫پارتیشنی‬ ‫‌توانند‬ ‫ی‬‫م‬ ‫زنجان‬ ‫و‬ ‫اردبیل‬ ،‫شرقی‬ ‫آذربایجان‬ ،‫غربی‬ ‫آذربایجان‬ ‫‌های‬ ‫ن‬‫استا‬ ‫مثال‬ . ...‫و‬ ‫‌غربی‬ ‫ل‬‫شما‬ ‫‌های‬ ‫ن‬‫استا‬ ‫‌های‬ ‫ه‬‫داد‬ ‫فقط‬ ،‫باشد‬ ‫اردبیل‬ ‫آدرس‬ ‫یک‬ ‫استان‬ ‫صورتیکه‬ ‫در‬ .‫دهند‬ ‫تشکیل‬ ‫‌غریی‬ ‫ل‬‫شما‬ .‫‌شوند‬ ‫ی‬‫م‬ ‫بررسی‬ ( ‫درهم‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ Hash partitioning ) ( ‫‌سازی‬ ‫م‬‫دره‬ ‫تابع‬ ‫و‬ ‫کلید‬ ‫یک‬ ‫اساس‬ ‫بر‬ ‫‌ها‬ ‫ه‬‫داد‬ ،‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫نوع‬ ‫این‬ ‫در‬ hash function ‫‌های‬ ‫ن‬‫پارتیش‬ ‫به‬ ) .‫‌شوند‬ ‫ی‬‫م‬ ‫تقسیم‬ ‫مختلف‬
  • 176. ( ‫کلیدی‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ Key partitioning ) ‫صورت‬ ‫به‬ ‫اطالعات‬ ‫قرارگیری‬ ‫نحوه‬ ‫که‬ ‫تفاوت‬ ‫این‬ ‫با‬ ‫است‬ ‫درهم‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫مانند‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫نوع‬ ‫این‬ .‫‌گیرد‬ ‫ی‬‫م‬ ‫صورت‬ ‫داده‬ ‫پایگاه‬ ‫توسط‬ ‫خودکار‬ ( ‫ترکیبی‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ Composite partitioning ) .‫است‬ ‫‌ها‬ ‫ی‬‫‌بند‬ ‫ن‬‫پارتیش‬ ‫انواع‬ ‫از‬ ‫‌ای‬ ‫ه‬‫مجموع‬ ،‫ترکیبی‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ ،‫است‬ ‫مشخص‬ ‫وی‬ ‫نام‬ ‫از‬ ‫که‬ ‫همانگونه‬ ‫شده‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫اطالعات‬ ‫ذخیره‬ ‫‌های‬ ‫ش‬‫رو‬ ‫‌تر‬ ‫ک‬‫کوچ‬ ‫قطعات‬ ‫در‬ ‫و‬ ‫کرده‬ ‫تقسیم‬ ‫را‬ ...‫و‬ ‫‌ها‬ ‫ف‬‫ردی‬ ،‫جداول‬ ‫یا‬ ‫و‬ ‫داده‬ ‫پایگاه‬ ‫کل‬ ‫مانند‬ ‫اطالعاتی‬ ،‫‌بندی‬ ‫ن‬‫پارتیش‬ ( ‫افقی‬ ‫صورت‬ ‫به‬ ‫‌توان‬ ‫ي‬‫م‬ ‫جدول‬ ‫یک‬ ‫در‬ ‫موجود‬ ‫‌های‬ ‫ف‬‫ردی‬ ‫کردن‬ ‫تقسیم‬ ‫برای‬ .‫‌کند‬ ‫ی‬‫م‬ ‫ذخیره‬ Horizontal ‫و‬ ) ( ‫عمودی‬ Vertical .‫کرد‬ ‫عمل‬ ) ‫حالت‬ ‫در‬ ( ‫افقی‬ Horizontal ) ‫در‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫‌شوند‬ ‫ی‬‫م‬ ‫ذخیره‬ ‫جداگانه‬ ‫‌های‬ ‫ل‬‫جدو‬ ‫در‬ ‫مختلف‬ ‫‌های‬ ‫ف‬‫ردی‬ ‫از‬ ‫کمتر‬ ‫آنان‬ ‫کدپستی‬ ‫که‬ ‫افرادی‬ ،‫مشتریان‬ ‫جدول‬ 50000 ( ‫شرقی‬ ‫مشتریان‬ ‫جدول‬ ‫در‬ ‫باشد‬ CustomerEast ‫و‬ ) ‫باالی‬ ‫کدپستی‬ ‫دارای‬ ‫که‬ ‫افرادی‬ ‫باقی‬ 50000 ( ‫غربی‬ ‫مشتریان‬ ‫جدول‬ ‫در‬ ‫‌باشند‬ ‫ی‬‫م‬ CustomerWest ‫ذخیره‬ ) ‫از‬ ‫استفاده‬ ‫با‬ ‫توان‬ ‫می‬ ‫مشتریان‬ ‫تمامی‬ ‫به‬ ‫دستیابی‬ ‫برای‬ ‫همچنین‬ .‫‌شوند‬ ‫ی‬‫م‬ UNION ‫یک‬ VIEW ‫که‬ ‫کرد‬ ‫ایجاد‬ .‫باشد‬ ‫‌ها‬ ‫ف‬‫ردی‬ ‫تمامی‬ ‫شامل‬ ‫در‬ ( ‫عمودی‬ ‫حالت‬ Vertical ) ‫متناظر‬ ‫صورت‬ ‫به‬ ‫‌ها‬ ‫ن‬‫ستو‬ ‫بقیه‬ ‫و‬ ‫‌گیرند‬ ‫ی‬‫م‬ ‫قرار‬ ‫اصلی‬ ‫جدول‬ ‫در‬ ‫کمتری‬ ‫‌های‬ ‫ن‬‫ستو‬ ‫و‬ ‫ثابت‬ ‫نسبتا‬ ‫اطالعات‬ ‫با‬ ‫‌هایی‬ ‫ن‬‫ستو‬ ‫جداکردن‬ ‫روش‬ ‫این‬ ‫کاربرد‬ ‫‌ترین‬ ‫ی‬‫عموم‬ .‫‌گیرند‬ ‫ی‬‫م‬ ‫قرار‬ ‫دیگر‬ ‫‌های‬ ‫ل‬‫جدو‬ ‫در‬ ‫فعلی‬ ‫نسخه‬ .‫است‬ ‫متغیر‬ ‫اطالعات‬ ‫با‬ ‫‌هایی‬ ‫ن‬‫ستو‬ MySQL 5.6 .‫‌شود‬ ‫ی‬‫نم‬ ‫پشتیبانی‬ ‫عمودی‬ ‫حالت‬ ‫از‬ ‫داریم؟‬ ‫نیاز‬ ‫داده‬ ‫پایگاه‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫به‬ ‫چرا‬ ‫و‬ ‫زمانی‬ ‫چه‬ :‫‌انجامد‬ ‫ی‬‫م‬ ‫بازدهی‬ ‫محسوس‬ ‫افزایش‬ ‫به‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫از‬ ‫استفاده‬ ‫زیر‬ ‫موارد‬ ‫در‬ • ‫زیاد‬ ‫خیلی‬ ‫‌های‬ ‫ه‬‫داد‬ • ‫حافظه‬ ‫کمبود‬ RAM • ‫های‬ ‫داده‬ HISTORICAL • ‫ها‬ ‫داده‬ ‫حجم‬ ‫افزایش‬
  • 181. ( ‫کوئری‬ ‫اجرای‬ ‫هنگام‬ Query ‫جدول‬ ‫کل‬ ‫روی‬ ‫بر‬ ‫دستور‬ ،‫باشد‬ ‫نشده‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫نظر‬ ‫مورد‬ ‫جدول‬ ‫صورتیکه‬ ‫در‬ ) :‫مانند‬ .‫‌شود‬ ‫ی‬‫م‬ ‫اجرا‬
  • 183. ‫اجرای‬ ‫هنگام‬ ،‫نمایید‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫را‬ ‫نظر‬ ‫مورد‬ ‫جدول‬ ‫اگر‬ ‫حال‬ Query )‫پارتیشن(های‬ ‫فقط‬ ‫بررسی‬ ‫‌ی‬ ‫ه‬‫محدود‬ ، ‫بررسی‬ ‫را‬ ‫زیر‬ ‫شده‬ ‫مشخص‬ ‫‌های‬ ‫ه‬‫محدود‬ ،‫جدول‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫فرض‬ ‫با‬ ‫قبلی‬ ‫دستورات‬ .‫‌شود‬ ‫ی‬‫م‬ ‫شامل‬ ‫را‬ ‫مرتبط‬ :‫‌نماید‬ ‫ی‬‫م‬
  • 185. : ‫کنید‬ ‫استفاده‬ ‫بندی‬ ‫پارتیشن‬ ‫از‬ ‫باید‬ ‫که‬ ‫دلیل‬ ‫چند‬ • ‫به‬ ‫بخشیدن‬ ‫سرعت‬ select ‫و‬ insert • ‫های‬ ‫محدوده‬ ‫سریعتر‬ ‫نتایج‬ ‫آوردن‬ ‫بدست‬ select • ‫مختلف‬ ‫های‬ ‫مسیر‬ ‫دستیابی‬ ‫برای‬ ‫ها‬ ‫داده‬ ‫جداسازی‬ ‫به‬ ‫کمک‬ • ‫ها‬ ‫داده‬ ‫به‬ ‫ای‬ ‫تاریخچه‬ ‫دسترسی‬ ‫ذخیره‬ • ‫ای‬ ‫محدوده‬ ‫های‬ ‫داده‬ ‫سریعتر‬ ‫حذف‬ • … ‫و‬ : ‫بندی‬ ‫پارتیشن‬ ‫محدودیت‬ ( ‫عدد‬ ‫نوع‬ ‫از‬ ‫ستونی‬ ‫توسط‬ ‫بایستی‬ ‫پارتیشن‬ INTEGER ‫شما‬ ‫حال‬ ‫این‬ ‫با‬ .‫باشد‬ ‫شده‬ ‫مشخص‬ ) :‫دهید‬ ‫بسط‬ ‫را‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫زیر‬ ‫موارد‬ ‫رعایت‬ ‫با‬ ‫ستون‬ ‫این‬ ‫جای‬ ‫به‬ ‫‌توانید‬ ‫ی‬‫م‬ • ‫صورت‬ ‫به‬ ‫از‬ ‫ستونی‬ ‫اگر‬ Unique Key ‫یا‬ Primary Key ‫ستون‬ ‫این‬ ‫باید‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ ،‫باشد‬ ‫شده‬ ‫تعریف‬ .‫گیرد‬ ‫بر‬ ‫در‬
  • 186. • ‫توابع‬ ‫(شامل‬ ‫عبارت‬ ‫از‬ ،‫ستون‬ ‫یک‬ ‫جای‬ ‫به‬ ‫توانید‬ ‫می‬ ‫پارتیشن‬ ‫ساخت‬ ‫در‬ MySQL ‫با‬ .‫نمایید‬ ‫استفاده‬ ) .‫بازگرداند‬ ‫را‬ ‫عددی‬ ‫مقدار‬ ‫نظر‬ ‫مورد‬ ‫عبارت‬ ‫که‬ ‫شرط‬ ‫این‬ • ‫عبارت‬ ‫از‬ ‫توانید‬ ‫می‬ ‫عددی‬ ‫محدود‬ ‫ندانستن‬ ‫صورت‬ ‫در‬ MAXVALUE .‫نمایید‬ ‫استفاده‬ ‫باال‬ ‫بازه‬ ‫برای‬ • ‫‌ها‬ ‫ن‬‫پارتیش‬ ‫تعداد‬ ‫حداکثر‬ 2 10 = 1024 .‫باشد‬ ‫می‬ ‫در‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫‌سازی‬ ‫ه‬‫پیاد‬ MySQL|MariaDb ‫پایگاه‬ ‫در‬ ‫اطالعات‬ ‫‌بندی‬ ‫ش‬‫پارتی‬ ‫مبحث‬ .‫است‬ ‫منبع‬ ‫خود‬ ‫راهنمای‬ ‫مطالعه‬ ،‫مهارتی‬ ‫هر‬ ‫فراگیری‬ ‫برای‬ ‫راه‬ ‫بهترین‬ ‫این‬ ‫حوصله‬ ‫از‬ ‫‌ها‬ ‫ن‬‫آ‬ ‫‌ی‬ ‫ه‬‫هم‬ ‫به‬ ‫پرداختن‬ ‫که‬ ‫‌باشد‬ ‫ی‬‫م‬ ‫زیادی‬ ‫درشت‬ ‫و‬ ‫ریز‬ ‫نکات‬ ‫دارای‬ ‫و‬ ‫بوده‬ ‫گسترده‬ ‫بسیار‬ ‫داده‬ .‫‌اند‬ ‫ه‬‫شد‬ ‫ارائه‬ ‫زیر‬ ‫در‬ ‫‌ها‬ ‫ن‬‫پارتیش‬ ‫ایجاد‬ ‫نحوه‬ ‫خالصه‬ ‫صورت‬ ‫به‬ ‫حال‬ ‫این‬ ‫با‬ .‫است‬ ‫خارج‬ ‫مقاله‬ ( ‫‌ای‬ ‫ه‬‫محدود‬ ‫پارتیشن‬ ‫ساخت‬ ‫نحوه‬ Range partitioning ) 1 2 3 4 5 6 7 8 9 CREATE TABLE t1 ( id int ) ENGINE=InnoDB # or MyISAM, ARCHIVE PARTITION BY RANGE (id) ( PARTITION P1 VALUES LESS THAN (10), PARTITION P2 VALUES LESS THAN (20) ) ( ‫‌وار‬ ‫ت‬‫فهرس‬ ‫پارتیشن‬ ‫ساخت‬ ‫نحوه‬ List partitioning ) 1 2 3 4 5 6 7 8 CREATE TABLE t1 ( id int ) ENGINE=InnoDB PARTITION BY LIST (id) ( PARTITION P1 VALUES IN (1,2,4), PARTITION P2 VALUES IN (3,5,9) ) ( ‫درهم‬ ‫پارتیشن‬ ‫ساخت‬ ‫نحوه‬ Hash partitioning )
  • 187. 1 2 3 4 5 CREATE TABLE t1 ( id int not null primary key ) ENGINE=InnoDB PARTITION BY HASH (id) PARTITIONS 10; ( ‫کلیدی‬ ‫پارتیشن‬ ‫ساخت‬ ‫نحوه‬ Key partitioning ) 1 2 3 4 5 CREATE TABLE t1 ( id int not null primary key ) ENGINE=InnoDB PARTITION BY KEY () PARTITIONS 10; ‫های‬ ‫جدول‬ ‫در‬ ‫پارتیشن‬ ‫ساخت‬ ‫نحوه‬ ‫با‬ ‫باال‬ ‫موارد‬ ‫بیشتر‬ ‫درک‬ ‫برای‬ t1 ‫و‬ t2 :‫فرمایید‬ ‫توجه‬ ‫زیر‬ ‫در‬ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 CREATE TABLE t1 ( d date ) ENGINE=InnoDB PARTITION BY RANGE (YEAR(d)) ( PARTITION P1 VALUES LESS THAN (1999), PARTITION P2 VALUES LESS THAN (2005), PARTITION P3 VALUES LESS THAN (2010), PARTITION P4 VALUES LESS THAN (MAXVALUE) ) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 CREATE TABLE t2 ( d date ) ENGINE=InnoDB PARTITION BY RANGE (TO_DAYS(d)) ( PARTITION P1 VALUES LESS THAN (TO_DAYS('1999-01-01')), PARTITION P2 VALUES LESS THAN (TO_DAYS('2005-01-01')), PARTITION P3 VALUES LESS THAN (TO_DAYS('2010-01-01')), PARTITION P4 VALUES LESS THAN (MAXVALUE) )
  • 188. CREATE TABLE t1 ( id INT NOT NULL, fname VARCHAR(30), lname VARCHAR(30), hired DATE NOT NULL DEFAULT '1970-01-01', separated DATE NOT NULL DEFAULT '9999-12-31', job_code INT NOT NULL, store_id INT NOT NULL ) PARTITION BY RANGE (store_id) ( PARTITION p0 VALUES LESS THAN (6), PARTITION p1 VALUES LESS THAN (11), PARTITION p2 VALUES LESS THAN (16), PARTITION p3 VALUES LESS THAN (21) ); ‫دارد؟‬ ‫تاثیر‬ ‫دستورات‬ ‫اجرای‬ ‫سرعت‬ ‫در‬ ‫چقدر‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫از‬ ‫منظور‬ ‫این‬ ‫برای‬ .‫داریم‬ ‫اطالعات‬ ‫توجهی‬ ‫قابل‬ ‫مقدار‬ ‫با‬ ‫داده‬ ‫پایگاه‬ ‫یک‬ ‫به‬ ‫نیاز‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫تاثیر‬ ‫بررسی‬ ‫برای‬ ‫پروژه‬ MySQL Employees Test Database ‫حدودا‬ ‫شامل‬ ‫که‬ ۴ ‫در‬ ‫رکورد‬ ‫میلیون‬ ۶ ‫استفاده‬ ‫است‬ ‫جدول‬ :‫‌کنید‬ ‫ی‬‫م‬ ‫مشاهده‬ ‫را‬ ‫داده‬ ‫پایگاه‬ ‫این‬ ‫ساختار‬ ‫زیر‬ ‫در‬ .‫‌ایم‬ ‫ه‬‫کرد‬
  • 189. ( ‫جستار‬ ‫به‬ Query :‫فرمایید‬ ‫توجه‬ ‫آن‬ ‫اجرای‬ ‫زمان‬ ‫و‬ ‫زیر‬ ) 1 2 3 4 5 6 7 SELECT COUNT(*) FROM salaries WHERE from_date BETWEEN '1999-01-01' AND '1999-12-31'; +----------+ | COUNT(*) | +----------+ | 260957 | +----------+ 1 row in set (1.07 sec) :‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫از‬ ‫بعد‬ ‫دستور‬ ‫همان‬ ‫و‬ 1 2 3 4 5 6 7 SELECT COUNT(*) FROM salaries WHERE from_date BETWEEN '1999-01-01' AND '1999-12-31'; +----------+ | COUNT(*) | +----------+ | 260957 | +----------+ 1 row in set (0.32 sec) ( ‫جستار‬ ‫به‬ ‫اطالعات‬ ‫حذف‬ ‫سرعت‬ ‫افزایش‬ ‫برای‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫عملکرد‬ ‫مشاهده‬ ‫برای‬ Query ‫اجرای‬ ‫زمان‬ ‫و‬ ‫زیر‬ ) :‫فرمایید‬ ‫توجه‬ ‫آن‬ 1 2 DELETE FROM salaries WHERE from_date BETWEEN '1999-01-01' AND '1999-12- 31'; Query OK, 247489 rows affected (10.57 sec) :‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫از‬ ‫بعد‬ ‫حذف‬ ‫دستور‬ ‫همان‬ ‫و‬ 1 2 ALTER TABLE salaries DROP PARTITION p15; Query OK, 0 rows affected (1.35 sec)
  • 190. ‫جدول‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫نحوه‬ salaries ‫داده‬ ‫پایگاه‬ ‫در‬ employees ( ‫‌ها‬ ‫ق‬‫حقو‬ ‫جدول‬ ‫‌بندی‬ ‫ن‬‫پارتیش‬ ‫دستور‬ ‫زیر‬ ‫در‬ salaries ( ‫‌ای‬ ‫ه‬‫محدود‬ ‫صورت‬ ‫به‬ ) RANGE ‫سال‬ ‫تاریخ‬ ‫اساس‬ ‫بر‬ ) from_date :‫‌فرمایید‬ ‫ی‬‫م‬ ‫مشاهده‬ ALTER TABLE salaries PARTITION BY RANGE (YEAR(from_date)) ( PARTITION p1 VALUES LESS THAN (1985), PARTITION p2 VALUES LESS THAN (1986), PARTITION p3 VALUES LESS THAN (1987), PARTITION p4 VALUES LESS THAN (1988), PARTITION p5 VALUES LESS THAN (1989), PARTITION p6 VALUES LESS THAN (1990), PARTITION p7 VALUES LESS THAN (1991), PARTITION p8 VALUES LESS THAN (1992), PARTITION p9 VALUES LESS THAN (1993), PARTITION p10 VALUES LESS THAN (1994), PARTITION p11 VALUES LESS THAN (1995), PARTITION p12 VALUES LESS THAN (1996), PARTITION p13 VALUES LESS THAN (1997), PARTITION p14 VALUES LESS THAN (1998), PARTITION p15 VALUES LESS THAN (1999), PARTITION p16 VALUES LESS THAN (2000), PARTITION p17 VALUES LESS THAN (2001), PARTITION p18 VALUES LESS THAN (2002), PARTITION p19 VALUES LESS THAN (2003), PARTITION p20 VALUES LESS THAN (MAXVALUE) ) ;
  • 191. ‫خطای‬ ‫با‬ ‫اگر‬ : ‫نکته‬ Cannot delete or update a parent row: a foreign key constraint fails ‫مواجه‬ ‫خارجی‬ ‫کلید‬ ‫زیر‬ ‫دستور‬ ‫با‬ ،‫شدید‬ salaries_ibfk_1 :‫نمایید‬ ‫حذف‬ ‫را‬ ALTER TABLE salaries DROP FOREIGN KEY salaries_ibfk_1; : ‫لیست‬ ‫بواسطه‬ ‫بندی‬ ‫پارتیشن‬
  • 192. : ‫هش‬ ‫بواسطه‬ ‫بندی‬ ‫پارتیشن‬ ‫بواسطه‬ ‫بندی‬ ‫پارتیشن‬ key :
  • 193. . ‫شود‬ ‫استفاده‬ ‫آن‬ ‫در‬ ‫زیر‬ ‫مقادیر‬ ‫از‬ ‫باید‬ ‫رنج‬ ، ‫لیست‬ ، ‫هش‬ ‫بندی‬ ‫پارتیشن‬ : ‫نکته‬
  • 194. ‫قابلیت‬ ‫از‬ ‫استفاده‬ ‫برای‬ : ‫نکته‬ partition . ‫باشد‬ ‫فعال‬ ‫آن‬ ‫پالگین‬ ‫باید‬ . ‫ایم‬ ‫کرده‬ ‫استفاده‬ ‫پارتیشن‬ ‫از‬ ‫هایی‬ ‫ساختار‬ ‫چه‬ ‫داده‬ ‫پایگاه‬ ‫در‬ ‫اینکه‬ ‫فهمیدن‬ ‫چگونگی‬
  • 197. : ‫ها‬ ‫کوئری‬ ‫در‬ ‫کش‬ ‫قابلیت‬ ‫کردن‬ ‫فعال‬ . ‫دارد‬ ‫تکراری‬ ‫های‬ ‫کوئری‬ ‫سرعت‬ ‫افزایش‬ ‫در‬ ‫شایانی‬ ‫کمک‬ ‫کار‬ ‫این‬ ‫باید‬ ‫قابلیت‬ ‫این‬ ‫بودن‬ ‫فعال‬ ‫بررسی‬ ‫برای‬ have_query_cache ‫برابر‬ yes . ‫باشد‬ ‫در‬ : ‫نکته‬ mariadb ‫از‬ ‫توان‬ ‫می‬ ‫ان‬ ‫تعغیر‬ ‫برای‬ ‫نبود‬ ‫فعال‬ ‫اگر‬. ‫باشد‬ ‫می‬ ‫فعال‬ ‫فرض‬ ‫پیش‬ ‫بصورت‬ ‫قابلیت‬ ‫این‬ . ‫برد‬ ‫بهره‬ ‫زیر‬ ‫ساختار‬ SET optimizer_switch='subquery_cache=on'; ‫ساختارهای‬ ‫از‬ optimizer_switch : ‫کرد‬ ‫اشاره‬ ‫زیر‬ ‫موارد‬ ‫به‬ ‫توان‬ ‫می‬ . ‫داد‬ ‫تعغییر‬ ‫را‬ ‫کش‬ ‫میزان‬ ‫حجم‬ ‫توان‬ ‫می‬ ‫همچنین‬
  • 198. : ‫تکمیلی‬ ‫اطالعات‬ query_cache_size • Description: Size in bytes available to the query cache. About 40KB is needed for query cache structures, so setting a size lower than this will result in a warning. 0, the default before MariaDB 10.1.7, effectively disables the query cache. Starting from MariaDB 10.1.7, query_cache_type is automatically set to ON if the server is started with the query_cache_size set to a non-zero (and non-default) value. • Commandline: --query-cache-size=# • Scope: Global • Dynamic: Yes • Data Type: numeric • Default Value: 1M (>= MariaDB 10.1.7), 0 (<= MariaDB 10.1.6) (although frequently given a default value in some setups) • Valid Values: 0 upwards in units of 1024. query_cache_type • Description: If set to 0, the query cache is disabled (although a buffer of query_cache_size bytes is still allocated). If set to 1 all SELECT queries will be cached unless SQL_NO_CACHE is specified. If set to 2 (or DEMAND), only queries with the SQL CACHE clause will be cached. Note that if the server is started with the query cache disabled, it cannot be enabled at runtime. Starting from MariaDB 10.1.7, query_cache_type is automatically set to ON if the server is started with the query_cache_size set to a non-zero (and non-default) value. • Commandline: --query-cache-type=# • Scope: Global, Session • Dynamic: Yes • Data Type: enumeration • Default Value: OFF (>= MariaDB 10.1.7), ON (<= MariaDB 10.1.6) • Valid Values: 0 or OFF, 1 or ON, 2 or DEMAND ‫در‬ ‫قابلیت‬ ‫این‬ ‫کردن‬ ‫فعال‬ ‫برای‬ : ‫نکته‬ mysql ‫فایل‬ ‫به‬ ‫توان‬ ‫می‬ ‫را‬ ‫ساختار‬ ‫این‬ my.cnf . ‫نمود‬ ‫اضافه‬ query_cache_size = 268435456
  • 199. query_cache_type=1 query_cache_limit=1048576 ‫فایل‬ ‫در‬ my.ini ‫و‬ ‫ویندوز‬ ‫در‬ my.cnf ‫پارامتر‬ ‫ها‬ ‫یونیکس‬ ‫و‬ ‫لینوکس‬ ‫در‬ datadir ‫به‬ ‫مربوط‬ ‫پیشفرض‬ ‫دایرکتوری‬ ‫های‬ ‫دایرکتوری‬ ‫سازی‬ ‫ذخیره‬ MySQL ،‫دهیم‬ ‫تغییر‬ ‫را‬ ‫محل‬ ‫این‬ ‫تا‬ ‫داریم‬ ‫الزم‬ ‫دلیلی‬ ‫هر‬ ‫به‬ .‫شود‬ ‫می‬ ‫داری‬ ‫نگه‬ ‫پارامتر‬ ‫تا‬ ‫است‬ ‫الزم‬ ‫بنابراین‬ datadir .‫کنیم‬ ‫ویرایش‬ ‫را‬ ِ ‫های‬ ‫داده‬ ‫پایگاه‬ ‫به‬ ‫مربوط‬ ‫های‬ ‫فایل‬ ‫که‬ ‫دایرکتوریی‬ ‫مسیر‬ ‫کردن‬ ‫پیدا‬ ‫برای‬ MySQL ‫یا‬ MariaDB ‫لینوکس‬ ‫در‬ ‫را‬ .‫کنید‬ ‫استفاده‬ ‫زیر‬ ‫دستور‬ ‫از‬ ‫کند‬ ‫می‬ ‫داری‬ ‫نگه‬ ‫ها‬ ‫یونیکس‬ ‫دیگر‬ ‫یا‬ locate my.cnf ‫فایل‬ ‫از‬ ‫است‬ ‫الزم‬ ‫حال‬ ‫هر‬ ‫به‬ my.cnf ‫پارامتر‬ datadir .‫شود‬ ‫ویرایش‬ datadir=/var/lib/mysql ‫سرویس‬ ‫ابتدا‬ ‫لینوکس‬ ‫در‬ mysql ‫را‬ stop .‫کنید‬ service mysql stop OR etc/init.d/mysql stop/ ‫سپس‬ ‫دایرکتوری‬ ‫درون‬ ‫های‬ ‫فایل‬ ‫تمامی‬ var/lib/mysql ‫کنیم‬ ‫می‬ ‫فرض‬ .‫کنید‬ ‫منتقل‬ ‫جدید‬ ‫دایرکتوری‬ ‫به‬ ‫را‬ / ‫در‬ ‫را‬ ‫جدید‬ ‫دایرکتوری‬ mnt/mysql_data ‫مجوز‬ ‫با‬ ‫چون‬ ‫و‬ ،‫باشیم‬ ‫گرفته‬ ‫نظر‬ ‫در‬ / root ‫ایجاد‬ ‫را‬ ‫دایرکتوری‬ ‫این‬ ‫و‬ ‫کاربر‬ ‫باید‬ ‫فایل‬ ‫این‬ ‫مالک‬ ‫گروه‬ ‫و‬ ‫مالک‬ .‫دهیم‬ ‫تغییر‬ ‫را‬ ‫فایل‬ ‫مجوز‬ ‫کپی‬ ‫از‬ ‫پس‬ ‫تا‬ ‫است‬ ‫الزم‬ ‫بنابراین‬ ،‫کردیم‬ ‫گروه‬ mysql .‫باشد‬ chown mysql:mysql -R /mnt/mysql_data chmod -R 777 /mnt/mysql_data ‫فایل‬ ‫سپس‬ my.cnf ‫پارامتر‬ ‫مقدار‬ ‫و‬ ‫کنید‬ ‫باز‬ ‫را‬ datadir .‫دهید‬ ‫تغییر‬ ‫جدید‬ ‫دایرکتوری‬ ‫مسیر‬ ‫به‬ ‫را‬
  • 200. datadir=/mnt/mysql_data ‫های‬ ‫فایل‬ ‫پیشفرض‬ ‫صورت‬ ‫به‬ ‫ابونتو‬ ‫در‬ .‫شود‬ ‫ویرایش‬ ‫زیر‬ ‫فایل‬ ‫تا‬ ‫است‬ ‫الزم‬ ‫باال‬ ‫های‬ ‫گام‬ ‫انجام‬ ‫از‬ ‫پس‬ MySQL ‫دایرکتوری‬ ‫در‬ var/lib/mysql .‫دارد‬ ‫قرار‬ / : ‫شبکه‬ ‫طریق‬ ‫از‬ ‫داده‬ ‫پایگاه‬ ‫به‬ ‫اتصال‬ ‫قابلیت‬ ‫کردن‬ ‫فعال‬ ‫نحوه‬ ‫فایل‬ ‫در‬ ‫ریموت‬ ‫بصورت‬ ‫اتصال‬ ‫قابلیت‬ ‫کردن‬ ‫فعال‬ ‫برای‬ my.cnf : ‫دهید‬ ‫انجام‬ ‫را‬ ‫زیر‬ ‫های‬ ‫ساختار‬ [mysqld] bind-address=YOUR-SERVER-IP : ‫نمونه‬ ‫برای‬ [ mysqld ] user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp language = /usr/share/mysql/English bind-address = 23.55.25.2 # skip-networking ‫برای‬ skip-networking ‫درخواستی‬ ‫به‬ ‫لحضه‬ ‫هر‬ ‫است‬ ‫معنی‬ ‫این‬ ‫به‬ ‫باشد‬ ‫فعال‬ ‫اگر‬ tcp/ip . ‫نمیدهد‬ ‫گوش‬ ‫سرویس‬ ‫سپس‬ mysql . ‫کنیم‬ ‫می‬ ‫ریستارت‬ ‫را‬ . ‫شود‬ ‫وصل‬ ‫ریموت‬ ‫است‬ ‫قرار‬ ‫که‬ ‫کامپیوتری‬ ‫به‬ ‫مجوز‬ ‫دادن‬ : ‫بعدی‬ ‫مرحله‬ create database tmpfoo ; grant all on tmpfoo.* to user@’ip’ identified by ‘password’ ; update db set HOST=’ip’ where Db=’webdb’ ; update user set Host=’ip’ where user=’user’ ; / sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT
  • 203. ‫داده‬ ‫پایگاه‬ ‫در‬ ‫ها‬ ‫داده‬ ‫انواع‬ MySQL : MySQL :‫کند‬ ‫می‬ ‫پشتیبانی‬ ‫زیر‬ ‫های‬ ‫بندی‬ ‫دسته‬ ‫در‬ ‫را‬ ‫داده‬ ‫مختلف‬ ‫انواع‬ • ( ‫اعداد‬ Numeric ) • ( ‫زمان‬ Date and Time ) • ( ‫ها‬ ‫رشته‬ String ) • ( ‫فضایی‬ ‫های‬ ‫داده‬ Spatial ) ( ‫اعداد‬ Numeric ) MySQL ‫استاندارد‬ ‫عددی‬ ‫های‬ ‫داده‬ ‫انواع‬ ‫تمامی‬ SQL .‫کند‬ ‫می‬ ‫پشتبانی‬ ‫را‬ ‫تقریبی‬ ‫اعداد‬ ‫و‬ ‫صحیح‬ ‫اعداد‬ ‫شامل‬ ‫که‬ ‫باشید‬ ‫داشته‬ ‫نظر‬ ‫در‬ ‫همچنین‬ .‫دارند‬ ‫نیاز‬ ‫سازی‬ ‫ذخیره‬ ‫برای‬ ‫مشخصی‬ ‫حافظه‬ ‫عددی‬ ‫های‬ ‫داده‬ ‫نوع‬ ‫از‬ ‫یک‬ ‫هر‬ ‫صورت‬ ‫به‬ ‫توان‬ ‫می‬ ‫را‬ ‫عددی‬ ‫های‬ ‫داده‬ ‫این‬ ‫از‬ ‫نوع‬ ‫هر‬ .‫کنند‬ ‫می‬ ‫پشتیبانی‬ ‫را‬ ‫مشخصی‬ ‫محدوده‬ ‫آنها‬ ‫از‬ ‫کدام‬ ‫هر‬ SIGNED ‫یا‬ UNSIGNED ‫حالت‬ ‫در‬ .‫کرد‬ ‫تعریف‬ SIGNED ‫ولی‬ ‫کنند‬ ‫می‬ ‫پشتبیبانی‬ ‫منفی‬ ‫مقادیر‬ ‫از‬ ‫ها‬ ‫ستون‬ ‫این‬ ‫حالت‬ ‫در‬ UNSIGNED ‫داده‬ ‫نوع‬ ‫که‬ ‫باشید‬ ‫داشته‬ ‫نظر‬ ‫در‬ .‫باشند‬ ‫صفر‬ ‫مساوی‬ ‫ویا‬ ‫بزرگتر‬ ‫باید‬ ‫شده‬ ‫ذخیره‬ ‫اعداد‬ BOOLEAN ‫مقادیر‬ ‫ذخیره‬ ‫برای‬ TRUE ‫و‬ FALSE ‫همان‬ TINYINT(1) .‫باشد‬ ‫می‬ ‫حالت‬ ‫در‬ ‫را‬ ‫عددی‬ ‫های‬ ‫داده‬ ‫نوع‬ ‫کلی‬ ‫اطالعات‬ ‫زیر‬ ‫جدول‬ SIGNED ‫و‬ UNSIGNED :‫دهد‬ ‫می‬ ‫نشان‬ ‫عددی‬ ‫های‬ ‫داده‬ ‫نوع‬ ‫کلی‬ ‫اطالعات‬ Integer ‫نوع‬ )‫(بایت‬ ‫حافظه‬ ‫مقدار‬ ‫حداقل‬ ‫مقدار‬ ‫حداکثر‬ TINYINT 1 - 128 127 0 255 SMALLINT 2 - 32768 32767 0 65535 MEDIUMINT 3 - 8388608 8388607 0 16777215 INTEGER 4 - 2147483648 2147483647 0 4294967295 BIGINT 8 - 92233720368547758 08 922337203685477580 7 0184467440737095516
  • 204. ‫نوع‬ )‫(بایت‬ ‫حافظه‬ ‫مقدار‬ ‫حداقل‬ ‫مقدار‬ ‫حداکثر‬ 15 ‫شناور‬ ‫عددی‬ ‫های‬ ‫داده‬ ‫نوع‬ ‫کلی‬ ‫اطالعات‬ ‫نوع‬ )‫(بایت‬ ‫حافظه‬ ‫مقدار‬ ‫تعریف‬ ‫نحوه‬ ‫توضیحات‬ FLOAT 4 ‫از‬ ۰ ‫تا‬ ۲۳ ‫رقم‬ FLOAT(M,D) ‫تقریبی‬ ‫مقدار‬ (Approximate Value) DOUBLE 8 ‫از‬ ۲۴ ‫تا‬ ۵۳ ‫رقم‬ DOUBLE(M,D) ‫تقریبی‬ ‫مقدار‬ (Approximate Value) DECIMAL ‫هر‬ ۹ ‫رقم‬ ۴ ‫صورت‬ ‫به‬ ‫بایت‬ ‫باینری‬ ‫تا‬ ۶۵ ‫رقم‬ DECIMAL(M,D)‫دقیق‬ ‫مقدار‬ (Exact Value) ‫حرف‬ ‫باال‬ ‫جدول‬ ‫در‬ M ‫حرف‬ ‫و‬ ‫داده‬ ‫‌های‬ ‫م‬‫رق‬ ‫کل‬ ‫تعداد‬ ‫‌دهنده‬ ‫ن‬‫نشا‬ D ‫ممیز‬ ‫از‬ ‫بعد‬ ‫‌های‬ ‫م‬‫رق‬ ‫تعداد‬ ‫‌دهنده‬ ‫ن‬‫نشا‬ ‫صورت‬ ‫به‬ ‫که‬ ‫ستونی‬ ‫در‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫باشد‬ ‫می‬ ).( FLOAT(7,4) ‫مقدار‬ ‫حداکثر‬ ‫توان‬ ‫می‬ ‫است‬ ‫شده‬ ‫تعریف‬ 999.9999 ‫عدد‬ ‫شما‬ ‫که‬ ‫صورتی‬ ‫در‬ .‫نمود‬ ‫ذخیره‬ ‫را‬ 999.00009 ‫به‬ ‫واردشده‬ ‫عدد‬ ،‫کنید‬ ‫وارد‬ ‫جدول‬ ‫این‬ ‫به‬ ‫را‬ ‫صورت‬ 999.0001 .‫شد‬ ‫خواهد‬ ‫ذخیره‬ ‫سوال‬ ‫چیست؟‬ ‫شناور‬ ‫عددی‬ ‫های‬ ‫داده‬ ‫جدول‬ ‫در‬ ‫دقیق‬ ‫و‬ ‫تقریبی‬ ‫مقدار‬ ‫از‬ ‫منظور‬ : ‫پاسخ‬ ‫فرمان‬ ‫خط‬ ‫در‬ ‫دستور‬ ‫چند‬ ‫کردن‬ ‫اجرا‬ ‫با‬ ‫زیر‬ ‫در‬ .‫شوند‬ ‫می‬ ‫گرد‬ ‫اعداد‬ ‫تقریبی‬ ‫‌های‬ ‫ه‬‫داد‬ ‫نوع‬ ‫در‬ ‫اوقات‬ ‫گاهی‬ : MySQL ‫ستون‬ ‫دو‬ ‫با‬ ‫‌ای‬ ‫ه‬‫داد‬ ‫پایگاه‬ Decimal ‫و‬ Float ‫در‬ ‫را‬ ‫گردشدن‬ ‫نتیجه‬ ‫دستور‬ ‫آخرین‬ ‫در‬ .‫کردیم‬ ‫تعریف‬ ‫ستون‬ Float :‫فرمایید‬ ‫می‬ ‫مشاهده‬ 1 2 3 4 5 6 7 8 mysql> create table numbers (a decimal(10,2), b float); mysql> insert into numbers values (100, 100); mysql> select @a := (a/3), @b := (b/3), @a * 3, @b * 3 from numbers G *************************** 1. row *************************** @a := (a/3): 33.333333333 @b := (b/3): 33.3333333333333 @a * 3: 99.999999999 @b * 3: 100
  • 205. ‫صفحه‬ ‫به‬ ‫بیشتر‬ ‫اطالعات‬ ‫برای‬ Problems with Floating-Point Values ‫سایت‬ ‫در‬ MySQL .‫نمایید‬ ‫مراجعه‬ ‫از‬ ‫قبل‬ ‫های‬ ‫نسخه‬ ‫در‬ 5.0.3 ‫داده‬ ‫نوع‬ DECIMAL ‫صورت‬ ‫به‬ String ‫که‬ ‫‌هایی‬ ‫م‬‫رق‬ ‫مقدار‬ ‫و‬ ‫شود‬ ‫می‬ ‫ذخیره‬ ‫داده‬ ‫نوع‬ ‫مانند‬ ‫کرد‬ ‫می‬ ‫پشتیبانی‬ DOUBLE .‫بود‬ ‫داده‬ ‫نوع‬ BIT ‫‌های‬ ‫ت‬‫بی‬ ‫ذخیره‬ ‫برای‬ ‫داده‬ ‫نوع‬ ‫این‬ ۰ ‫و‬ ۱ ‫عبارت‬ ‫از‬ ‫نوع‬ ‫این‬ ‫از‬ ‫ستونی‬ ‫تعریف‬ ‫برای‬ .‫شود‬ ‫می‬ ‫استفاده‬ BIT(M) ‫اینجا‬ ‫در‬ ‫که‬ ‫کنیم‬ ‫می‬ ‫استفاده‬ M ‫تقریبا‬ ‫طول‬ ‫به‬ ‫فضایی‬ ( M+7 /) 8 .‫کند‬ ‫می‬ ‫ایجاد‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫نگهداری‬ ‫برای‬ ‫را‬ ‫بایت‬ M ‫از‬ ‫عددی‬ ‫تواند‬ ‫می‬ ۱ ‫تا‬ ۶۴ ‫‌دادن‬ ‫ن‬‫نشا‬ ‫برای‬ .‫باشد‬ ۰ ‫و‬ ۱ ‫حرف‬ ‫از‬ ‫بیت‬ ‫صورت‬ ‫به‬ b ‫عنوان‬ ‫به‬ .‫کنیم‬ ‫می‬ ‫استفاده‬ ‫مثال‬ b'111 ' ‫و‬ b'10000000 ' ‫اعداد‬ ‫برابر‬ ‫ترتیب‬ ‫به‬ ‫که‬ ۷ ‫و‬ ۱۲۸ ‫به‬ ‫موضوع‬ ‫این‬ ‫بیشتر‬ ‫درک‬ ‫برای‬ .‫باشند‬ ‫می‬ ‫فرمان‬ ‫خط‬ ‫در‬ ‫زیر‬ ‫نتایج‬ ‫و‬ ‫دستورات‬ MySQL :‫فرمایید‬ ‫توجه‬ 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 mysql> INSERT INTO t SET b = b'11111111'; mysql> INSERT INTO t SET b = b'1010'; mysql> INSERT INTO t SET b = b'0101'; mysql> SELECT b+0, BIN(b+0), OCT(b+0), HEX(b+0) FROM t; +------+----------+----------+----------+ | b+0 | BIN(b+0) | OCT(b+0) | HEX(b+0) | +------+----------+----------+----------+ | 255 | 11111111 | 377 | FF | | 10 | 1010 | 12 | A | | 5 | 101 | 5 | 5 | +------+----------+----------+----------+ 3 rows in set (0.03 sec) ‫آخرین‬ Query ‫عبارت‬ .‫دهد‬ ‫می‬ ‫نشان‬ ‫را‬ ‫اعداد‬ ‫این‬ ‫تبدیل‬ ‫برای‬ ‫مختلف‬ ‫توابع‬ ‫باال‬ ‫در‬ + 0 ‫ذخیره‬ ‫دودویی‬ ‫مقدار‬ .‫کند‬ ‫می‬ ‫تبدیل‬ ‫متناظر‬ ‫‌دهی‬ ‫ه‬‫د‬ ‫عدد‬ ‫به‬ ‫را‬ ‫شده‬ ( ‫زمان‬ Date and Time ) ‫کل‬ ‫در‬ ۵ ‫مشاهده‬ ‫را‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫نوع‬ ‫این‬ ‫اطالعات‬ ‫زیر‬ ‫جدول‬ ‫در‬ .‫داریم‬ )‫تاریخ‬ ‫و‬ ‫(ساعت‬ ‫زمان‬ ‫ذخیره‬ ‫برای‬ ‫داده‬ ‫نوع‬ :‫‌فرمایید‬ ‫ی‬‫م‬
  • 206. ‫زمانی‬ ‫های‬ ‫داده‬ ‫نوع‬ ‫کلی‬ ‫اطالعات‬ (Date and Time) ‫نوع‬ )‫(بایت‬ ‫حافظه‬ ‫صفر‬ ‫مقدار‬ (“Zero” Value) DATE 3 '0000-00-00' TIME 3 '00:00:00' DATETIME 8 '0000-00-00 00:00:00' TIMESTAMP 4 '0000-00-00 00:00:00' YEAR 1 0000 .‫پرداخت‬ ‫خواهیم‬ ‫باال‬ ‫در‬ ‫شده‬ ‫ذکر‬ ‫‌های‬ ‫ه‬‫داد‬ ‫نوع‬ ‫بررسی‬ ‫به‬ ‫ادامه‬ ‫در‬ ‫داده‬ ‫نوع‬ DATE ‫داده‬ ‫نوع‬ ‫این‬ ‫فرض‬ ‫پیش‬ ‫فرمت‬ .‫شود‬ ‫می‬ ‫استفاده‬ ‫تاریخ‬ ‫سازی‬ ‫ذخیره‬ ‫برای‬ ‫فقط‬ ‫داده‬ ‫نوع‬ ‫این‬ ' YYYY-MM- DD ' ‫توسط‬ ‫که‬ ‫‌ای‬ ‫ه‬‫باز‬ .‫است‬ DATE ‫از‬ ‫شود‬ ‫می‬ ‫پشتیبانی‬ ' 1000 - 01 - 01 ' ‫تا‬ ' 9999 - 12 - 31 ' .‫باشد‬ ‫می‬ ‫داده‬ ‫نوع‬ TIME ‫داده‬ ‫نوع‬ ‫این‬ ‫‌فرض‬ ‫ش‬‫پی‬ ‫فرمت‬ .‫شود‬ ‫می‬ ‫استفاده‬ )‫ثانیه‬ ،‫دقیقه‬ ،‫(ساعت‬ ‫زمان‬ ‫سازی‬ ‫ذخیره‬ ‫برای‬ ‫داده‬ ‫نوع‬ ‫این‬ ' HH:MM:SS ' ‫یا‬ ‫و‬ ' HHH:MM:SS ' ‫نوع‬ ‫در‬ ‫که‬ ‫ای‬ ‫بازه‬ .‫است‬ TIME ‫از‬ ‫شود‬ ‫می‬ ‫پشتیبانی‬ -' 838:59:59 ' ‫تا‬ ' 838:59:59 ' ‫داده‬ ‫نوع‬ .‫باشد‬ ‫می‬ TIME ‫تفاوت‬ ‫نمایش‬ ‫برای‬ .‫شود‬ ‫نمی‬ ‫استفاده‬ ‫روز‬ ‫زمان‬ ‫نمایش‬ ‫برای‬ ‫فقط‬ ‫از‬ ‫تواند‬ ‫می‬ ‫نیز‬ ‫‌مانده‬ ‫ی‬‫باق‬ ‫زمان‬ ‫یا‬ ‫و‬ ‫بازه‬ ‫دو‬ ‫زمانی‬ TIME ‫شده‬ ‫پشتیبانی‬ ‫بازه‬ ‫دلیل‬ ‫همین‬ ‫به‬ .‫نمود‬ ‫استفاده‬ ‫از‬ ‫بیشتر‬ ۲۴ .‫باشد‬ ‫می‬ )‫(منفی‬ ‫صفر‬ ‫از‬ ‫کمتر‬ ‫یا‬ ‫و‬ ‫ساعت‬ ‫داده‬ ‫نوع‬ ‫در‬ ‫مخفف‬ ‫های‬ ‫عبارت‬ ‫از‬ ‫استفاده‬ ‫برای‬ TIME ‫مثال‬ ‫عنوان‬ ‫به‬ .‫نمایید‬ ‫دقت‬ ‫باید‬ MySQL ‫عبارت‬ ' 11:12 ' ‫صورت‬ ‫به‬ ‫را‬ ' 11:12:00 ' ‫بدون‬ ‫داده‬ ‫که‬ ‫صورتی‬ ‫در‬ .‫کند‬ ‫می‬ ‫تفسیر‬ ':' ،‫شود‬ ‫بیان‬ )‫نقطه‬ ‫(دو‬ MySQL ‫آن‬ ‫عبارت‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫کند‬ ‫می‬ ‫تفسیر‬ ‫راست‬ ‫سمت‬ ‫از‬ ‫را‬ ' 1112 ' ‫یا‬ ‫و‬ 1112 ‫معنی‬ ‫به‬ ' 00:11:12 ' .‫است‬ ‫فرض‬ ‫پیش‬ ‫صورت‬ ‫به‬ MySQL ‫محدوده‬ ‫از‬ ‫خارج‬ ‫‌های‬ ‫ه‬‫داد‬ TIME ‫شده‬ ‫وارد‬ ‫مناسب‬ ‫فرمت‬ ‫با‬ ‫که‬ ‫صورتی‬ ‫در‬ ‫را‬ ‫‌های‬ ‫ت‬‫عبار‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫کند‬ ‫می‬ ‫تبدیل‬ ‫بازه‬ ‫‌ترین‬ ‫ک‬‫نزدی‬ ‫به‬ ‫باشند‬ -' 850:00:00 ' ‫و‬ ' 850:00:00 ' ‫به‬ -' 838:59:59 ' ‫و‬ ' 838:59:59 ' ‫برای‬ ‫تفسیر‬ ‫قابل‬ ‫یا‬ ‫و‬ ‫نداشته‬ ‫مناسب‬ ‫فرمت‬ ‫که‬ ‫‌هایی‬ ‫ه‬‫داد‬ .‫شد‬ ‫خواهند‬ ‫تبدیل‬ ‫داده‬ TIME ‫عبارت‬ ‫به‬ ‫نباشند‬ ' 00:00:00 ' .‫شد‬ ‫خواهند‬ ‫تبدیل‬
  • 207. ‫داده‬ ‫نوع‬ DATETIME ‫پیش‬ ‫فرمت‬ .‫شود‬ ‫می‬ ‫استفاده‬ ‫ساعت‬ ‫و‬ ‫تاریخ‬ ‫شامل‬ ‫کامل‬ ‫صورت‬ ‫به‬ ‫زمان‬ ‫سازی‬ ‫ذخیره‬ ‫برای‬ ‫داده‬ ‫نوع‬ ‫این‬ ‫داده‬ ‫نوع‬ ‫این‬ ‫فرض‬ ' YYYY-MM-DD HH:MM:SS ' ‫پشتیبانی‬ ‫‌ی‬ ‫ه‬‫باز‬ .‫باشد‬ ‫می‬ DATETIME ‫از‬ ' 1000 - 01 - 01 00:00:00 ' ‫تا‬ ' 9999 - 12 - 31 23:59:59 ' .‫است‬ ‫داده‬ ‫نوع‬ TIMESTAMP ‫همانند‬ ‫داده‬ ‫نوع‬ ‫این‬ DATETIME ‫توسط‬ ‫که‬ ‫‌ای‬ ‫ه‬‫باز‬ .‫باشد‬ ‫می‬ TIMESTAMP ‫از‬ ‫‌شود‬ ‫ی‬‫م‬ ‫پشتیبانی‬ ' 1970 - 01 - 01 00:00:01 ' ‫تا‬ ' 2038 - 01 - 19 03:14:07 ' .‫است‬ ‫‌های‬ ‫ه‬‫داد‬ TIMESTAMP ( ‫زمانی‬ ‫منطقه‬ ‫زمان‬ ‫از‬ ‫شدن‬ ‫ذخیره‬ ‫هنگام‬ Time Zone ‫به‬ ‫سیستم‬ ‫کنونی‬ ) UTC ‫‌های‬ ‫ه‬‫داد‬ ‫دادن‬ ‫نشان‬ ‫هنگام‬ ،‫امر‬ ‫همین‬ ‫با‬ ‫متناظر‬ .‫شوند‬ ‫می‬ ‫ذخیره‬ ‫و‬ ‫تبدیل‬ TIMESTAMP ‫از‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫ابتدا‬ ، UTC ‫که‬ ‫صورتی‬ ‫در‬ ‫علت‬ ‫همین‬ ‫به‬ .‫شوند‬ ‫می‬ ‫داده‬ ‫نمایش‬ ‫بعد‬ ‫و‬ ‫شده‬ ‫تبدیل‬ ‫سیستم‬ ‫کنونی‬ ‫زمانی‬ ‫منطقه‬ ‫به‬ .‫شوند‬ ‫داده‬ ‫نمایش‬ ‫غلط‬ ‫یا‬ ‫و‬ ‫غیرعادی‬ ‫صورت‬ ‫به‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫است‬ ‫ممکن‬ ،‫شود‬ ‫عوض‬ ‫سیستم‬ ‫زمانی‬ ‫منطقی‬ ‫داده‬ ‫نوع‬ TIMESTAMP ‫برای‬ .‫باشید‬ ‫داشته‬ ‫خودکار‬ ‫مقداردهی‬ ‫یا‬ ‫و‬ ‫اولیه‬ ‫مقداردهی‬ ‫که‬ ‫دارد‬ ‫را‬ ‫قابلیت‬ ‫این‬ ‫را‬ ‫نظر‬ ‫مورد‬ ‫فیلد‬ ‫فرض‬ ‫پیش‬ ‫مقدار‬ ‫کافیست‬ ‫اولیه‬ ‫مقداردهی‬ CURRENT_TIMESTAMP :‫مانند‬ .‫دهید‬ ‫قرار‬ 1mysql> CREATE TABLE t (ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP); ‫فیلد‬ ‫در‬ ‫شده‬ ‫ذخیره‬ ‫مقدار‬ ،‫خودکار‬ ‫مقداردهی‬ ‫حالت‬ ‫در‬ TIMESTAMP ( ‫بروزرسانی‬ ‫هنگام‬ UPDATE ‫ردیف‬ ‫یک‬ ) :‫مانند‬ .‫کند‬ ‫می‬ ‫پیدا‬ ‫تغییر‬ ‫بروزرسانی‬ ‫زمان‬ ‫به‬ mysql> CREATE TABLE t (name VARCHAR(100), ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); mysql> INSERT INTO t(name) VALUES('Saeid'); mysql> SELECT * FROM t; +-------+---------------------+ | name | ts | +-------+---------------------+ | Saeid | 2011-12-22 12:00:26 | +-------+---------------------+ 1 row in set (0.00 sec) mysql> UPDATE t SET name = 'Alireza'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0
  • 208. mysql> SELECT * FROM t; +---------+---------------------+ | name | ts | +---------+---------------------+ | Alireza | 2011-12-22 12:01:56 | +---------+---------------------+ 1 row in set (0.00 sec) ‫صفحه‬ ‫به‬ ‫بیشتر‬ ‫اطالعات‬ ‫کسب‬ ‫برای‬ TIMESTAMP Properties ‫سایت‬ ‫در‬ MySQL .‫نمایید‬ ‫مراجعه‬ ‫داده‬ ‫نوع‬ YEAR ‫فرمت‬ ‫با‬ ‫سال‬ ‫سازی‬ ‫ذخیره‬ ‫برای‬ ‫داده‬ ‫نوع‬ ‫این‬ YYYY ‫به‬ ‫را‬ ‫خود‬ ‫نظر‬ ‫مورد‬ ‫سال‬ ‫تواند‬ ‫می‬ ‫شما‬ .‫‌رود‬ ‫ی‬‫م‬ ‫کار‬ ‫به‬ ‫رقمی‬ ‫دو‬ ‫صورت‬ YEAR(2) ‫یا‬ ‫و‬ ۴ ‫رقمی‬ YEAR(4) ‫نوع‬ .‫کنید‬ ‫تعریف‬ YEAR ‫سال‬ ‫از‬ 1901 ‫تا‬ 2155 ‫و‬ 0000 ‫را‬ ‫صورت‬ ‫به‬ ‫را‬ ‫سال‬ ‫که‬ ‫صورتی‬ ‫در‬ .‫کند‬ ‫می‬ ‫پشتیبانی‬ ۲ ‫اعداد‬ ،‫باشید‬ ‫کرده‬ ‫تعریف‬ ‫رقمی‬ 00 ‫تا‬ 69 ‫قرن‬ ‫در‬ ۲۱ ‫و‬ ‫اعداد‬ 70 ‫تا‬ 99 ‫قرن‬ ‫در‬ ۲۰ ‫مثال‬ .‫شوند‬ ‫می‬ ‫گرفته‬ ‫نظر‬ ‫در‬ 45 ‫عنوان‬ ‫به‬ 2045 ‫و‬ 80 ‫صورت‬ ‫به‬ 1980 ‫نظر‬ ‫در‬ ‫برای‬ ‫منطقی‬ ‫غیر‬ ‫مقادیر‬ ‫تمامی‬ .‫شود‬ ‫می‬ ‫گرفته‬ YEAR ‫صورت‬ ‫به‬ 0000 .‫شوند‬ ‫می‬ ‫ذخیره‬ ( ‫ها‬ ‫رشته‬ String ) ‫داده‬ ‫نوع‬ String ‫نوع‬ ‫از‬ ‫هایی‬ ‫داده‬ ‫کلی‬ ‫اطالعات‬ ‫زیر‬ ‫در‬ .‫شود‬ ‫می‬ ‫استفاده‬ )‫(متون‬ ‫‌ها‬ ‫ه‬‫رشت‬ ‫داری‬ ‫نگه‬ ‫برای‬ String ‫زیر‬ ‫جدول‬ ‫در‬ .‫فرمایید‬ ‫می‬ ‫مشاهده‬ ‫را‬ M ‫و‬ ‫داده‬ ‫برای‬ ‫شده‬ ‫تعریف‬ ‫طول‬ ‫‌دهنده‬ ‫ن‬‫نشا‬ L ‫‌دهنده‬ ‫ن‬‫نشا‬ .‫باشد‬ ‫می‬ ‫شده‬ ‫داده‬ ‫رشته‬ ‫واقعی‬ ‫طول‬ ( ‫‌ها‬ ‫ه‬‫رشت‬ ‫داده‬ ‫نوع‬ ‫کلی‬ ‫اطالعات‬ String ) ‫نوع‬ ‫مقدار‬ )‫(بایت‬ ‫حافظه‬ CHAR(M) 0 <= M <= 255 M × w ‫بایت‬. w ‫طول‬ ‫حداکثر‬ ‫برای‬ ‫نیاز‬ ‫مورد‬ ‫بایت‬ ‫تعداد‬ ‫در‬ ‫شده‬ ‫تعریف‬ ‫کاراکترهای‬ character set ‫باشد‬ ‫می‬ ‫جدول‬. BINARY(M) 0 <= M <= 255 M ‫بایت‬ VARCHAR(M) 0 <= M <= 65532 L + 1 ‫از‬ ‫کمتر‬ ‫نظر‬ ‫مورد‬ ‫داده‬ ‫اگر‬ ‫بایت‬ ۲۵۵ ‫داشته‬ ‫نیاز‬ ‫بایت‬ ‫باشد‬. L + 2 ‫از‬ ‫بیشتر‬ ‫نظر‬ ‫مورد‬ ‫داده‬ ‫اگر‬ ‫بایت‬ ۲۵۵ ‫داشته‬ ‫نیاز‬ ‫بایت‬
  • 209. ‫نوع‬ ‫مقدار‬ )‫(بایت‬ ‫حافظه‬ ‫باشد‬. VARBINARY(M) 0 <= M <= 65532 M + 1 ‫از‬ ‫کمتر‬ ‫نظر‬ ‫مورد‬ ‫داده‬ ‫اگر‬ ‫بایت‬ ۲۵۵ ‫داشته‬ ‫نیاز‬ ‫بایت‬ ‫باشد‬. M + 2 ‫از‬ ‫بیشتر‬ ‫نظر‬ ‫مورد‬ ‫داده‬ ‫اگر‬ ‫بایت‬ ۲۵۵ ‫داشته‬ ‫نیاز‬ ‫بایت‬ ‫باشد‬. TINYBLOB L < 2 8 L + 1 ‫بایت‬ TINYTEXT L < 2 8 L + 1 ‫بایت‬ BLOB L < 2 16 L + 2 ‫بایت‬ TEXT L < 2 16 L + 2 ‫بایت‬ MEDIUMBLOB L < 2 24 L + 3 ‫بایت‬ MEDIUMTEXT L < 2 24 L + 3 ‫بایت‬ LONGBLOB L < 2 32 L + 4 ‫بایت‬ LONGTEXT L < 2 32 L + 4 ‫بایت‬ ENUM('v1','v2',...) ‫حداکثر‬ ۶۵,۵۳۵ ‫عضو‬ ۱ ‫یا‬ ۲ ‫بایت‬ . ‫داده‬ ‫مقدار‬ ‫به‬ ‫وابسته‬. SET('v1','v2',...) ‫حداکثر‬ ۶۴ ‫عضو‬ ۱، ۲، ۳، ۴ ‫یا‬ ۸ ‫بایت‬ ‫شده‬ ‫داده‬ ‫مجموعه‬ ‫به‬ ‫وابسته‬. ‫داده‬ ‫نوع‬ CHAR ‫و‬ VARCHAR CHAR ‫و‬ VARCHAR ‫بین‬ ‫که‬ ‫تفاوتی‬ ‫‌ترین‬ ‫م‬‫مه‬ .‫هستند‬ ‫هم‬ ‫به‬ ‫شبیه‬ ‫بسیار‬ CHAR ‫و‬ VARCHAR ‫دارد‬ ‫وجود‬ ‫که‬ ‫را‬ ‫کاراکتری‬ ‫تعداد‬ ‫حداکثر‬ ‫شما‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫نوع‬ ‫این‬ ‫تعریف‬ ‫هنگام‬ .‫است‬ ‫اطالعات‬ ‫بازیابی‬ ‫و‬ ‫سازی‬ ‫ذخیره‬ ‫نحوه‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫نمایید‬ ‫می‬ ‫مشخص‬ ‫را‬ ‫شود‬ ‫ذخیره‬ ‫خواهید‬ ‫می‬ CHAR(30) ‫حداکثر‬ ‫ذخیره‬ ‫برای‬ ۳۰ ‫کاراکتر‬ .‫شود‬ ‫می‬ ‫تعریف‬ ‫نوع‬ ‫از‬ ‫که‬ ‫ستونی‬ ‫طول‬ CHAR ،‫باشد‬ ‫شده‬ ‫تعریف‬ ‫طول‬ ‫از‬ ‫کمتر‬ ‫داده‬ ‫طول‬ ‫که‬ ‫صورتی‬ ‫در‬ .‫است‬ ‫ثابت‬ ‫باشد‬ ‫فاصله‬ ‫با‬ ‫باقیمانده‬ ‫فضای‬ ( space ) ‫از‬ ‫قبل‬ ‫خالی‬ ‫فضای‬ ‫این‬ ‫اطالعات‬ ‫بازیابی‬ ‫هنگام‬ .‫‌شود‬ ‫ی‬‫م‬ ‫پر‬ ‫راست‬ ‫از‬ ‫حالت‬ ‫اینکه‬ ‫مگر‬ ‫‌شود‬ ‫ی‬‫م‬ ‫حذف‬ ‫نمایش‬ PAD_CHAR_TO_FULL_LENGTH .‫باشد‬ ‫شده‬ ‫فعال‬ ‫داده‬ ‫نوع‬ ‫در‬ VARCHAR ‫اگر‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫باشد‬ ‫می‬ ‫شده‬ ‫وارد‬ ‫داده‬ ‫مقدار‬ ‫اندازه‬ ‫به‬ ‫شده‬ ‫ذخیره‬ ‫داده‬ ‫طول‬ ‫صورت‬ ‫به‬ ‫ستونی‬ VARCHAR(100) ‫شده‬ ‫داده‬ ‫رشته‬ ‫طول‬ ‫ولی‬ ‫باشد‬ ‫شده‬ ‫تعریف‬ 50 ‫به‬ ‫فقط‬ ،‫باشد‬ ‫کاراکتر‬
  • 210. .‫است‬ ‫الزم‬ ‫فضا‬ ‫زیر‬ ‫بایت‬ ‫مقدار‬ (50 * ‫کاراکتر‬ ‫هر‬ ‫ذخیره‬ ‫برای‬ ‫الزم‬ ‫فضای‬ ) + 2 ‫تعریف‬ ‫در‬ ‫که‬ ‫صورتی‬ ‫در‬ VARCHAR(M) ‫مقدار‬ M ‫از‬ ‫بیشتر‬ ۶۵,۵۳۵ ،‫باشد‬ MySQL ‫ستون‬ ‫نوع‬ ‫خودکار‬ ‫طور‬ ‫به‬ ‫از‬ ‫را‬ VARCHAR ‫مانند‬ ‫مناسبی‬ ‫نوع‬ ‫به‬ MEDIUMTEXT .‫دهد‬ ‫می‬ ‫تغییر‬ ‫در‬ ‫را‬ ‫اطالعات‬ ‫ذخیره‬ ‫برای‬ ‫نیاز‬ ‫مورد‬ ‫فضای‬ ‫‌های‬ ‫ت‬‫تفاو‬ ‫زیر‬ ‫جدول‬ CHAR ‫و‬ VARCHAR ‫دقت‬ .‫دهد‬ ‫می‬ ‫نمایش‬ ‫زیر‬ ‫جدول‬ ‫در‬ ‫که‬ ‫کنید‬ Character Set ‫مانند‬ ‫بایتی‬ ‫تک‬ ‫نظر‬ ‫مورد‬ ‫داده‬ latin1 .‫است‬ ‫برای‬ ‫نیاز‬ ‫مورد‬ ‫فضای‬ ‫تفاوت‬ ‫بررسی‬ CHAR(4) ‫و‬ VARCHAR(4) ‫داده‬ CHAR(4) ‫نیاز‬ ‫مورد‬ ‫فضای‬ VARCHAR(4) ‫نیاز‬ ‫مورد‬ ‫فضای‬ '' ' ' ۴ ‫بایت‬ '' ۱ ‫بایت‬ 'ab' 'ab ' ۴ ‫بایت‬ 'ab' ۳ ‫بایت‬ 'abcd' 'abcd' ۴ ‫بایت‬ 'abcd' ۵ ‫بایت‬ 'abcdefgh' 'abcd' ۴ ‫بایت‬ 'abcd' ۵ ‫بایت‬ ‫داده‬ ‫نوع‬ BINARY ‫و‬ VARBINARY ‫مانند‬ ‫ها‬ ‫داده‬ ‫نوع‬ ‫این‬ CHAR ‫و‬ VARCHAR ‫‌های‬ ‫ه‬‫رشت‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫نوع‬ ‫این‬ ‫در‬ ‫که‬ ‫تفاوت‬ ‫این‬ ‫با‬ ‫فقط‬ ‫باشند‬ ‫می‬ ‫نتیجه‬ ‫در‬ .‫شود‬ ‫می‬ ‫ذخیره‬ )‫یک‬ ‫و‬ ‫(صفر‬ ‫باینری‬ Character set ‫طرفی‬ ‫از‬ .‫ندارد‬ ‫معنی‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫نوع‬ ‫این‬ ‫برای‬ .‫باشد‬ ‫می‬ ‫شده‬ ‫ذخیره‬ ‫باینری‬ ‫رشته‬ ‫عددی‬ ‫مقدار‬ ‫اساس‬ ‫بر‬ ‫مقایسه‬ ‫و‬ ‫‌سازی‬ ‫ب‬‫مرت‬ ‫داده‬ ‫نوع‬ BLOB ‫و‬ TEXT ‫مانند‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫نوع‬ ‫این‬ BINARY ‫و‬ VARBINARY ‫دارای‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫این‬ ‫از‬ ‫کدام‬ ‫هر‬ .‫باشند‬ ‫می‬ ۴ ‫که‬ ‫‌باشند‬ ‫ی‬‫م‬ ‫نوع‬ .‫است‬ ‫شدن‬ ‫ذخیره‬ ‫قابل‬ ‫داده‬ ‫طول‬ ‫حداکثر‬ ‫در‬ ‫‌ها‬ ‫ن‬‫آ‬ ‫تفاوت‬ ‫تنها‬
  • 211. ‫داده‬ ‫نوع‬ ENUM ‫مجموعه‬ ‫این‬ .‫باشد‬ ‫شده‬ ‫تعریف‬ ‫مجموعه‬ ‫از‬ ‫که‬ ‫دهد‬ ‫می‬ ‫را‬ ‫ای‬ ‫رشته‬ ‫سازی‬ ‫ذخیره‬ ‫امکان‬ ‫فقط‬ ‫داده‬ ‫نوع‬ ‫این‬ :‫زیر‬ ‫جدول‬ ‫مانند‬ .‫شود‬ ‫می‬ ‫تعریف‬ ‫جدول‬ ‫ساخت‬ ‫هنگام‬ 1 2 3 CREATE TABLE sizes ( name ENUM('small', 'medium', 'large') ); ‫ستون‬ ‫در‬ name ‫مقادیر‬ ‫از‬ ‫یکی‬ ‫توانید‬ ‫می‬ ‫فقط‬ ‫باال‬ ‫جدول‬ ‫در‬ small، medium ‫یا‬ large ‫در‬ .‫نمایید‬ ‫ذخیره‬ ‫را‬ ‫در‬ ‫خالی‬ ‫فضای‬ ،‫شود‬ ‫مجموعه‬ ‫وارد‬ ‫مجموعه‬ ‫از‬ ‫خارج‬ ‫مقداری‬ ‫که‬ ‫صورتی‬ name ‫وارد‬ ‫مقدار‬ ‫نه‬ ،‫شود‬ ‫می‬ ‫ذخیره‬ .‫شده‬ ‫داده‬ ‫نوع‬ SET ‫مانند‬ ‫داده‬ ‫نوع‬ ‫این‬ ENUM ‫را‬ ‫شده‬ ‫تعریف‬ ‫مجموعه‬ ‫از‬ ‫عضو‬ ‫چند‬ ‫توانید‬ ‫می‬ ‫شما‬ ‫که‬ ‫تفاوت‬ ‫این‬ ‫با‬ ،‫باشد‬ ‫می‬ ‫توجه‬ ‫زیر‬ ‫مثال‬ ‫به‬ .‫شوند‬ ‫می‬ ‫حذف‬ ‫سازی‬ ‫ذخیره‬ ‫از‬ ‫قبل‬ ‫تکراری‬ ‫‌های‬ ‫ه‬‫داد‬ ‫یا‬ ‫که‬ ‫نمایید‬ ‫توجه‬ .‫نمایید‬ ‫انتخاب‬ :‫فرمایید‬ 1 2 mysql> CREATE TABLE myset (col SET('a', 'b', 'c', 'd')); Query OK, 0 rows affected (0.05 sec) mysql> INSERT INTO myset (col) VALUES ('a,d'), ('d,a'), ('a,d,a'), ('a,d,d'), ('d,a,d'); Query OK, 5 rows affected (0.00 sec) Records: 5 Duplicates: 0 Warnings: 0 mysql> SELECT col FROM myset; +------+ | col | +------+ | a,d | | a,d | | a,d | | a,d | | a,d |
  • 212. +------+ 5 rows in set (0.00 sec) .‫نمایید‬ ‫خوددداری‬ ‫جدا‬ ',' ‫بعد‬ ‫یا‬ ‫و‬ ‫قبل‬ ‫فاصله‬ ‫قراردادن‬ ‫از‬ ‫نماییم؟‬ ‫انتخاب‬ ‫را‬ ‫مناسب‬ ‫داده‬ ‫نوع‬ ‫چطور‬ ‫خود‬ ‫ستون‬ ‫برای‬ ‫را‬ ‫داده‬ ‫نوع‬ ‫مختصرترین‬ ‫سپس‬ .‫نمایید‬ ‫معین‬ ‫را‬ ‫خود‬ ‫داده‬ ‫برای‬ ‫نیاز‬ ‫مورد‬ ‫‌ی‬ ‫ه‬‫باز‬ ‫چیز‬ ‫هر‬ ‫از‬ ‫قبل‬ ‫اعداد‬ ‫بازه‬ ‫برای‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫نمایید‬ ‫انتخاب‬ ۰ ‫تا‬ ۹۹۹۹۹ ‫نوع‬ MEDIUMINT UNSIGNED .‫است‬ ‫گزینه‬ ‫بهترین‬ ‫در‬ ‫داده‬ ‫پایگاه‬ ‫در‬ ‫را‬ ‫شمسی‬ ‫تاریخ‬ ‫هرگز‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫است‬ ‫شما‬ ‫داده‬ ‫با‬ ‫مناسب‬ ‫ستون‬ ‫نوع‬ ‫انتخاب‬ ‫دیگر‬ ‫مورد‬ ‫(مانند‬ ‫رشته‬ ‫نوع‬ ‫از‬ ‫ستونی‬ CHAR ‫در‬ ‫آن‬ ‫ذخیره‬ ‫و‬ ‫میالی‬ ‫تاریخ‬ ‫به‬ ‫تاریخ‬ ‫تبدیل‬ ‫گزینه‬ ‫بهترین‬ .‫ننمایید‬ ‫ذخیره‬ ) ‫نوع‬ ‫از‬ ‫‌ای‬ ‫ه‬‫داد‬ DATE .‫است‬ ‫نوع‬ ‫از‬ ‫را‬ ‫خود‬ ‫ستون‬ ،‫دارید‬ ‫الزم‬ ‫را‬ ‫مثبت‬ ‫اعداد‬ ‫فقط‬ ‫که‬ ‫صورتی‬ ‫در‬ ‫عددی‬ ‫‌های‬ ‫ه‬‫داد‬ ‫برای‬ ‫ستونی‬ ‫تعریف‬ ‫هنگام‬ ‫در‬ UNSIGNED ‫و‬ ‫اصلی‬ ‫کلید‬ ‫شما‬ ‫عددی‬ ‫ستون‬ ‫اگر‬ ‫مثال‬ ‫عنوان‬ ‫به‬ .‫نمایید‬ ‫انتخاب‬ ‫را‬ ‫بازه‬ ‫حداقل‬ ‫و‬ ‫نموده‬ ‫انتخاب‬ ( ‫است‬ ‫خودکار‬ ‫افزایشی‬ PRIMAY KEY and AUTO_INCREMENT ‫را‬ ‫خود‬ ‫داده‬ ‫نوع‬ ‫حتما‬ ) UNSIGNED ‫نوع‬ .‫شود‬ ‫برابر‬ ‫دو‬ ‫اصلی‬ ‫کلید‬ ‫مقدار‬ ‫حداکثر‬ ‫تا‬ ‫نمایید‬ ‫انتخاب‬ INTEGER SIGNED ‫عدد‬ ‫حداکثر‬ 2147483648 ‫(حدود‬ ۲ ‫و‬ )‫میلیارد‬ INTEGER UNSIGNED ‫عدد‬ ‫حداکثر‬ 4294967295 ‫(حدود‬ ۴ ‫می‬ ‫پشتیبانی‬ ‫را‬ )‫میلیارد‬ .‫کند‬ ‫از‬ ‫استفاده‬ ‫دیگر‬ ‫روش‬ PROCEDURE ANALYSE .‫است‬ ‫داده‬ ‫پایگاه‬ ‫خود‬ ‫پیشنهاد‬ ‫دریافت‬ ‫منظور‬ ‫به‬ PROCEDURE ANALYSE ‫می‬ ‫ارائه‬ ‫داده‬ ‫نوع‬ ‫کردن‬ ‫بهینه‬ ‫برای‬ ‫را‬ ‫خود‬ ‫پیشنهاد‬ ،‫فعلی‬ ‫‌های‬ ‫ه‬‫داد‬ ‫به‬ ‫توجه‬ ‫با‬ ،‫باشد‬ ‫بیشتر‬ ‫شما‬ ‫فعلی‬ ‫داده‬ ‫تعداد‬ ‫چه‬ ‫هر‬ ‫که‬ ‫باشید‬ ‫داشته‬ ‫نظر‬ ‫در‬ .‫دهد‬ PROCEDURE ANALYSE ‫پیشنهاد‬ ‫از‬ ‫استفاده‬ ‫نحوه‬ .‫دهد‬ ‫می‬ ‫‌تری‬ ‫ق‬‫دقی‬ ‫و‬ ‫بهتر‬ PROCEDURE ANALYSE ‫به‬ ‫آن‬ ‫نگارش‬ ‫نحوه‬ .‫است‬ ‫ساده‬ ‫بسیار‬ :‫است‬ ‫زیر‬ ‫صورت‬ 1 mysql> SELECT ... FROM ... WHERE ... PROCEDURE ANALYSE([max_elements, [max_memory]]); :‫مانند‬ 1SELECT col1, col2 FROM table1 PROCEDURE ANALYSE(10, 2000); ‫یا‬ 1SELECT * FROM table1 PROCEDURE ANALYSE() G
  • 213. ‫مشابه‬ ‫اسامی‬ ‫داده‬ ‫پایگاه‬ ‫در‬ MySQL ‫از‬ ‫یکی‬ .‫باشند‬ ‫می‬ ‫دسترسی‬ ‫قابل‬ ‫نیز‬ ‫دیگری‬ ‫مشابه‬ ‫‌های‬ ‫م‬‫نا‬ ‫با‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫انواع‬ ‫از‬ ‫برخی‬ ‫‌تر‬ ‫ت‬‫راح‬ ‫سازی‬ ‫پیاده‬ ‫کار‬ ‫این‬ ‫دالیل‬ SQL ‫می‬ ‫مشاهده‬ ‫را‬ ‫اسامی‬ ‫این‬ ‫زیر‬ ‫در‬ .‫است‬ ‫دیگر‬ ‫‌ی‬ ‫ه‬‫داد‬ ‫‌های‬ ‫ه‬‫پایگا‬ ‫های‬ .‫نمایید‬ ‫در‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫نوع‬ ‫برای‬ ‫مشابه‬ ‫اسامی‬ MySQL ‫داده‬ ‫نوع‬ ‫مشابه‬ ‫اسم‬ INTEGER INT DECIMAL DEC DECIMAL FIXED DECIMAL NUMERIC DOUBLE REAL TINYINT BOOLEAN TINYINT BOOL VARCHAR(M) CHARACTER VARYING(M) FLOAT FLOAT4 DOUBLE FLOAT8 TINYINT INT1 SMALLINT INT2 MEDIUMINT INT3 INT INT4 BIGINT INT8 MEDIUMBLOB LONG VARBINARY MEDIUMTEXT LONG VARCHAR MEDIUMTEXT LONG MEDIUMINT MIDDLEINT
  • 214. ‫پرفرمنس‬ ‫برای‬ ‫مواردی‬ mariadb / mysql : ‫کردن‬ ‫فعال‬ InnoDB file-per-table ‫دهیم‬ ‫توضیح‬ ‫که‬ ‫است‬ ‫مهم‬ ‫ابتدا‬ ‫در‬ InnoDB ‫موتور‬ ‫یک‬ storage ( ‫یا‬ storage engine .‫است‬ ) MySQL/MariaDB ‫موتور‬ ‫عنوان‬ ‫به‬ storage ‫از‬ ‫فرض‬ ‫پیش‬ ‫صورت‬ ‫به‬ ، InnoDB ‫گذشته‬ ‫در‬ .‫میکند‬ ‫استفاده‬ MySQL ( ‫جداول‬ ‫از‬ ‫نگهداری‬ ‫برای‬ tables ‫و‬ ) index ‫سیستم‬ ‫یک‬ ‫از‬ ‫دیتابیس‬ ‫های‬ tablespace .‫میکرد‬ ‫استفاده‬ ‫دیسک‬ ‫و‬ ‫بود‬ ‫دیتابیس‬ ‫پروسس‬ ‫آنها‬ ‫هدف‬ ‫تنها‬ ‫که‬ ‫سرورهایی‬ ‫برای‬ ‫شیوه‬ ‫این‬ storage ‫هدف‬ ‫هیچ‬ ‫برای‬ ‫آنها‬ .‫داشت‬ ‫معنا‬ ،‫نمیشد‬ ‫استفاده‬ ‫دیگری‬ InnoDB ‫دیتای‬ ‫فایل‬ ‫یک‬ ‫در‬ ‫دیتابیس‬ ‫هر‬ ‫اطالعات‬ ‫و‬ ‫آورده‬ ‫فراهم‬ ‫را‬ ‫تری‬ ‫منعطف‬ ‫شیوه‬ . ibd ‫هر‬ .‫میشود‬ ‫ذخیره‬ . ‫فایل‬ ibd ‫یک‬ tablespace ‫اصل‬ ‫در‬ .‫میدهد‬ ‫ارائه‬ ‫را‬ ‫خودش‬ ‫از‬ tablespace ‫ایجاد‬ ‫باعث‬ ‫دیتا‬ ‫حذف‬ ‫هنگام‬ ‫(یعنی‬ ‫شده‬ ‫سکتورها‬ ‫بین‬ ‫خالی‬ ‫فضای‬ Data Stream Contagency . ‫داشتن‬ ‫با‬ ‫ولی‬ )‫رفت‬ ‫خواهد‬ ‫بین‬ ‫از‬ idb ‫برای‬ ‫جداگانه‬ table ‫این‬ ‫ها‬ fragmentation ‫آن‬ ‫در‬ ‫که‬ ‫جداولی‬ ‫برای‬ ‫فقط‬ idb ‫این‬ ‫به‬ .‫داد‬ ‫خواهد‬ ‫رخ‬ ‫هستند‬ " ‫مانند‬ ‫دیتابیس‬ ‫عملکردهای‬ ،‫شیوه‬ TRUNCATE ‫در‬ ‫تغییری‬ ‫اینکه‬ ‫بدون‬ ‫جدول‬ ‫یک‬ ‫دیتای‬ ‫کردن‬ ‫حذف‬ ‫(برای‬ " ‫به‬ ‫را‬ ‫نشده‬ ‫استفاده‬ ‫فضای‬ ‫میتوانید‬ ‫شما‬ ‫همچنین‬ ‫و‬ ‫شوند‬ ‫انجام‬ ‫سریعتر‬ ‫میتوانند‬ )‫شود‬ ‫ایجاد‬ ‫جداول‬ ‫ساختار‬ ‫هنگام‬ drop ‫یا‬ truncate .‫کنید‬ ‫اصالح‬ ،‫دیتابیس‬ ‫جدول‬ ‫یک‬ ‫کردن‬ ‫در‬ ‫را‬ ‫دیتابیس‬ ‫جداول‬ ‫از‬ ‫یکسری‬ ‫میتوانید‬ ‫شما‬ ‫که‬ ‫است‬ ‫این‬ ‫حقیقت‬ ‫در‬ ‫تنظیمات‬ ‫این‬ ‫دیگر‬ ‫فایده‬ storage ‫لود‬ ‫در‬ ‫عالی‬ ‫بسیار‬ ‫بهبود‬ ‫باعث‬ ‫امر‬ ‫این‬ ‫و‬ ‫دهید‬ ‫قرار‬ ‫مجزا‬ I/O .‫شود‬ ‫شما‬ ‫دیسک‬ ‫روی‬ innodb_file_per_table ‫اسکیول‬ ‫مای‬ ‫در‬ ‫فرض‬ ‫پیش‬ ‫صورت‬ ‫به‬ 5.6 ‫در‬ ‫آنرا‬ ‫میتوانید‬ ‫شما‬ .‫است‬ ‫فعال‬ ‫باالتر‬ ‫و‬ ‫فایل‬ / etc/my.cnf .‫میباشد‬ ‫زیر‬ ‫به‬ ‫شبیه‬ ‫چیزی‬ ‫که‬ .‫کنید‬ ‫اضافه‬ innodb_file_per_table=1 ‫دیتابیس‬ ‫دیتای‬ ‫ذخیره‬ MySQL ‫مجزا‬ ‫پارتیشن‬ ‫روی‬ : ‫نکته‬ ‫روی‬ ‫تنها‬ ‫تنظیمات‬ ‫این‬ MySQL ‫روی‬ ‫و‬ ‫میکند‬ ‫کار‬ MariaDB .‫نمیکند‬ ‫کار‬ ‫اوقات‬ ‫گاهی‬ read/write ‫میتواند‬ ‫عامل‬ ‫سیستم‬ performace ‫سرور‬ mysql ‫اگر‬ ‫مخصوصا‬ .‫سازد‬ ‫کند‬ ‫را‬ ‫شما‬ ‫روی‬ hard drive ‫هارد‬ ‫یک‬ ‫از‬ ‫که‬ ‫میکنم‬ ‫توصیه‬ ‫من‬ ‫مورد‬ ‫این‬ ‫جای‬ ‫به‬ .‫باشد‬ ‫گرفته‬ ‫قرار‬ ‫عامل‬ ‫سیستم‬ ‫با‬ ‫یکسانی‬ ‫(ترجیحا‬ ‫مجزا‬ ‫درایو‬ SSD .‫کنید‬ ‫استفاده‬ ‫اسکیول‬ ‫مای‬ ‫سرویس‬ ‫برای‬ )
  • 215. ‫به‬ ‫را‬ ‫جدیدی‬ ‫درایو‬ ‫که‬ ‫داشت‬ ‫خواهید‬ ‫نیاز‬ ‫شما‬ ‫مورد‬ ‫این‬ ‫انجام‬ ‫برای‬ computer/server ‫در‬ ،‫کنید‬ ‫متصل‬ ‫خود‬ ‫تحت‬ ‫جدید‬ ‫درایو‬ ‫که‬ ‫میکنم‬ ‫فرض‬ ‫من‬ ‫مقاله‬ ‫این‬ / dev/sdb .‫بود‬ ‫خواهد‬ .‫است‬ ‫جدید‬ ‫درایو‬ ‫سازی‬ ‫آماده‬ ‫بعد‬ ‫مرحله‬ # fdisk /dev/sdb " ‫جدید‬ ‫پارتیشن‬ ‫ایجاد‬ ‫برای‬ ‫اکنون‬ n ‫را‬ ‫جدید‬ ‫پارتیشن‬ ‫اینکه‬ ‫برای‬ ‫سپس‬ ‫دهید‬ ‫فشار‬ ‫را‬ " primary " ،‫کنید‬ p ‫را‬ " ‫از‬ ‫را‬ ‫پارتیشن‬ ‫شماره‬ ‫آن‬ ‫از‬ ‫بعد‬ .‫دهید‬ ‫فشار‬ 1 ‫تا‬ 4 ‫و‬ ‫انتخاب‬ ‫را‬ ‫پارتیشن‬ ‫سایز‬ ‫سپس‬ ،‫کنید‬ ‫انتخاب‬ Enter .‫کنید‬ .‫کنید‬ ‫کانفیگ‬ ‫را‬ ‫پارتیشن‬ ‫سایز‬ ‫که‬ ‫داشت‬ ‫خواهید‬ ‫نیاز‬ ‫بعدی‬ ‫مرحله‬ ‫در‬ ‫کنید‬ ‫استفاده‬ ‫را‬ ‫دیسک‬ ‫کل‬ ‫میخواهید‬ ‫شما‬ ‫اگر‬ Enter ‫میتوانید‬ ‫شما‬ ‫اینصورت‬ ‫غیر‬ ‫در‬ ‫دهید‬ ‫فشار‬ ‫دیگر‬ ‫یکبار‬ ‫را‬ ‫برای‬ ‫اتمام‬ ‫از‬ ‫بعد‬ .‫کنید‬ ‫تعریف‬ ‫را‬ ‫جدید‬ ‫پارتیشن‬ ‫سایز‬ ‫دستی‬ ‫صورت‬ ‫به‬ write " ‫تغییرات‬ ‫کردن‬ w .‫کنید‬ ‫تایپ‬ ‫را‬ " ‫زیر‬ ‫همانند‬ ‫آسانی‬ ‫به‬ ‫کار‬ ‫این‬ .‫کنید‬ ‫ایجاد‬ ‫سیستم‬ ‫فایل‬ ‫جدید‬ ‫پارتیشن‬ ‫برای‬ ‫داشت‬ ‫خواهید‬ ‫نیاز‬ ‫شما‬ ‫سپس‬ .‫میشود‬ ‫انجام‬ # mkfs.ext4 /dev/sdb1 ‫فولدر‬ ‫یک‬ ‫در‬ ‫را‬ ‫جدیدمان‬ ‫پارتیشن‬ ‫ما‬ ‫اکنون‬ mount ‫نام‬ ‫من‬ .‫میکنیم‬ folder ‫را‬ ‫خود‬ SSD ‫در‬ ‫آنرا‬ ‫و‬ ‫کردم‬ ‫انتخاب‬ ‫دایرکتوری‬ root .‫ساختم‬ # mkdir /ssd/ ‫آماده‬ ‫اکنون‬ mount .‫کردیم‬ ‫ایجاد‬ ‫جدید‬ ‫فولدر‬ ‫در‬ ‫آنرا‬ ‫که‬ ‫هستیم‬ ‫جدیدی‬ ‫پارتیشن‬ ‫کردن‬ # mount /dev/sdb1 /ssd/ ‫میتوانیم‬ ‫ما‬ mount ‫هنگام‬ ‫به‬ ‫را‬ ‫دایرکتوری‬ ‫کردن‬ startup ‫فایل‬ ‫درون‬ ‫زیر‬ ‫خط‬ ‫کردن‬ ‫اضافه‬ ‫با‬ ‫و‬ ‫سیستم‬ / etc/fstab .‫کنیم‬ ‫اجرا‬ /dev/sdb1 /ssd ext3 defaults 0 0 ‫انتقال‬ ‫آماده‬ ‫شما‬ ‫اکنون‬ MySQL ‫زیر‬ ‫دستور‬ ‫با‬ ‫را‬ ‫اسکیول‬ ‫مای‬ ‫سرویس‬ ‫ابتدا‬ .‫هستید‬ ‫جدید‬ ‫دیسک‬ ‫به‬ stop .‫کنید‬ # service mysqld stop
  • 216. ‫برای‬ ‫تالش‬ ‫گونه‬ ‫هر‬ ‫از‬ ‫جلوگیری‬ ‫برای‬ ‫که‬ ‫میکنم‬ ‫توصیه‬ ‫شما‬ ‫به‬ ‫من‬ write ‫سرویس‬ ‫ها‬ ‫دیتابیس‬ ‫در‬ ‫دیتا‬ ‫کردن‬ ‫های‬ Apache ‫یا‬ Nginx ‫نیز‬ ‫را‬ stop .‫کنید‬ # service httpd stop # service nginx stop ‫دایرکتوری‬ ‫کل‬ ‫اکنون‬ MySQL ‫جدید‬ ‫درایو‬ ‫در‬ ‫را‬ copy .‫کنید‬ # cp /var/lib/mysql /ssd/ -Rp ‫های‬ ‫دیتابیس‬ ‫به‬ ‫توجه‬ ‫با‬ ‫مرحله‬ ‫این‬ MySQL ‫دایرکتوری‬ ‫آن‬ ‫شدن‬ ‫تمام‬ ‫از‬ ‫بعد‬ .‫بکشد‬ ‫طول‬ ‫است‬ ‫ممکن‬ ‫شما‬ mysql .‫دهید‬ ‫نام‬ ‫تغییر‬ ‫را‬ # mv /var/lib/mysql /var/lib/mysql-backup ‫یک‬ ‫سپس‬ symlink ‫دایرکتوری‬ ‫برای‬ mysql .‫کرد‬ ‫خواهیم‬ ‫ایجاد‬ # ln -s /ssd/mysql /var/lib/mysql ‫برای‬ ‫آماده‬ ‫شما‬ ‫اکنون‬ start ‫کردن‬ mysql ‫و‬ web .‫هستید‬ ‫خود‬ ‫سرویس‬ # service mysqld start # service httpd start # service nginx start .‫بود‬ ‫خواهند‬ ‫دسترسی‬ ‫قابل‬ ‫جدید‬ ‫درایو‬ ‫از‬ ‫شما‬ ‫اسکیول‬ ‫مای‬ ‫های‬ ‫دیتابیس‬ ‫بعد‬ ‫به‬ ‫لحظه‬ ‫این‬ ‫از‬ ‫سازی‬ ‫بهینه‬ InnoDB buffer pool Usage ‫موتور‬ InnoDB ‫یک‬ buffer pool ‫برای‬ cache ‫و‬ ‫دیتا‬ index ‫در‬ ‫ها‬ memory ‫میتواند‬ ‫که‬ ‫البته‬ ‫مورد‬ ‫این‬ .‫دارد‬ ‫که‬ ‫کند‬ ‫کمک‬ query ‫های‬ maysql/mariadb ‫سایز‬ ‫انتخاب‬ ‫اینجا‬ ‫در‬ .‫شوند‬ ‫اجرا‬ ‫سریعتر‬ ‫توجهی‬ ‫قابل‬ ‫طور‬ ‫به‬ ‫تان‬ ‫سیستم‬ ‫مموری‬ ‫مصرف‬ ‫درباره‬ ‫را‬ ‫خوبی‬ ‫دانش‬ ‫و‬ ‫مهم‬ ‫تصمیمات‬ ‫یکسری‬ ‫شما‬ ‫که‬ ‫است‬ ‫این‬ ‫نیازمند‬ ‫مناسب‬ .‫باشید‬ ‫داشته‬ : ‫کنید‬ ‫بررسی‬ ‫هست‬ ‫نیاز‬ ‫شما‬ ‫که‬ ‫مواردی‬ • ‫باید‬ ‫شما‬ ‫منظور‬ ‫این‬ ‫برای‬ .‫دارید‬ ‫نیاز‬ ‫مموری‬ ‫مقدار‬ ‫چه‬ ‫دیگر‬ ‫های‬ ‫پروسس‬ ‫برای‬ processes ‫های‬ ‫سیستم‬ page tables, socket buffers .‫بدانید‬ ‫را‬
  • 217. • ‫برای‬ ‫اختصاصی‬ ‫آیا‬ ‫سرور‬ ‫این‬ ‫اینکه‬ mysql ‫هستند‬ ‫اجرا‬ ‫حال‬ ‫در‬ ‫آن‬ ‫روی‬ ‫دیگری‬ ‫های‬ ‫سرویس‬ ‫یا‬ ‫و‬ ‫است‬ .‫میکنند‬ ‫مصرف‬ ‫مموری‬ ‫که‬ ‫حدود‬ ‫که‬ ‫بخواهید‬ ‫است‬ ‫ممکن‬ ‫شما‬ ‫اختصاصی‬ ‫سرور‬ ‫یک‬ ‫روی‬ 60/70 ‫به‬ ‫را‬ ‫خود‬ ‫مموری‬ ‫از‬ ‫درصد‬ innodb_buffer_pool_size ‫دارید‬ ‫اجرا‬ ‫حال‬ ‫در‬ ‫بیشتری‬ ‫های‬ ‫سرویس‬ ‫سرور‬ ‫روی‬ ‫شما‬ ‫اگر‬ .‫دهید‬ ‫اختصاص‬ ‫به‬ ‫که‬ ‫مموری‬ ‫میزان‬ ‫باید‬ ‫شما‬ innodb_buffer_pool_size .‫کنید‬ ‫بررسی‬ ‫مجدد‬ ‫را‬ ‫میدهید‬ ‫اختصاص‬ ‫در‬ ‫باید‬ ‫شما‬ ‫که‬ ‫مقداری‬ my.cnf : ‫کنید‬ ‫ویرایش‬ innodb_buffer_pool_size ‫از‬ ‫جلوگیری‬ Swap ‫در‬ ‫شدن‬ MySQL swapping ‫دیسک‬ ‫هارد‬ ‫خالی‬ ‫فضای‬ ‫از‬ ‫خاصی‬ ‫قسمت‬ ‫به‬ ‫را‬ ‫مموری‬ ‫از‬ ‫بخشی‬ ‫سیستم‬ ‫زمانیکه‬ ‫که‬ ‫ایست‬ ‫پروسه‬ " ‫آن‬ ‫به‬ ‫(که‬ ‫شما‬ swap ‫مموری‬ ‫شما‬ ‫سیستم‬ ‫که‬ ‫میدهد‬ ‫رخ‬ ‫زمانی‬ ‫معموال‬ ‫اتفاق‬ ‫این‬ .‫میدهد‬ ‫انتقال‬ )‫میگوییم‬ " ‫کردن‬ ‫خالی‬ ‫جای‬ ‫به‬ ‫و‬ ‫آورد‬ ‫می‬ ‫کم‬ ‫فیزیکی‬ RAM ‫وجود‬ ‫با‬ ‫حتی‬ .‫میدهد‬ ‫قرار‬ ‫دیسک‬ ‫درون‬ ‫را‬ ‫اطالعات‬ ‫سیستم‬ ‫از‬ ‫کندتر‬ ‫خیلی‬ ‫دیسک‬ ‫اینکه‬ RAM .‫باشد‬ ‫شما‬ .‫است‬ ‫فعال‬ ‫آپشنی‬ ‫این‬ ‫فرض‬ ‫پیش‬ ‫صورت‬ ‫به‬ # sysctl vm.swappiness vm.swappiness = 60 ‫کردن‬ ‫فعال‬ ‫غیر‬ ‫برای‬ swapping : ‫کنید‬ ‫اجرا‬ ‫را‬ ‫زیر‬ ‫دستور‬ # sysctl -w vm.swappiness=0 ‫حداکثر‬ ‫تعریف‬ Connection ‫های‬ MySQL
  • 218. ‫قسمت‬ max_connections ‫مقدار‬ ‫چه‬ ‫شما‬ ‫سرور‬ ‫در‬ ‫که‬ ‫میکند‬ ‫مشخص‬ connection ‫مجاز‬ ‫همزمان‬ ‫های‬ ‫سرور‬ .‫است‬ MySQL/MariaDB ‫دسترسی‬ ‫سطوح‬ ‫با‬ ‫کاربر‬ ‫برای‬ supper admin ‫از‬ ‫بیشتر‬ ‫یکی‬ ‫مقدار‬ max_connections ( .‫میکند‬ ‫مجاز‬ ‫را‬ max_connections + 1 ‫اسکیول‬ ‫مای‬ ‫کوئری‬ ‫زماینکه‬ ‫برای‬ ‫تنها‬ ‫کانکشن‬ ) ‫و‬ ‫میشود‬ ‫بسته‬ ‫آن‬ ‫از‬ ‫بعد‬ ،‫است‬ ‫باز‬ ‫اجراست‬ ‫حال‬ ‫در‬ connection .‫دهند‬ ‫رخ‬ ‫میتوانند‬ ‫جدید‬ ‫های‬ ‫از‬ ‫باالیی‬ ‫استفاده‬ ‫میزان‬ ‫میتوان‬ ‫زیاد‬ ‫بسیار‬ ‫های‬ ‫کانکشن‬ ‫که‬ ‫باشید‬ ‫داشته‬ ‫ذهن‬ ‫در‬ ram ‫داشته‬ ‫همراه‬ ‫به‬ ‫را‬ ‫سرور‬ ‫شدن‬ ‫قفل‬ ‫به‬ ‫منجر‬ ‫و‬ ‫باشند‬ mysql ‫بین‬ ‫ها‬ ‫کانکشن‬ ‫به‬ ‫نیاز‬ ‫کوچک‬ ‫های‬ ‫سایت‬ ‫معموال‬ .‫شوند‬ ‫شما‬ 100 ‫تا‬ 200 ‫به‬ ‫نیاز‬ ‫است‬ ‫ممکن‬ ‫بزرگتر‬ ‫های‬ ‫سایت‬ ‫حالیکه‬ ‫در‬ ‫هستند‬ 500 - 800 .‫باشند‬ ‫داشته‬ ‫بیشتر‬ ‫حتی‬ ‫یا‬ ‫از‬ ‫استفاده‬ ‫میزان‬ ‫به‬ ‫شدیدا‬ ‫میدهیم‬ ‫قرار‬ ‫اینجا‬ ‫در‬ ‫که‬ ‫مقداری‬ MySQL/MariaDB .‫دارد‬ ‫شما‬ ‫میزان‬ ‫متغییر‬ ‫صورت‬ ‫به‬ ‫میتوانید‬ ‫شما‬ max_connections ‫به‬ ‫نیاز‬ ‫بدون‬ ‫را‬ reset ‫سرویس‬ ‫کردن‬ mysql ‫با‬ ‫را‬ .‫دهید‬ ‫تغییر‬ ‫زیر‬ ‫دستور‬ ‫اجرای‬ # mysql -u root -p mysql> set global max_connections := 300; ‫کانفیگ‬ thread_cache_size ‫در‬ MySQL ‫بخش‬ thread_cache_size ‫میزان‬ thread ‫باید‬ ‫شما‬ ‫سرور‬ ‫که‬ ‫هایی‬ cach .‫میکند‬ ‫تعریف‬ ‫را‬ ‫کند‬ ‫زمانیکه‬ ‫کالینت‬ disconnect ‫میشود‬ thread ‫از‬ ‫کمتر‬ ‫اگر‬ ‫او‬ ‫های‬ thread_cache_size ‫در‬ ،‫باشند‬ cache ‫داده‬ ‫قرار‬ .‫میشود‬ ‫از‬ ‫استفاده‬ ‫با‬ ‫بعدی‬ ‫های‬ ‫خواست‬ ‫در‬ thread ‫در‬ ‫شده‬ ‫ذخیره‬ ‫های‬ cache .‫میشوند‬ ‫کامل‬ ‫به‬ ‫بخشیدن‬ ‫بهبود‬ ‫برای‬ performance ‫میتوانید‬ ‫شما‬ ‫خود‬ thread_cache_size ‫بزرگ‬ ‫نسبتا‬ ‫عدد‬ ‫یک‬ ‫به‬ ‫را‬ ‫در‬ .‫کنید‬ ‫تعریف‬ cache hit rate ‫مموری‬ ‫از‬ ‫کوچکی‬ ‫فضای‬ ‫در‬ ‫را‬ ‫شده‬ ‫اجرا‬ ‫های‬ ‫کوئری‬ ‫آخرین‬ cache ‫و‬ ‫کرده‬ ‫سریعتر‬ ‫لود‬ ‫باعث‬ ‫امر‬ ‫همین‬ query ‫کردن‬ ‫پیدا‬ ‫برای‬ .‫میشود‬ ‫ها‬ thread cache hit rate ‫تکنیک‬ ‫میتوانید‬ ‫شما‬ .‫کنید‬ ‫استفاده‬ ‫را‬ ‫زیر‬ ‫های‬ mysql> show status like 'Threads_created'; mysql> show status like 'Connections';
  • 219. ‫درصد‬ ‫محاسبه‬ ‫برای‬ ‫را‬ ‫زیر‬ ‫فرمول‬ ‫اکنون‬ thread cache hit rate .‫کنید‬ ‫استفاده‬ 100 - ((Threads_created / Connections) * 100) ‫جدید‬ ‫های‬ ‫کانکشن‬ ‫اکثر‬ ‫که‬ ‫معناست‬ ‫بدان‬ ‫این‬ ‫کردید‬ ‫دریافت‬ ‫را‬ ‫کمی‬ ‫عدد‬ ‫شما‬ ‫اگر‬ MySQL ‫شروع‬ ‫حال‬ ‫در‬ ‫کردن‬ thread ‫جای‬ ‫به‬ ‫جدید‬ load ‫از‬ ‫آنها‬ ‫کردن‬ cache ‫میخواهید‬ ‫مطمئنا‬ ‫شما‬ ‫مواردی‬ ‫چنین‬ ‫در‬ .‫هستند‬ thread_cache_size .‫دهید‬ ‫افزایش‬ ‫را‬ ‫که‬ ‫است‬ ‫این‬ ‫اینجا‬ ‫در‬ ‫جالب‬ ‫نکته‬ thread_cache_size ‫به‬ ‫نیاز‬ ‫اینکه‬ ‫بدون‬ ‫متغیر‬ ‫صورت‬ ‫به‬ ‫میتوان‬ ‫را‬ restart ‫سرویس‬ ‫کردن‬ mysql .‫کنید‬ ‫اجرا‬ ‫را‬ ‫زیر‬ ‫دستور‬ ‫میتوانید‬ ‫منظور‬ ‫این‬ ‫برای‬ ‫که‬ ‫داد‬ ‫تغییر‬ ،‫باشید‬ ‫داشته‬ mysql> set global thread_cache_size = 16; ‫کردن‬ ‫فعال‬ ‫غیر‬ Reverse DNS Lookups ‫در‬ MySQL ‫فرض‬ ‫پیش‬ ‫صورت‬ ‫به‬ MySQL/MariaDB ‫یک‬ dns lookup ‫از‬ ip address/Hostname ‫آنها‬ ‫از‬ ‫که‬ ‫کاربرانی‬ ‫از‬ ‫یک‬ ‫هر‬ ‫برای‬ .‫میکند‬ ‫اجرا‬ ،‫میکند‬ ‫دریافت‬ ‫کانکشن‬ client connection ،‫ها‬ ip ‫یک‬ ‫برای‬ ‫ها‬ ‫آدرس‬ host name ‫توسط‬ resolve ‫آن‬ ‫از‬ ‫بعد‬ .‫میشود‬ ‫چک‬ hostname ‫پی‬ ‫آی‬ ‫یک‬ ‫به‬ resolve ‫با‬ ‫دو‬ ‫هر‬ ‫که‬ ‫شود‬ ‫بررسی‬ ‫تا‬ ‫میشود‬ ‫هم‬ match .‫شوند‬ ‫بد‬ ‫کانفیگ‬ ‫موارد‬ ‫در‬ ‫است‬ ‫ممکن‬ ‫مورد‬ ‫این‬ ‫متاسفانه‬ DNS ‫سرور‬ ‫مشکالت‬ ‫یا‬ DNS ‫این‬ ‫و‬ ،‫شود‬ ‫تاخیر‬ ‫باعث‬ ‫میتوانید‬ ‫شما‬ ‫اینکه‬ ‫بر‬ ‫است‬ ‫دلیلی‬ revers dns lookup ‫غیر‬ ‫تان‬ ‫کانفیگ‬ ‫فایل‬ ‫به‬ ‫زیر‬ ‫موارد‬ ‫کردن‬ ‫اضافه‬ ‫با‬ ‫را‬ .‫کنید‬ ‫فعال‬ [mysqld] # Skip reverse DNS lookup of clients skip-name-resolve ‫را‬ ‫تان‬ ‫اسکیول‬ ‫مای‬ ‫سرویس‬ ‫باید‬ ‫شما‬ ‫باال‬ ‫تغییرات‬ ‫اعمال‬ ‫از‬ ‫بعد‬ restart .‫کنید‬
  • 220. ‫کانفیگ‬ query_cache_size ‫در‬ MySQL ‫و‬ ‫دارید‬ ‫تکراری‬ ‫کوئری‬ ‫زیادی‬ ‫تعداد‬ ‫شما‬ ‫اگر‬ data ‫از‬ ‫نمیکند‬ ‫تغییر‬ ‫اغلب‬ query cache ‫افراد‬ .‫کنید‬ ‫استفاده‬ ‫پشت‬ ‫مفهوم‬ ‫اغلب‬ query_cache_size ( ‫بایت‬ ‫گیگا‬ ‫به‬ ‫را‬ ‫مقدار‬ ‫این‬ ‫و‬ ‫نمیکنند‬ ‫درک‬ ‫را‬ GB ‫که‬ ‫میکنند‬ ‫تعریف‬ ) .‫بشود‬ ‫کارایی‬ ‫کاهش‬ ‫باعث‬ ‫حقیقت‬ ‫در‬ ‫میتواند‬ ‫که‬ ‫است‬ ‫حقیقت‬ ‫این‬ ،‫آن‬ ‫علت‬ thread ‫که‬ ‫دارند‬ ‫نیاز‬ ‫ها‬ cache .)‫کنند‬ ‫(مسدود‬ ‫ببندند‬ ‫ها‬ ‫آپدیت‬ ‫طول‬ ‫در‬ ‫را‬ ‫مقدار‬ ‫معموال‬ 200 - 300 MB ‫شما‬ ‫باشد‬ ‫کوچک‬ ‫نسبتا‬ ‫شما‬ ‫سایت‬ ‫وب‬ ‫اگر‬ .‫میباشد‬ ‫کافی‬ ،‫حد‬ ‫از‬ ‫بیشتر‬ ‫حتی‬ ‫مقدار‬ ‫میتوانید‬ 64 MB .‫دهید‬ ‫افزایش‬ ‫آنرا‬ ‫مرور‬ ‫به‬ ‫و‬ ‫کنید‬ ‫امتحان‬ ‫را‬ ‫کانفیگ‬ ‫فایل‬ ‫به‬ ‫را‬ ‫زیر‬ ‫تنظیمات‬ ‫باید‬ ‫شما‬ MySQL .‫کنید‬ ‫اضافه‬ query_cache_type = 1 query_cache_limit = 256K query_cache_min_res_unit = 2k query_cache_size = 80M ‫تنظیم‬ tmp_table_size ‫و‬ max_heap_table_size ‫جلوگیری‬ ‫دیسک‬ ‫روی‬ ‫رایت‬ ‫از‬ ‫که‬ ‫کرد‬ ‫خواهند‬ ‫کمک‬ ‫شما‬ ‫به‬ ‫و‬ ‫باشند‬ ‫داشته‬ ‫یکسانی‬ ‫سایز‬ ‫باید‬ ‫بخش‬ ‫دو‬ ‫هر‬ .‫شود‬ tmp_table_size ‫و‬ ‫داخلی‬ ‫های‬ ‫جدول‬ ‫سایز‬ ‫مقدار‬ ‫حداکثر‬ in-memory .‫میباشد‬ MyISAM ‫موقع‬ update ‫یا‬ insert ‫شدن‬ ‫تمام‬ ‫زمان‬ ‫تا‬ transaction ‫کل‬ table ‫را‬ lock ‫ولی‬ ،‫میکند‬ innodb ‫یک‬ ‫فقط‬ ‫میتواند‬ raw ‫را‬ lock ‫دیگر‬ ‫اینکه‬ ‫با‬ ‫همزمان‬ .‫میدهد‬ ‫تغییر‬ ‫یا‬ raw ‫دیگر‬ ‫توسط‬ ‫ها‬ query ‫و‬ ‫اجرا‬ ‫میتوانند‬ ‫ها‬ lock ‫برای‬ ،‫بشوند‬ unlock ‫شدن‬ table ‫بهتر‬ ‫عملکرد‬ ‫باعث‬ ‫امر‬ ‫همین‬ ‫و‬ ‫شده‬ ‫آپدیت‬ ‫مرتب‬ ‫مختلف‬ ‫های‬ ‫کوئری‬ ‫با‬ innodb ‫ولی‬ ،‫میشود‬ MyISAM ‫به‬ ‫نصبت‬ innodb ‫ریکاوری‬ ‫برای‬ ‫بهتری‬ ‫های‬ ‫مکانیزم‬ table .‫دارد‬ ‫ها‬
  • 221. ‫روی‬ ‫مورد‬ ‫این‬ ‫و‬ performance .‫گذاشت‬ ‫خواهد‬ ‫تاثیر‬ ‫دیتابیس‬ admin ‫میکنند‬ ‫توصیه‬ ‫معموال‬ ‫سیستم‬ ‫های‬ ‫از‬ ‫گیگ‬ ‫هر‬ ‫ازای‬ ‫به‬ ‫که‬ ram ‫مقدار‬ ،‫زیر‬ ‫مقادیر‬ ‫دوی‬ ‫هر‬ ‫برای‬ ‫سرور‬ ‫روی‬ 64M .‫بدهند‬ ‫را‬ [mysqld] tmp_table_size= 64M max_heap_table_size= 64M ‫کردن‬ ‫فعال‬ Slow query Logs ‫در‬ MySQL log ‫کردن‬ query ‫های‬ slow ‫این‬ .‫کند‬ ‫کمک‬ ‫آنها‬ ‫کردن‬ ‫دیباگ‬ ‫و‬ ‫دیتابیس‬ ‫مشکالت‬ ‫تشخیص‬ ‫در‬ ‫شما‬ ‫به‬ ‫میتواند‬ .‫میشود‬ ‫فعال‬ ‫شما‬ ‫اسکیول‬ ‫مای‬ ‫کانفیگ‬ ‫فایل‬ ‫به‬ ‫زیر‬ ‫مقدارهای‬ ‫کردن‬ ‫اضافه‬ ‫با‬ ‫آسانی‬ ‫به‬ ‫مورد‬ slow-query-log = 1 slow-query-log-file = /var/lib/mysql/mysql-slow.log long_query_time = 1 ،‫اول‬ ‫بخش‬ log ‫های‬ ‫کوئری‬ slow ‫سازی‬ ‫ذخیره‬ ‫امکان‬ ‫اسکیول‬ ‫مای‬ ‫به‬ ‫دوم‬ ‫بخش‬ ‫حالیکه‬ ‫در‬ ‫میکند‬ ‫فعال‬ ‫را‬ log ‫از‬ .‫میکند‬ ‫اعالم‬ ‫را‬ ‫واقعی‬ ‫فایل‬ long_query_time ‫طول‬ ‫اسکیول‬ ‫مای‬ ‫کوئری‬ ‫یک‬ ‫زمانیکه‬ ‫مقدار‬ ‫تعریف‬ ‫برای‬ ‫برای‬ ‫بکشید‬ ‫طول‬ ‫شده‬ ‫مشخص‬ ‫زمان‬ ‫این‬ ‫از‬ ‫بیشتر‬ ‫کوئری‬ ‫اگر‬ ‫حقیقت‬ ‫در‬ .‫کنید‬ ‫استفاده‬ ‫شود‬ ‫اجرا‬ ‫تا‬ ‫میکشد‬ ‫کوئری‬ ‫یک‬ ‫منزله‬ ‫به‬ ‫سیستم‬ slow .‫میشود‬ ‫تلقی‬ ‫برای‬ ‫بررسی‬ Connection ‫آزاد‬ ‫های‬ MySQL ( ‫آزاد‬ ‫های‬ ‫کانکشن‬ idle ‫ممکن‬ ‫صورت‬ ‫در‬ ‫یا‬ ‫متوقف‬ ‫باید‬ ‫و‬ ‫میکنند‬ ‫مصرف‬ ‫را‬ ‫سیستم‬ ‫منابع‬ ) refresh ‫این‬ .‫شوند‬
  • 222. ‫وضعیت‬ ‫در‬ ‫هایی‬ ‫کانکشن‬ ‫چنین‬ sleep ‫باقی‬ ‫حالت‬ ‫همان‬ ‫در‬ ‫طوالنی‬ ‫زمانی‬ ‫مدت‬ ‫برای‬ ‫معموال‬ ‫و‬ ‫میبرند‬ ‫سر‬ ‫به‬ ‫کردن‬ ‫پیدا‬ ‫برای‬ .‫میماند‬ connection .‫کنید‬ ‫اجرا‬ ‫را‬ ‫زیر‬ ‫دستور‬ ‫میتوانید‬ ‫آزاد‬ ‫های‬ # mysqladmin processlist -u root -p | grep “Sleep” ‫وضعیت‬ ‫در‬ ‫که‬ ‫هایی‬ ‫پروسس‬ ‫از‬ ‫لیستی‬ ‫شما‬ ‫به‬ ‫دستور‬ ‫این‬ sleep ‫این‬ .‫داد‬ ‫خواهد‬ ‫نمایش‬ ‫را‬ ‫هستند‬ event ‫هنگامیکه‬ ‫مثال‬ .‫میشود‬ ‫نمایان‬ ‫میکند‬ ‫استفاده‬ ‫دیتابیس‬ ‫به‬ ‫دائمی‬ ‫ارتباط‬ ‫از‬ ‫کد‬ ‫یک‬ ‫زمانیکه‬ php ‫از‬ ‫استفاده‬ ‫با‬ mysql_pconnect ‫را‬ ‫کانکشن‬ ‫و‬ ‫کرد‬ ‫اجرا‬ ‫را‬ ‫هایی‬ ‫کوئری‬ ‫اینکه‬ ‫از‬ ‫بعد‬ ‫میکند‬ ‫باز‬ ‫دیتابیس‬ ‫به‬ ‫را‬ ‫کانکشنی‬ ‫یک‬ ‫این‬ ‫کرد‬ ‫رها‬ ‫باز‬ ‫همانطور‬ event ‫هر‬ ‫که‬ ‫میشود‬ ‫باعث‬ ‫مورد‬ ‫این‬ .‫میشود‬ ‫نمایان‬ buffer ‫هر‬ ‫ازای‬ ‫به‬ thread ‫در‬ memory ‫آن‬ ‫زمانیکه‬ ‫تا‬ ‫شود‬ ‫داشته‬ ‫نگه‬ thread .‫برود‬ ‫بین‬ ‫از‬ ‫کردن‬ ‫چک‬ ،‫دهید‬ ‫انجام‬ ‫باید‬ ‫اینجا‬ ‫در‬ ‫شما‬ ‫که‬ ‫چیزی‬ ‫اولین‬ code ‫به‬ ‫اگر‬ .‫میباشد‬ ‫آن‬ ‫اصالح‬ ‫و‬ code ‫بیرون‬ ‫بخش‬ ‫میتوانید‬ ،‫ندارید‬ ‫دسترسی‬ ‫سیستم‬ wait_timeout ‫فرض‬ ‫پیش‬ ‫مقدار‬ .‫دهید‬ ‫تغییر‬ ‫را‬ 28800 ‫است‬ ‫ثانیه‬ ‫به‬ ‫شبیه‬ ‫چیزی‬ ‫به‬ ‫راحت‬ ‫خیال‬ ‫با‬ ‫آنرا‬ ‫میتوانید‬ ‫شما‬ ‫که‬ 60 .‫دهید‬ ‫کاهش‬ wait_timeout=60 ‫برای‬ ‫مناسب‬ ‫سیستم‬ ‫فایل‬ ‫انتخاب‬ MySQL ‫در‬ ‫کنید‬ ‫بررسی‬ ‫دارید‬ ‫نیاز‬ ‫که‬ ‫چیزی‬ ‫ترین‬ ‫مهم‬ .‫است‬ ‫حیاتی‬ ‫شما‬ ‫دیتابیس‬ ‫برای‬ ‫درست‬ ‫سیستم‬ ‫فایل‬ ‫انتخاب‬ .‫است‬ ‫مدیریت‬ ‫در‬ ‫راحتی‬ ‫و‬ ‫کارایی‬ ،‫یکپارچگی‬ ‫اینجا‬ ‫های‬ ‫توصیه‬ ‫به‬ ‫توجه‬ ‫با‬ MariaDB ‫ها‬ ‫سیستم‬ ‫فایل‬ ‫بهترین‬ XFS, Ext4 ‫و‬ Btrfs ‫فایل‬ ‫آنها‬ ‫همه‬ .‫هستند‬ ‫های‬ ‫سیستم‬ enterprise ‫ذخیره‬ ‫برای‬ ‫بزرگ‬ ‫خیلی‬ ‫مقدارهای‬ ‫و‬ ‫بزرگ‬ ‫خیلی‬ ‫های‬ ‫فایل‬ ‫با‬ ‫میتوانند‬ ‫که‬ ‫هستند‬ ‫ی‬ .‫گیرند‬ ‫قرار‬ ‫استفاده‬ ‫مورد‬ .‫کنید‬ ‫مشاهده‬ ‫سیستم‬ ‫فایل‬ ‫سه‬ ‫این‬ ‫درباره‬ ‫مفید‬ ‫اطالعات‬ ‫یکسری‬ ‫میتوانید‬ ‫شما‬ ‫زیر‬ ‫در‬ Btrfs Ext4 XFS Filesystems 16EB 1EB 8EB Maximum filesystem size
  • 223. 16EB 16TB 8EB Maximum file size .‫است‬ ‫شده‬ ‫داده‬ ‫توضیح‬ ‫زیر‬ ‫مقاله‬ ‫در‬ ‫مفصل‬ ‫صورت‬ ‫به‬ ‫لینوکسی‬ ‫های‬ ‫سیستم‬ ‫فایل‬ ‫معایب‬ ‫و‬ ‫مزایا‬ : ‫لینوکس‬ ‫سیستم‬ ‫فایل‬ Boot Loading, Disk Partitioning, BIOS, UEFI ‫و‬ File System Types )‫زودی‬ ‫(به‬ ‫تعریف‬ max_allowed_packet ‫در‬ MySQL ( ‫ردیف‬ ‫یک‬ ‫حقیقت‬ ‫در‬ ‫مجزا‬ ‫پکت‬ ‫یک‬ ‫معموال‬ .‫میکند‬ ‫تقسیم‬ ‫ها‬ ‫پکت‬ ‫به‬ ‫را‬ ‫دیتا‬ ‫اسکیول‬ ‫مای‬ row ‫به‬ ‫که‬ ‫است‬ ) ‫بخش‬ .‫میشود‬ ‫ارسال‬ ‫کالینت‬ ‫یک‬ ‫سمت‬ max_allowed_packet ‫را‬ ‫شود‬ ‫ارسال‬ ‫میتواند‬ ‫که‬ ‫پکتی‬ ‫سایز‬ ‫حداکثر‬ .‫میکند‬ ‫تعریف‬ ‫و‬ ‫مشخص‬ ‫یک‬ ‫که‬ ‫شود‬ ‫باعث‬ ‫میتواند‬ ‫مقدار‬ ‫این‬ ‫کم‬ ‫خیلی‬ ‫تعریف‬ query ‫یک‬ ‫شما‬ ‫و‬ ‫شود‬ ‫متوقف‬ error ‫در‬ error log ‫مای‬ .‫کنید‬ ‫تعریف‬ ‫خود‬ ‫پکت‬ ‫بزرگترین‬ ‫سایز‬ ‫به‬ ‫را‬ ‫مقدار‬ ‫این‬ ‫که‬ ‫میشود‬ ‫توصیه‬ .‫کنید‬ ‫دریافت‬ ‫اسکیول‬ ‫تنظیمات‬ ‫کردن‬ ‫بررسی‬ Performance ‫در‬ MySQL ‫گیری‬ ‫اندازه‬ performance ‫در‬ MySQL/MariaDB ‫بررسی‬ ‫مرتبا‬ ‫که‬ ‫اصلی‬ ‫کارهای‬ ‫در‬ ‫باید‬ ‫شما‬ ‫که‬ ‫است‬ ‫موردی‬ ‫بهبود‬ ‫به‬ ‫نیاز‬ ‫یا‬ ‫کرد‬ ‫تغییر‬ ‫منابع‬ ‫مصرف‬ ‫میزان‬ ‫در‬ ‫چیزی‬ ‫اگر‬ ‫که‬ ‫میکند‬ ‫کمک‬ ‫شما‬ ‫به‬ ‫مورد‬ ‫این‬ .‫دهید‬ ‫قرار‬ ‫میکنید‬ .‫کنید‬ ‫بررسی‬ ‫آنرا‬ ‫داشت‬ ‫را‬ ‫آنها‬ ‫ترین‬ ‫ساده‬ ‫و‬ ‫آسانترین‬ ‫از‬ ‫یکی‬ ‫شما‬ ‫به‬ ‫داریم‬ ‫قصد‬ ‫ما‬ ‫اما‬ ،‫دارند‬ ‫وجود‬ ‫سنجی‬ ‫معیار‬ ‫برای‬ ‫ابزارها‬ ‫از‬ ‫تنوعی‬ ‫ابزار‬ ‫این‬ .‫بدهیم‬ ‫پیشنهاد‬ ‫شما‬ ‫به‬ mysqltuner .‫میشود‬ ‫نامیده‬ .‫کنید‬ ‫استفاده‬ ‫را‬ ‫زیر‬ ‫دستورهای‬ ‫آن‬ ‫اجرای‬ ‫و‬ ‫دانلود‬ ‫برای‬
  • 224. # wget https://github.com/major/MySQLTuner-perl/tarball/master # tar xf master # cd major-MySQLTuner-perl-993bc18/ # ./mysqltuner.pl ‫مصرف‬ ‫میزان‬ ‫درباره‬ ‫جزئیات‬ ‫با‬ ‫گزارش‬ ‫یک‬ ‫شما‬ mysql ‫خواهید‬ ‫دریافت‬ ‫آن‬ ‫برای‬ ‫ترفندهایی‬ ‫همچنین‬ ‫و‬ ‫خود‬ ‫فرض‬ ‫پیش‬ ‫و‬ ‫شده‬ ‫نصب‬ ‫سرویس‬ ‫یک‬ ‫از‬ ‫خروجی‬ ‫نمونه‬ ‫یک‬ ‫اینجا‬ ‫در‬ .‫کرد‬ mariadb .‫میکنید‬ ‫مشاهده‬ ‫را‬
  • 225. ‫جداول‬ ‫تعمیر‬ ‫و‬ ‫سازی‬ ‫بهینه‬ MySQL ‫های‬ ‫جدول‬ ‫اوقات‬ ‫گاهی‬ MySQL/MariaDB ‫سادگی‬ ‫به‬ ‫کامال‬ crashe ‫طور‬ ‫به‬ ‫سرور‬ ‫زمانیکه‬ ‫مخصوصا‬ ،‫میکند‬ ‫عملیات‬ ‫طول‬ ‫در‬ ‫حتی‬ ‫یا‬ ‫و‬ ‫کند‬ ‫هنگ‬ ‫ناگهان‬ ‫سیستم‬ ‫فایل‬ ‫یا‬ ‫و‬ ‫شود‬ ‫خاموش‬ ‫ای‬ ‫منتظره‬ ‫غیر‬ copy ‫که‬ ‫هنگامی‬ ، ‫ها‬ ‫جدول‬ ‫است‬ ‫ممکن‬ ‫است‬ ‫دسترس‬ ‫در‬ ‫هنوز‬ ‫دیتابیس‬ crash ‫ابزار‬ ‫یک‬ ‫خوشبختانه‬ .‫کند‬ open source ‫رایگان‬ " ‫نام‬ ‫به‬ mysqlcheck ‫و‬ ‫تعمیر‬ ،‫بررسی‬ ‫را‬ ‫لینوکس‬ ‫در‬ ‫جداول‬ ‫همه‬ ‫دیتابیس‬ ‫اتوماتیک‬ ‫صورت‬ ‫به‬ ‫که‬ ‫دارد‬ ‫وجود‬ " .‫میکند‬ ‫سازی‬ ‫بهینه‬
  • 226. # mysqlcheck -u root -p --check --all-databases # mysqlcheck -u root -p --auto-repair --optimize --all-databases # mysqlcheck -u root -p --check databasename # mysqlcheck -u root -p --auto-repair --check --optimize databasename
  • 227. ‫داده‬ ‫پایگاه‬ ‫از‬ ‫تر‬ ‫راحت‬ ‫استفاده‬ ‫زمینه‬ ‫در‬ ‫نکاتی‬ MySQL ‫نتایج‬ ‫عمودی‬ ‫نمایش‬ ‫یک‬ ‫نتایج‬ ‫عمومی‬ ‫مشاهده‬ ‫برای‬ query ‫از‬ ; ‫جای‬ ‫به‬ G :‫مانند‬ .‫کنید‬ ‫استفاده‬ ‫آن‬ ‫انتهای‬ ‫در‬ mysql> select * from PARTITIONS limit 2 G *************************** 1. row *************************** TABLE_CATALOG: NULL TABLE_SCHEMA: information_schema TABLE_NAME: CHARACTER_SETS PARTITION_NAME: NULL SUBPARTITION_NAME: NULL PARTITION_ORDINAL_POSITION: NULL SUBPARTITION_ORDINAL_POSITION: NULL PARTITION_METHOD: NULL SUBPARTITION_METHOD: NULL PARTITION_EXPRESSION: NULL SUBPARTITION_EXPRESSION: NULL PARTITION_DESCRIPTION: NULL TABLE_ROWS: 0 AVG_ROW_LENGTH: 384 DATA_LENGTH: 0 MAX_DATA_LENGTH: 16604160 INDEX_LENGTH: 0
  • 228. DATA_FREE: 0 CREATE_TIME: NULL UPDATE_TIME: NULL CHECK_TIME: NULL CHECKSUM: NULL PARTITION_COMMENT: NODEGROUP: TABLESPACE_NAME: NULL *************************** 2. row *************************** TABLE_CATALOG: NULL TABLE_SCHEMA: information_schema TABLE_NAME: COLLATIONS PARTITION_NAME: NULL SUBPARTITION_NAME: NULL PARTITION_ORDINAL_POSITION: NULL SUBPARTITION_ORDINAL_POSITION: NULL PARTITION_METHOD: NULL SUBPARTITION_METHOD: NULL PARTITION_EXPRESSION: NULL SUBPARTITION_EXPRESSION: NULL PARTITION_DESCRIPTION: NULL TABLE_ROWS: 0 AVG_ROW_LENGTH: 231 DATA_LENGTH: 0 MAX_DATA_LENGTH: 16704765 INDEX_LENGTH: 0 DATA_FREE: 0 CREATE_TIME: NULL UPDATE_TIME: NULL
  • 229. CHECK_TIME: NULL CHECKSUM: NULL PARTITION_COMMENT : NODEGROUP : TABLESPACE_NAME: NULL ‫از‬ ‫استفاده‬ -- safe-updates ‫پارامتر‬ ‫از‬ ‫استفاده‬ ‫با‬ -- safe-updates ‫معادل‬:( -- i-am-a-dummy ‫یا‬ - U ‫امنیتی‬ ‫حصار‬ ‫یک‬ ‫توانید‬ ‫می‬ ) ‫برای‬ query ‫به‬ ‫مربوط‬ ‫های‬ update ‫و‬ delete ‫اگر‬ ‫که‬ ‫صورت‬ ‫بدین‬ .‫کنید‬ ‫فعال‬ query ‫شما‬ ‫ویرایش‬ ‫یا‬ ‫حذف‬ where :‫مانند‬ .‫شود‬ ‫نمی‬ ‫اجرا‬ ،‫باشد‬ ‫نداشته‬ mysql> delete from meta; ERROR 1175 (HY000): You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column ‫یا‬ mysql> update meta set meta_key = 'my_key';
  • 230. ERROR 1175 (HY000): You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column ‫پارامتر‬ ‫از‬ ‫استفاده‬ ‫جای‬ ‫به‬ ‫توانید‬ ‫می‬ ‫شما‬ ‫همچنین‬ -- safe-updates ‫دستور‬ ‫از‬ SET ‫در‬ MySQL ‫استفاده‬ :‫مانند‬ .‫نمایید‬ mysql> SET sql_safe_updates=1, sql_select_limit=1000, sql_max_join_size=1000000; ‫کردن‬ ‫فعال‬ ‫بر‬ ‫عالوه‬ ‫باال‬ ‫دستور‬ safe updates ‫محدودیت‬ ‫برای‬ ‫نیز‬ ‫حداکثرهایی‬ ، select ‫انتخاب‬ ‫و‬ ‫ساده‬ .‫کند‬ ‫می‬ ‫اعمال‬ ‫جدولی‬ ‫چندین‬ ‫سازی‬ ‫فعال‬ auto complete ‫بروزرسانی‬ ‫و‬ cache ‫آن‬ ‫نصب‬ ‫از‬ ‫بعد‬ MySQL ‫قابلیت‬ ‫موارد‬ ‫از‬ ‫بسیاری‬ ‫در‬ auto complete .‫است‬ ‫فعال‬ »‫خودکار‬ ‫کردن‬ ‫«کامل‬ ‫همان‬ ‫یا‬ ‫آن‬ ‫سازی‬ ‫فعال‬ ‫به‬ ‫مربوط‬ ‫پارامتر‬ -- auto-rehash ‫فرمان‬ ‫خط‬ ‫در‬ ‫توانید‬ ‫می‬ ‫شما‬ ‫همچنین‬ .‫باشد‬ ‫می‬ MySQL ‫تایپ‬ ‫با‬ # ‫دیگر‬ ‫کاربرد‬ .‫کنید‬ ‫فعال‬ ‫را‬ ‫قابلیت‬ ‫این‬ # ‫کش‬ ‫بروزرسانی‬ auto completion ‫انجام‬ ‫از‬ ‫بعد‬ .‫باشد‬ ‫می‬ ‫داده‬ ‫پایگاه‬ ‫روی‬ ‫بر‬ ‫تغییرات‬ ‫دکمه‬ ‫کافیست‬ ‫خط‬ ‫یک‬ ‫کردن‬ ‫کامل‬ ‫*برای‬ Tab ‫عبارت‬ ‫یک‬ ‫کردن‬ ‫کامل‬ ‫برای‬ ‫نتایج‬ ‫که‬ ‫صورتی‬ ‫در‬ .‫دهید‬ ‫فشار‬ ‫را‬ ‫دو‬ ‫زدن‬ ‫با‬ ،‫باشد‬ ‫مورد‬ ‫یک‬ ‫از‬ ‫بیش‬ tab .‫فرمایید‬ ‫می‬ ‫مشاهده‬ ‫را‬ ‫نتایج‬ ‫این‬ ‫فهرست‬ ،‫هم‬ ‫سر‬ ‫پشت‬ ‫اجرا‬ ‫حال‬ ‫در‬ ‫فرایندهای‬ ‫کامل‬ ‫فهرست‬ ‫مشاهده‬ ‫دستور‬ ‫کافیست‬ ‫اجرا‬ ‫حال‬ ‫در‬ ‫فرایندهای‬ ‫مشاهده‬ ‫برای‬ show processlist .‫کنید‬ ‫وارد‬ ‫فرمان‬ ‫خط‬ ‫در‬ ‫را‬
  • 231. ‫کامل‬ ‫نمایش‬ ‫برای‬ ‫همچنین‬ query ‫پارامتر‬ ‫توانید‬ ‫می‬ ‫اجرا‬ ‫حال‬ ‫در‬ full :‫مانند‬ .‫کنید‬ ‫اضافه‬ ‫دستور‬ ‫این‬ ‫به‬ ‫را‬ mysql> show full processlist; +------+------+-----------+---------+---------+------+-------+-----------------------+ | Id | User | Host | db | Command | Time | State | Info | +------+------+-----------+---------+---------+------+-------+-----------------------+ | 3101 | root | localhost | efs_tmp | Query | 0 | NULL | show full processlist | +------+------+-----------+---------+---------+------+-------+-----------------------+ ( ‫کشتن‬ kill ‫فرایند‬ ‫یک‬ ) ‫دستور‬ ‫خروجی‬ ‫اول‬ ‫ستون‬ ‫در‬ show processlist ‫برای‬ .‫کردید‬ ‫مشاهده‬ ‫را‬ ‫اجرا‬ ‫حال‬ ‫در‬ ‫فرآیند‬ ‫به‬ ‫مربوط‬ ‫دی‬ ‫آی‬ ‫دستور‬ ‫کافیست‬ ‫فرایند‬ ‫این‬ ‫ساختن‬ ‫متوقف‬ kill :‫کنیم‬ ‫اجرا‬ ‫زیر‬ ‫صورت‬ ‫به‬ ‫را‬ mysql> kill 3101; ‫وضعیت‬ ‫مشاهده‬ MySQL ‫بیشتر‬ ‫اطالعات‬ ‫برخی‬ ‫و‬ ‫کلی‬ ‫وضعیت‬ ‫مشاهده‬ ‫برای‬ MySQL ‫دستور‬ ‫از‬ ‫شده‬ ‫فعال‬ ‫های‬ ‫پارامتر‬ ‫و‬ ‫تنظیمات‬ ‫شامل‬ show status
  • 232. :‫مانند‬ .‫کنیم‬ ‫می‬ ‫استفاده‬ [sql] mysql> show status; +-----------------------------------+-----------+ | Variable_name | Value | +-----------------------------------+-----------+ | Aborted_clients | 3 | | Aborted_connects | 0 | | Binlog_cache_disk_use | 0 | | Binlog_cache_use | 0 | | Bytes_received | 1346 | .......… ........ ...... ... . [/sql] ‫وضعیت‬ ‫مشاهده‬ ‫برای‬ ‫همچنین‬ INNODB ‫دستور‬ ‫از‬ SHOW ENGINE INNODB STATUS ‫نمایید‬ ‫استفاده‬. ‫دستور‬ show table status ‫مانند‬ .‫شود‬ ‫می‬ ‫استفاده‬ ‫جداول‬ ‫وضعیت‬ ‫مشاهده‬ ‫برای‬ ‫نیز‬:
  • 233. mysql> show table status like '%user%' G *************************** 1. row *************************** Name: user Engine: MyISAM Version: 10 Row_format: Dynamic Rows: 14 Avg_row_length: 80 Data_length: 1128 Max_data_length: 281474976710655 Index_length: 2048 Data_free: 0 Auto_increment: NULL Create_time: 2010-11-21 18:07:11 Update_time: 2011-02-27 14:57:28 Check_time: NULL Collation: utf8_bin Checksum: NULL Create_options: Comment: Users and global privileges 1 row in set (0.00 sec) [/sql] ‫از‬ * like . ‫کرد‬ ‫استفاده‬ ‫میتوان‬ ‫نتایج‬ ‫ساختن‬ ‫محدود‬ ‫برای‬ ‫داده‬ ‫پایگاه‬ ‫وضعیت‬ ‫به‬ ‫سریع‬ ‫دسترسی‬ ‫دستور‬ ‫کافیست‬ ‫داده‬ ‫پایگاه‬ ‫به‬ ‫سریع‬ ‫دسترسی‬ ‫برای‬ s ‫فرمان‬ ‫خط‬ ‫در‬ ‫را‬ MySQL :‫نمایید‬ ‫وارد‬
  • 234. [sql] mysql> s -------------- mysql Ver 14.14 Distrib 5.1.49, for debian-linux-gnu (i686) using readline 6.1 Connection id: 3103 Current database: mydb_tmp Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 5.1.49-1ubuntu8.1 (Ubuntu) Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8 Db characterset: utf8 Client characterset: latin1 Conn. characterset: latin1 UNIX socket: /var/run/mysqld/mysqld.sock Uptime: 12 hours 39 min 28 sec Threads: 1 Questions: 27846 Slow queries: 2 Opens: 7711 Flush tables: 1 Open tables: 64 Queries per second avg: 0.611 -------------- [/sql]
  • 235. ‫دستور‬ show create ‫دستور‬ ‫کلی‬ ‫طور‬ ‫به‬ show create ‫می‬ ‫استفاده‬ ...‫و‬ ‫تابع‬ ،‫داده‬ ‫پایگاه‬ ،‫جدول‬ ‫یک‬ ‫ساخت‬ ‫نحوه‬ ‫مشاهده‬ ‫برای‬ :‫مانند‬ .‫شود‬ [sql] mysql> show create database mysql G *************************** 1. row *************************** Database: mysql Create Database: CREATE DATABASE `mysql` /*!40100 DEFAULT CHARACTER SET utf8 */ [/sql] ‫یا‬ [sql] mysql> show create table time_zone G *************************** 1. row *************************** Table: time_zone Create Table: CREATE TABLE `time_zone` ( `Time_zone_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `Use_leap_seconds` enum('Y','N') NOT NULL DEFAULT 'N', PRIMARY KEY (`Time_zone_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Time zones' [/sql]
  • 236. ‫جدول‬ ‫چند‬ ‫ترکیب‬ ‫از‬ ‫جدول‬ ‫یک‬ ‫ساخت‬ ‫انواع‬ ‫از‬ ‫یکی‬ engine ‫در‬ ‫موجود‬ ‫های‬ MySQL ‫انجین‬ MERGE ‫یا‬ MRG_MyISAM ‫این‬ .‫باشد‬ ‫می‬ engine ‫برای‬ .‫گیرد‬ ‫می‬ ‫قرار‬ ‫استفاده‬ ‫مورد‬ ‫جدول‬ ‫یک‬ ‫در‬ ‫جدول‬ ‫چندین‬ ‫ترکیب‬ ‫انجین‬ ‫با‬ ‫جدول‬ ‫دو‬ ‫ما‬ ‫زیر‬ ‫در‬ MyISAM ‫جدول‬ ‫یک‬ ‫و‬ total ‫انجین‬ ‫با‬ MERGE ‫ساخته‬ ‫اول‬ ‫جدول‬ ‫دو‬ ‫ترکیب‬ ‫از‬ :‫ایم‬ [sql] mysql> CREATE TABLE t1 ( -> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, -> message CHAR(20)) ENGINE=MyISAM; mysql> CREATE TABLE t2 ( -> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, -> message CHAR(20)) ENGINE=MyISAM; mysql> CREATE TABLE total ( -> a INT NOT NULL AUTO_INCREMENT, -> message CHAR(20), INDEX(a)) -> ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST; [/sql] ‫به‬ ‫اطالعات‬ ‫کردن‬ ‫وارد‬ ‫صورت‬ ‫در‬ t1 ‫و‬ t ‫طریق‬ ‫از‬ ‫اطالعات‬ ‫به‬ ‫دستیابی‬ ‫امکان‬ ،‫ها‬ ‫آن‬ ‫اطالعات‬ ‫بروزرسانی‬ ‫ویا‬ ‫جدول‬ total :‫مانند‬ .‫دارد‬ ‫وجود‬ [sql] mysql> INSERT INTO t1 (message) VALUES ('Testing'),('table'),('t1');
  • 237. mysql> INSERT INTO t2 (message) VALUES ('Testing'),('table'),('t2'); mysql> SELECT * FROM total; +---+---------+ | a | message | +---+---------+ | 1 | Testing | | 2 | table | | 3 | t1 | | 1 | Testing | | 2 | table | | 3 | t2 | +---+---------+ [/sql] ‫دستور‬ mysqlshow ‫اطالعات‬ ‫فهرست‬ ‫به‬ ‫سریع‬ ‫دسترسی‬ ‫برای‬ ‫دستور‬ ‫از‬ ‫آنها‬ ‫های‬ ‫ستون‬ ‫و‬ ‫جداول‬ ،‫داده‬ ‫های‬ ‫پایگاه‬ ‫فهرست‬ ‫به‬ ‫سریع‬ ‫دسترسی‬ ‫برای‬ ‫توانید‬ ‫می‬ ‫شما‬ mysqlshow :‫مانند‬ .‫نمایید‬ ‫استفاده‬ [sql]$ mysqlshow -uroot +--------------------+ | Databases | +--------------------+ | information_schema | | mydb_tmp |
  • 238. | mydb | | mysql | | radius | | security | +--------------------+ [/sql] ‫یا‬ [sql]$ mysqlshow -uroot mysql Database: mysql +---------------------------+ | Tables | +---------------------------+ | columns_priv | | db | | event | | func | | general_log | | help_category | | help_keyword | | help_relation | | help_topic | | host | | ndb_binlog_index | | plugin | | proc | | procs_priv | | servers | | slow_log | | tables_priv |
  • 239. | time_zone | | time_zone_leap_second | | time_zone_name | | time_zone_transition | | time_zone_transition_type | | user | +---------------------------+ [/sql] ‫یا‬ [sql]$ mysqlshow -uroot mysql servers Database: mysql Table: servers +-------------+----------+-----------------+------+-----+---------+------- +---------------------------------+---------+ | Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment | +-------------+----------+-----------------+------+-----+---------+------- +---------------------------------+---------+ | Server_name | char(64) | utf8_general_ci | NO | PRI | | | select,insert,update,references | | | Host | char(64) | utf8_general_ci | NO | | | | select,insert,update,references | | | Db | char(64) | utf8_general_ci | NO | | | | select,insert,update,references | | | Username | char(64) | utf8_general_ci | NO | | | | select,insert,update,references | | | Password | char(64) | utf8_general_ci | NO | | | | select,insert,update,references | | | Port | int(4) | | NO | | 0 | | select,insert,update,references | | | Socket | char(64) | utf8_general_ci | NO | | | | select,insert,update,references | | | Wrapper | char(64) | utf8_general_ci | NO | | | | select,insert,update,references | | | Owner | char(64) | utf8_general_ci | NO | | | | select,insert,update,references | | +-------------+----------+-----------------+------+-----+---------+------- +---------------------------------+---------+ [/sql]
  • 240. ‫ارجحیت‬ ‫با‬ ‫همراه‬ ‫سازی‬ ‫مرتب‬ ‫یک‬ ‫سازی‬ ‫مرتب‬ ‫بر‬ ‫عالوه‬ ‫دارید‬ ‫قصد‬ ‫که‬ ‫صورتی‬ ‫در‬ query ‫آن‬ ‫های‬ ‫ریف‬ ‫از‬ ‫بعضی‬ ‫به‬ ‫نیز‬ ‫ارجحیتی‬ ،‫انتخاب‬ ‫ترکیب‬ ‫از‬ ‫کافیست‬ ،‫بدهید‬ IN )( ‫و‬ order by ‫ستون‬ ‫اساس‬ ‫بر‬ ‫سازی‬ ‫مرتب‬ ‫بر‬ ‫عالوه‬ ‫زیر‬ ‫مثال‬ ‫در‬ .‫کنید‬ ‫استفاده‬ iso_code ‫های‬ ‫ردیف‬ ‫به‬ IR ‫و‬ US :‫ایم‬ ‫داده‬ ‫باالتری‬ ‫وزن‬ ‫و‬ ‫ارجحیت‬ [sql] mysql>SELECT * FROM countries ORDER by iso_code IN ('IR', 'US') desc; +----------+----------------------------------------+ | iso_code | name | +----------+----------------------------------------+ | IR | IRAN | | US | United States | | AF | Afghanistan | | AL | Albania | | DZ | Algeria | | AS | American Samoa | +----------+----------------------------------------+ [/sql] ‫داده‬ ‫پایگاه‬ ‫به‬ ‫فایل‬ ‫از‬ ‫اطالعات‬ ‫کردن‬ ‫وارد‬ MySQL ‫داده‬ ‫پایگاه‬ ‫به‬ ‫فایل‬ ‫یک‬ ‫از‬ ‫اطالعات‬ ‫کردن‬ ‫وارد‬ ‫برای‬ MySQL ` ‫دستور‬ ‫از‬ LOAD DATA INFILE ‫می‬ ‫استفاده‬ ` :‫است‬ ‫زیر‬ ‫صورت‬ ‫به‬ ‫دستور‬ ‫این‬ ‫کلی‬ ‫شکل‬ .‫کنیم‬
  • 241. mysql> LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name' [REPLACE | IGNORE] INTO TABLE tbl_name [CHARACTER SET charset_name] [{FIELDS | COLUMNS} [TERMINATED BY 'string'] [[OPTIONALLY] ENCLOSED BY 'char'] [ESCAPED BY 'char'] ] [LINES [STARTING BY 'string'] [TERMINATED BY 'string'] ] [IGNORE number LINES] [(col_name_or_user_var,...)] [SET col_name = expr,...] :‫باشد‬ ‫می‬ ‫زیر‬ ‫شکل‬ ‫به‬ ‫دستور‬ ‫این‬ ‫از‬ ‫استفاده‬ ‫شکل‬ ‫ترین‬ ‫ساده‬ mysql> LOAD DATA INFILE 'data.txt' INTO TABLE my_db.my_table; ( ‫ها‬ ‫فیلد‬ ‫جداکننده‬ ‫که‬ ‫صورتی‬ ‫در‬ FIELDS TERMINATED ،‫نکنید‬ ‫مشخص‬ ‫را‬ ) MySQL ‫فرض‬ ‫پیش‬ ‫مقدار‬ t ( ‫تب‬ ‫همان‬ ‫که‬ Tab ‫خطوط‬ ‫جداکننده‬ ‫فرض‬ ‫پیش‬ ‫مقدار‬ ‫همچنین‬ .‫گیرد‬ ‫می‬ ‫نظر‬ ‫در‬ ‫را‬ ‫هست‬ ) n ‫خط‬ ‫همان‬ ‫که‬ ( ‫جدید‬ New Line .‫گیرد‬ ‫می‬ ‫نظر‬ ‫در‬ ‫را‬ ‫باشد‬ ‫می‬ ) ‫نکته‬ ‫کاراکترهای‬ ‫دارای‬ ‫شما‬ ‫فایل‬ ‫که‬ ‫صورتی‬ ‫در‬ UTF8 ‫جدول‬ ‫تعریف‬ ‫بر‬ ‫عالوه‬ ،‫باشد‬ ‫می‬ my_table ‫با‬ encoding ‫به‬ ‫مربوط‬ UTF8 ‫نوع‬ ‫باید‬ ، encoding ‫دستور‬ ‫در‬ ‫نیز‬ ‫را‬ LOAD DATE :‫صورت‬ ‫به‬ .‫بنویسید‬ LOAD DATA INFILE 'data.txt' INTO TABLE my_db.my_table character set UTF8; ‫فایل‬ ‫یک‬ ‫اطالعات‬ ‫واردکردن‬ ‫مورد‬ ‫در‬ ‫عملی‬ ‫مثال‬ ‫یک‬ ‫بررسی‬ ‫به‬ ‫ادامه‬ ‫در‬ CSV .‫پردازیم‬ ‫می‬ ‫عملی‬ ‫مثال‬ ‫یک‬ ‫بررسی‬ ‫نام‬ ‫به‬ ‫فایلی‬ ‫کنید‬ ‫فرض‬ ip-list.csv :‫دارید‬ ‫زیر‬ ‫محتوای‬ ‫با‬
  • 242. "1.0.0.0","1.0.0.255","16777216","16777471","AU","Australia" "1.0.1.0","1.0.3.255","16777472","16778239","CN","China" "1.0.4.0","1.0.7.255","16778240","16779263","AU","Australia" "1.0.8.0","1.0.15.255","16779264","16781311","CN","China" "1.0.16.0","1.0.31.255","16781312","16785407","JP","Japan" "1.0.32.0","1.0.63.255","16785408","16793599","CN","China" "1.0.64.0","1.0.127.255","16793600","16809983","JP","Japan" "1.0.128.0","1.0.255.255","16809984","16842751","TH","Thailand" "1.1.0.0","1.1.0.255","16842752","16843007","CN","China" "1.1.1.0","1.1.1.255","16843008","16843263","AU","Australia" "1.1.2.0","1.1.63.255","16843264","16859135","CN","China" "1.1.64.0","1.1.127.255","16859136","16875519","JP","Japan" ‫داده‬ ‫پایگاه‬ ‫به‬ ‫اطالعات‬ ‫این‬ ‫کردن‬ ‫وارد‬ ‫برای‬ .‫دهد‬ ‫می‬ ‫نمایش‬ ‫را‬ ‫‌ها‬ ‫ن‬‫آ‬ ‫با‬ ‫متناظر‬ ‫کشور‬ ‫و‬ ‫‌پی‬ ‫ی‬‫آ‬ ‫تعدادی‬ ‫فایل‬ ‫این‬ MySQL ‫به‬ ‫توانید‬ ‫می‬ ‫داده‬ ‫مناسب‬ ‫نوع‬ ‫انتخاب‬ ‫با‬ ‫آشنایی‬ ‫برای‬ .‫بسازیم‬ ‫‌ها‬ ‫ه‬‫داد‬ ‫این‬ ‫با‬ ‫مناسب‬ ‫جدولی‬ ‫باید‬ ‫ابتدا‬ ‫در‬ ‫داده‬ ‫انواع‬ ‫مطلب‬ MySQL ‫نام‬ ‫به‬ ‫جدول‬ ‫یک‬ ‫زیر‬ ‫دستور‬ .‫نمایید‬ ‫مراجعه‬ geoip :‫کند‬ ‫می‬ ‫ایجاد‬ mysql> CREATE TABLE `geoip` ( `begin_ip` varchar(15) NOT NULL, `end_ip` varchar(15) NOT NULL, `begin_num` int(11) unsigned NOT NULL, `end_num` int(11) unsigned NOT NULL, `country` char(2) NOT NULL, `name` varchar(50) NOT NULL ) ENGINE=MyISAM; ‫فایل‬ ‫از‬ ‫را‬ ‫اطالعات‬ ‫این‬ ‫زیر‬ ‫دستور‬ ip-list.csv ‫جدول‬ ‫به‬ geoip ‫صحیح‬ ‫آدرس‬ ‫باید‬ ‫نیاز‬ ‫صورت‬ ‫در‬ .‫‌کند‬ ‫ی‬‫م‬ ‫وارد‬ .‫کنید‬ ‫درج‬ ‫آن‬ ‫نام‬ ‫کنار‬ ‫در‬ ‫نیز‬ ‫را‬ ‫فایل‬ mysql> LOAD DATA INFILE 'ip-list.csv' INTO TABLE geoip FIELDS TERMINATED BY "," ENCLOSED BY '"';
  • 243. Query OK, 12 rows affected (0.23 sec) Records: 12 Deleted: 0 Skipped: 0 Warnings: 0 .‫دارد‬ ‫قرار‬ " ‫دو‬ ‫داخل‬ ‫در‬ ‫نیز‬ ‫ستون‬ ‫هر‬ ‫محتوای‬ ‫و‬ ‫شده‬ ‫جدا‬ "," ‫با‬ ‫‌ها‬ ‫ن‬‫ستو‬ ‫که‬ ‫ایم‬ ‫کرده‬ ‫مشخص‬ ‫باال‬ ‫دستور‬ ‫در‬
  • 244. ‫دیتابیس‬ ‫در‬ ‫شده‬ ‫ثبت‬ ‫دی‬ ‫آی‬ ‫آخرین‬ ‫آوردن‬ ‫بدست‬ ‫روش‬ .‫آورید‬ ‫بدست‬ ‫را‬ ‫دیتابیس‬ ‫در‬ ‫شده‬ ‫ثبت‬ ‫رکورد‬ ‫آخرین‬ ‫دی‬ ‫آی‬ ‫تا‬ ‫دارید‬ ‫نیاز‬ ‫زمانی‬ :‫کار‬ ‫این‬ ‫برای‬ mysql> SELECT LAST_INSERT_ID();
  • 247. Following are some major key features of “phpMyBackupPro“. 1. Single or Multiple database backup support with or without data, table structure. 2. Three level of compression supported are no compression, gzip or zip compression. 3. Create scheduled backups without cron jobs using small PHP script. 4. Upload backups directly onto FTP server and posting of backups by email. 5. Only Apache and PHP needed to run on platforms like Linux, Mac or Windows. 6. Shell interface to take backups manually or by using cron script. 7. Whole File directory backup and move them to any FTP server. 8. Take databases backup from different accounts on several MySQL servers. 9. Two security authentication methods supported HTTP or HTML login authentication. 10.Friendly interface and very easy to install and setup. 11.Multiple language supported.
  • 251. mytop mtop -u root –prompt
  • 254. ‫فصل‬ ‫اتصال‬ ‫برای‬ ‫ثانویه‬ ‫های‬ ‫برنامه‬ ‫به‬
  • 255. sqldeveloper sqldeveloper ‫داده‬ ‫پایگاه‬ ‫به‬ ‫اتصال‬ ‫برای‬ ‫برنامه‬ ‫یک‬ oracle ‫کردن‬ ‫اضافه‬ ‫با‬ . ‫باشد‬ ‫می‬ jdbc ‫به‬ ‫مربوط‬ mysql . ‫کرد‬ ‫استفاده‬ ‫برنامه‬ ‫این‬ ‫قابلیت‬ ‫از‬ ‫میتوان‬
  • 257. : ‫نکته‬ sqldeveloper ‫هست‬ ‫اوراکل‬ ‫داده‬ ‫پایگاه‬ ‫با‬ ‫ارتباط‬ ‫و‬ ‫مدیریت‬ ‫برای‬ ‫ابزار‬ ‫یه‬ . ‫دستورات‬ ‫میشه‬ ‫که‬ sql ‫و‬ pl/sql ‫کرد‬ ‫استفاده‬ ‫رو‬ . ‫گنو‬ ‫تو‬ ‫ابزار‬ ‫این‬ ‫کردن‬ ‫اجرا‬ ‫با‬ ‫شاید‬ ‫دوستان‬ ‫از‬ ‫بعضی‬ / ‫اس‬ ‫بی‬ – ‫سوالریس‬ – ‫لینوکس‬ ‫میدم‬ ‫قرار‬ ‫اینجا‬ ‫رو‬ ‫راهکار‬ ‫من‬ ‫که‬ ‫باشن‬ ‫داشته‬ ‫مشکل‬ ‫مک‬ – ‫دی‬ . ‫برنامه‬ ‫این‬ ‫اجرای‬ ‫برای‬ . ‫این‬ ‫تنظیمات‬ ‫در‬ ‫میکنیم‬ ‫اضافه‬ ‫رو‬ ‫پارامتر‬ . SetSkipJ2SDKCheck true ‫فایل‬ ‫در‬ ‫باید‬ ‫پارامتر‬ ‫این‬ sqldeveloper.conf ‫بشه‬ ‫اضافه‬ . ‫فایل‬ ‫این‬ ‫مسیر‬ : ../sqldeveloper/bin/sqldeveloper.conf ‫هست‬ .
  • 262. ‫بوسیله‬ ‫اتصال‬ ‫به‬ ‫حال‬ ‫پرداختیم‬ ‫فرمان‬ ‫خط‬ ‫تحت‬ ‫داده‬ ‫پایگاه‬ ‫با‬ ‫ارتباط‬ ‫پیرامون‬ ‫قبلی‬ ‫مباحث‬ ‫در‬ . ‫پرداخت‬ ‫خواهیم‬ ‫گرافیکی‬ ‫های‬ ‫ابزار‬ ‫در‬ ‫فایل‬ ‫جستجوی‬ ‫به‬ ‫میتوان‬ ‫چطور‬ ‫حال‬ . ‫است‬ ‫آن‬ ‫از‬ ‫استفاده‬ ‫و‬ ‫برنامه‬ ‫نصب‬ ‫گام‬ ‫اولین‬ ‫؟‬ ‫پرداخت‬ ‫مخازن‬ ‫دستور‬ ‫بواسطه‬ apt-cache search ‫آن‬ ‫نصب‬ ‫و‬ ‫انتخاب‬ ‫و‬ ‫‌ها‬ ‫ه‬‫برنام‬ ‫میان‬ ‫جستجو‬ ‫به‬ . . ‫پرداخت‬ Sudo apt-cache search mysql |grep admin ‫دستور‬ ‫با‬ ‫گفتیم‬ ‫که‬ ‫همانطور‬ apt-cache search ‫و‬ ‫پرداخت‬ ‫‌ها‬ ‫ه‬‫برنام‬ ‫جستجوی‬ ‫به‬ ‫میتوان‬ ‫بادستور‬ grep . ‫نمود‬ ‫خروجی‬ ‫فیلتر‬ ‫به‬ ‫اقدام‬ ‫جدیدتر‬ ‫نسخه‬ : ‫نکته‬ mysql-workbench . ‫دارد‬ ‫نام‬ ‫بسته‬ ‫حال‬ mysql-admin : ‫میدهیم‬ ‫انجام‬ ‫را‬ ‫زیر‬ ‫مراحل‬ ‫اینکار‬ ‫برای‬ . ‫میکنیم‬ ‫نصب‬ ‫را‬ sudo apt-get install mysql-admin ‫پورت‬ ‫بجز‬ . ‫است‬ ‫بسته‬ ‫داده‬ ‫پایگاه‬ ‫با‬ ‫ارتباط‬ ‫برای‬ ‫ها‬ ‫پورت‬ ‫تمامی‬ 3306 ‫تونل‬ ‫بواسطه‬ ‫ما‬ ‫حال‬ . ‫میکنیم‬ ‫وصل‬ ‫پورت‬ ‫این‬ ‫به‬ ‫را‬ ‫دیگر‬ ‫پورت‬ ‫زنی‬
  • 263. : ‫اینکار‬ ‫برای‬ ssh -L 8888:localhost:3306 root@mysql-server ‫از‬ ‫که‬ ‫پورتی‬ ‫هر‬ ‫کار‬ ‫این‬ ‫با‬ 8888 ‫پورت‬ ‫به‬ ‫میکند‬ ‫استفاده‬ 3306 . ‫‌شود‬ ‫ی‬‫م‬ ‫وصل‬ ‫دستورات‬ ‫از‬ ‫میتوان‬ ‫باز‬ ‫های‬ ‫پورت‬ ‫دانستن‬ ‫برای‬ netstat , iptraf ‫در‬ ‫ما‬ . ‫نمود‬ ‫استفاده‬ … , ‫دستور‬ ‫از‬ ‫اینجا‬ netstat . ‫میکنیم‬ ‫استفاده‬ Netstat -tapn
  • 264. ‫نامه‬ ‫بر‬ ‫حال‬ mysql admin . ‫میکنیم‬ ‫اجرا‬ ‫را‬ ‫قسمت‬ ‫در‬ server name ‫و‬ ‫کرده‬ ‫وارد‬ ‫را‬ ‫پورت‬ ‫شماره‬ ‫پورت‬ ‫قسمت‬ ‫در‬ ‫و‬ ‫سرور‬ ‫نام‬ . ‫مینویسیم‬ ‫را‬ ‫عبور‬ ‫رمز‬ ‫و‬ ‫کاربری‬ ‫نام‬ ‫مواجه‬ ‫زیر‬ ‫خطا‬ ‫کادر‬ ‫با‬ ‫کنیم‬ ‫وارد‬ ‫اشتباه‬ ‫را‬ ‫سرور‬ ‫نام‬ ‫یا‬ ‫عبور‬ ‫رمز‬ ‫یا‬ ‫پورت‬ ‫شماره‬ ‫اگر‬ . ‫‌شویم‬ ‫ی‬‫م‬
  • 265. . ‫دهیم‬ ‫انجام‬ ‫نیز‬ ‫را‬ ‫پینگ‬ ‫عمل‬ ‫میتوانیم‬ ‫که‬ ‫مدیریت‬ ‫قسمت‬ ‫وارد‬ ‫خطا‬ ‫بدون‬ ‫باشیم‬ ‫کرده‬ ‫وارد‬ ‫درست‬ ‫را‬ ‫ها‬ ‫ایتم‬ ‫تمام‬ ‫اگر‬ . ‫‌شویم‬ ‫ی‬‫م‬
  • 266. . ‫میبینیم‬ ‫را‬ ‫شده‬ ‫وصل‬ ‫کالینت‬ ‫و‬ ‫سرور‬ ‫مشخصات‬ ‫ایجا‬ ‫در‬
  • 267. .‫پرداخت‬ ‫داده‬ ‫پایگاه‬ ‫سرویس‬ ‫کردن‬ ‫خاموش‬ ‫و‬ ‫روشن‬ ‫به‬ ‫میتوان‬ ‫قسمت‬ ‫این‬ ‫در‬
  • 268. .‫نمود‬ ‫ویرایش‬ ‫را‬ ‫کاربران‬ ‫یا‬ ‫کرد‬ ‫کاربر‬ ‫ساختن‬ ‫به‬ ‫اقدام‬ ‫میتوان‬ ‫اینجا‬ ‫در‬
  • 269. . ‫نمود‬ ‫مشاهده‬ ‫را‬ ‫اتصال‬ ) ‫های‬ ‫(ریسمان‬ ‫تردها‬ ‫میتوان‬ ‫اینجا‬ ‫در‬ . ‫پرداخت‬ ‫داده‬ ‫پایگاه‬ ‫مختلف‬ ‫‌های‬ ‫ت‬‫وضعی‬ ‫مشاهده‬ ‫و‬ ‫آنالیز‬ ‫به‬ ‫میتوان‬ ‫اینجا‬ ‫در‬
  • 274. . ‫نمود‬ ‫مشاهده‬ ‫را‬ ‫داده‬ ‫پایگاه‬ ‫به‬ ‫مربوط‬ ‫خطای‬ ‫‌های‬ ‫م‬‫پیا‬ ‫‌توان‬ ‫ی‬‫م‬ ‫قسمت‬ ‫این‬ ‫در‬
  • 275. . ‫پرداخت‬ ‫داده‬ ‫پایگاه‬ ‫از‬ ‫گیری‬ ‫اپ‬ ‫بک‬ ‫به‬ ‫اقدام‬ ‫میتوان‬ ‫اینجا‬ ‫در‬
  • 276. . ‫کرد‬ ‫ویرایش‬ ‫و‬ ‫نمود‬ ‫مشاهده‬ ‫را‬ ‫جداول‬ ‫به‬ ‫مربوط‬ ‫اطالعات‬ ‫میتوان‬ ‫اینجا‬ ‫در‬
  • 282. ‫ساختار‬ ‫و‬ ‫شما‬ ‫ایجاد‬ ‫نحوه‬ erp ‫از‬ dump ‫فایل‬
  • 288. mysql_error_1045 systemctl stop mysql mkdir -p /var/run/mysqld chown mysql:mysql /var/run/mysqld sudo mysqld --skip-grant-tables mysql -u root or mycli -u root use mysql ; SELECT * from `user` ; TRUNCATE table `user` ; SELECT * from `user` ; flush PRIVILEGES ; GRANT all PRIVILEGES on *.* to 'root'@'localhost' IDENTIFIED by 'pass' with grant OPTION ; pgrep mysqld kill -KILL mysqld# systemctl start mysql
  • 289. mysql_tzinfo_to_sql /usr/share/zoneinfo/ |mysql -u root -p mysql --------------------------------------------------------------------------------------- GRANT SELECT ON mysql. time_zone_name TO 'cacti'@'localhost' IDENTIFIED BY 'password'; flush privileges;
  • 292. ‫بنچمارک‬ ‫برای‬ ‫مختلفی‬ ‫ابزارهای‬ mysql . ‫اسکریپت‬ ‫نوشتن‬ ‫تا‬ ‫ای‬ ‫حرفه‬ ‫ابزارهای‬ ‫از‬ . ‫است‬ ‫موجود‬ : ‫پرداخت‬ ‫خواهیم‬ ‫نمونه‬ ‫چند‬ ‫بررسی‬ ‫به‬ ‫زیر‬ ‫در‬ #!/bin/sh INTERVAL=5 PREFIX=$INTERVAL-sec-status RUNFILE=/home/benchmarks/running mysql -e 'SHOW GLOBAL VARIABLES' >> mysql-variables while test -e $RUNFILE; do file=$(date +%F_%I) sleep=$(date +%s.%N | awk "{print $INTERVAL - ($1 % $INTERVAL)}") sleep $sleep ts="$(date +"TS %s.%N %F %T")" loadavg="$(uptime)" echo "$ts $loadavg" >> $PREFIX-${file}-status mysql -e 'SHOW GLOBAL STATUS' >> $PREFIX-${file}-status & echo "$ts $loadavg" >> $PREFIX-${file}-innodbstatus mysql -e 'SHOW ENGINE INNODB STATUSG' >> $PREFIX-${file}-innodbstatus & echo "$ts $loadavg" >> $PREFIX-${file}-processlist mysql -e 'SHOW FULL PROCESSLISTG' >> $PREFIX-${file}-processlist & echo $ts done echo Exiting because $RUNFILE does not exist. --------------------------------------------------------------------- #!/bin/sh # This script converts SHOW GLOBAL STATUS into a tabulated format, one line # per sample in the input, with the metrics divided by the time elapsed # between samples. awk ' BEGIN { printf "#ts date time load QPS"; fmt = " %.2f";
  • 293. } /^TS/ { # The timestamp lines begin with TS. ts = substr($2, 1, index($2, ".") - 1); load = NF - 2; diff = ts - prev_ts; prev_ts = ts; printf "n%s %s %s %s", ts, $3, $4, substr($load, 1, length($load)-1); } /Queries/ { printf fmt, ($2-Queries)/diff; Queries=$2 } ' "$@" -------------------------------------------------------- ./analyze 5-sec-status-2011-03-20 #ts date time load QPS 1300642150 2011-03-20 17:29:10 0.00 0.62 1300642155 2011-03-20 17:29:15 0.00 1311.60 1300642160 2011-03-20 17:29:20 0.00 1770.60 1300642165 2011-03-20 17:29:25 0.00 1756.60 1300642170 2011-03-20 17:29:30 0.00 1752.40 1300642175 2011-03-20 17:29:35 0.00 1735.00 1300642180 2011-03-20 17:29:40 0.00 1713.00 1300642185 2011-03-20 17:29:45 0.00 1788.00 1300642190 2011-03-20 17:29:50 0.00 1596.40 ------------------------------------------------------------- gnuplot> plot "QPS-per-5-seconds" using 5 w lines title "QPS"
  • 298. sysbench ‫قدرتمند‬ ‫و‬ ‫حریف‬ ‫فن‬ ‫همه‬ ‫ابزار‬ ‫یک‬ sysbench --test=fileio --file-total-size=150G prepare sysbench --test=fileio --file-total-size=150G --file-test-mode=rndrw/ --init-rng=on --max-time=300 --max-requests=0 run
  • 299. federated engine ‫حقیقت‬ ‫در‬ federate engine ‫از‬ ‫استفاده‬ ‫با‬ . ‫باشیم‬ ‫داشته‬ ‫سرور‬ ‫لینک‬ ‫یک‬ ‫میخواهیم‬ ‫ما‬ ‫که‬ ‫زمانی‬ federate engine ‫به‬ ‫اقدام‬ ‫توانیم‬ ‫می‬ . ‫کنیم‬ ‫کار‬ ‫این‬ ‫سرور‬ ‫چندین‬ ‫از‬ ‫منطقی‬ ‫‌داده‬ ‫ه‬‫پایگا‬ ‫یک‬ ‫ایجاد‬ ‫برای‬ ‫مجزا‬ ‫‌کیوال‬ ‫س‬‫‌ا‬ ‫ی‬‫ما‬ ‫سرور‬ ‫چندین‬ ‫زدن‬ ‫پیوند‬ ‫برای‬ ‫واقع‬ ‫در‬ . ‫کنیم‬ ‫استفاده‬ ‫میتوانیم‬ ‫فیزیکی‬ : ‫داریم‬ ‫قابلیت‬ ‫این‬ ‫کردم‬ ‫فعال‬ ‫برای‬ install plugin federated soname 'ha_federated.so' or [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0
  • 300. federated [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid For example: Server – A108 (Remote MySQL Server) Server – B108 (Local MySQL Server) We need to execute the SELECT command from Server B108 and fetching data from Server A108. Here, Server A108 is a remote server and Server B108 is a local server. Now create a sample table in Server A108. 1 2 3 4 5 6 CREATE TABLE tbl_RemoteTable ( ID integer ,Name VARCHAR(255) ) ENGINE=InnoDB; Now, create a FEDERATED table in Server B108 to SELECT data from Server A108. You have to specify FEDERATED engine with remote CONNECTION information. 1 2 3 4 5 6 7 CREATE TABLE tbl_RemoteTable ( ID integer ,Name VARCHAR(255) ) ENGINE=FEDERATED CONNECTION='mysql:// root:root@localhost:3306/B108/ tbl_RemoteTable'; As you can see, I created FEDERATED table into Local Server B108 using the connection information of Remote Server A108. You can access this table like any other table, and if any data insert or delete in remote Table, it automatically updates here because this is a virtual table.
  • 301. Below are different format of connection strings: 1 2 3 CONNECTION='mysql://username:password@hostname:port/database/tablename' CONNECTION='mysql://username@hostname/database/tablename' CONNECTION='mysql://username:password@hostname/database/tablename' The remote server must be a MySQL Server. • You can replicate the FEDERATED table to other slaves, but ensure that slave server is able to use defined connection string. • You can create nested FEDERATED tables. • The FEDERATED table does not support indexes because of its virtual nature. • The FEDERATED storage engine supports SELECT, INSERT, UPDATE, DELETE, TRUNCATE TABLE. • The FEDERATED also supports INSERT ON DUPLICATE KEY UPDATE statements. • The FEDERATED table does not support Transaction. • The FEDERATED table can also perform bulk-insertion. • Any DROP TABLE statement issued against a FEDERATED table drops only the local table, not the remote table. • The FEDERATED tables do not work with the query cache.
  • 302. In this post, I am showing to create the Connection Server and use that Server detail with multiple FEDERATED Table of MySQL. Without a Connection server, we need to write the connection string in every FEDERATED table so when we have a multiple FEDERATED table and which are using same remote connection information, create Connection Server once and use with all tables. Below is a small demonstration. First Create a Server: 1 2 3 CREATE SERVER FederatedConnectionServer FOREIGN DATA WRAPPER mysql OPTIONS (USER 'UserName',password 'Password', HOST 'localhost', PORT 3306, DATABASE 'TestDB'); Now use this server information to create Remote FEDERATED Table: 1 2 3 4 5 6 7 CREATE TABLE tbl_RemoteTable ( ID integer ,Name VARCHAR(255) ) ENGINE=FEDERATED CONNECTION='FederatedConnecti onServer/tbl_RemoteTable';
  • 303. ‫در‬ ‫ها‬ ‫پالگین‬ mysq |mariadb : ‫نمونه‬ ‫برای‬ . ‫کنیم‬ ‫فعال‬ ‫را‬ ‫زیادی‬ ‫های‬ ‫پالگین‬ . ‫میتوانیم‬ ‫ما‬ INSTALL PLUGIN sphinx SONAME 'ha_sphinx.so'; INSTALL PLUGIN innodb SONAME 'ha_xtradb';
  • 305. ( MySQL Replication ‫چیست؟‬ ) ‫‌آپ‬ ‫ک‬‫ب‬ ‫‌صورت‬ ‫ه‬‫ب‬ ‫و‬ ‫گرفت‬ ‫کپی‬ ‫اتوماتیک‬ ‫صورت‬ ‫به‬ ‫دیتابیس‬ ‫اطالعات‬ ‫از‬ ‫‌توان‬ ‫ی‬‫م‬ ‫آن‬ ‫‌کمک‬ ‫ه‬‫ب‬ ‫که‬ ‫است‬ ‫فرآیندی‬ ‫با‬ ‫بحث‬ ‫این‬ ‫در‬ .‫نباشد‬ ‫نیاز‬ ‫اصلی‬ ‫دیتابیس‬ ‫به‬ ‫رجوع‬ ‫تا‬ ‫‌شود‬ ‫ی‬‫م‬ ‫سبب‬ ‫اطالعات‬ ‫نسخه‬ ‫این‬ ‫از‬ ‫استفاده‬ .‫کرد‬ ‫ذخیره‬ ( ‫آدرس‬ ‫به‬ ‫توجه‬ IP ( .‫‌کنیم‬ ‫ی‬‫م‬ ‫بررسی‬ ‫را‬ ‫فرآیند‬ ‫این‬ ‫از‬ ‫نمونه‬ ‫چند‬ ‫زیر‬ ‫)های‬ Master Slave Replication ( ‫در‬ ) MySQL .‫است‬ ‫زیر‬ ‫شرح‬ ‫به‬ ) 12.34.56.789- Master Database 12.23.34.456- Slave Database ‫تنظیمات‬ ( ‫دسترسی‬ ‫از‬ ‫شروع‬ ‫از‬ ‫پیش‬ Sudo ( ‫نصب‬ ‫همچنین‬ ‫و‬ ) MySQL ( ‫اگر‬ .‫شوید‬ ‫مطمئن‬ ‫‌عامل‬ ‫م‬‫سیست‬ ‫روی‬ ‫بر‬ ) MySQL .‫کنید‬ ‫نصب‬ ‫را‬ ‫آن‬ ‫زیر‬ ‫دستور‬ ‫با‬ ،‫نیست‬ ‫نصب‬ ) sudo apt-get install mysql-server mysql-client :‫اول‬ ‫گام‬ ( ‫تنظیمات‬ Master Database ) ( ‫فایل‬ ‫تنظیمات‬ Mysql .‫کنید‬ ‫باز‬ ‫سرور‬ ‫در‬ ‫را‬ ) sudo nano /etc/mysql/my.cnf .‫‌کنیم‬ ‫ی‬‫م‬ ‫پیدا‬ ‫را‬ ‫باشد‬ ‫زیر‬ ‫عبارت‬ ‫شامل‬ ‫که‬ ‫قسمتی‬ ‫ابتدا‬ ،‫بدهیم‬ ‫تغییر‬ ‫کمی‬ ‫باید‬ ‫را‬ ‫فایل‬ ‫این‬ bind-address = 127.0.0.1 ( ‫به‬ ‫را‬ ‫آن‬ ‫آدرس‬ ‫و‬ 12.34.56.789 ( ‫تغییر‬ ،‫دهیم‬ ‫انجام‬ ‫‌بایست‬ ‫ی‬‫م‬ ‫که‬ ‫بعدی‬ ‫تنظیمات‬ .‫‌دهیم‬ ‫ی‬‫م‬ ‫تغییر‬ ) server-id ‫با‬ ‫عدد‬ ‫آن‬ ‫است‬ ‫بهتر‬ ‫اما‬ ‫دهید‬ ‫اختصاص‬ ‫آن‬ ‫به‬ ‫‌توانید‬ ‫ی‬‫م‬ ‫را‬ ‫عددی‬ ‫هر‬ ‫شما‬ .‫است‬ ) 1 ‫اما‬ ،‫شود‬ ‫آغاز‬ ( ‫هیچ‬ ‫با‬ ‫و‬ ‫باشد‬ ‫‌فرد‬ ‫ه‬‫منحصرب‬ ‫‌بایست‬ ‫ی‬‫م‬ ‫عدد‬ ‫آن‬ ‫که‬ ‫باشید‬ ‫داشته‬ ‫توجه‬ server-id ‫یکسان‬ ‫گروه‬ ‫در‬ ‫دیگری‬ ) ‫عدد‬ ‫‌جا‬‫این‬ ‫در‬ ‫ما‬ .‫نباشد‬ ۱ .‫‌دهیم‬ ‫ی‬‫م‬ ‫اختصاص‬ ‫آن‬ ‫به‬ ‫را‬ Server-id = 1
  • 306. ( ‫فایل‬ log_bin ( .‫‌شود‬ ‫ی‬‫م‬ ‫نگهداری‬ ‫کپی‬ ‫‌های‬ ‫ه‬‫نسخ‬ ‫جزئیات‬ ‫آن‬ ‫در‬ ‫که‬ ‫است‬ ‫فایلی‬ ) Slave ‫آن‬ ‫روی‬ ‫که‬ ‫اطالعاتی‬ ‫تمام‬ ) ( ‫حالت‬ ‫از‬ ‫را‬ ‫زیر‬ ‫خط‬ ‫تا‬ ‫‌ست‬ ‫ی‬‫کاف‬ ‫گام‬ ‫این‬ ‫در‬ .‫‌کند‬ ‫ی‬‫م‬ ‫کپی‬ ‫را‬ ‫هست‬ comment ‫از‬ ‫را‬ #‫(عالمت‬ ‫کنیم‬ ‫حذف‬ ) .)‫کنیم‬ ‫حذف‬ ‫خط‬ ‫ابتدای‬ log_bin = /var/log/mysql/mysql-bin.log ‫دوباره‬ ‫دستور‬ ‫این‬ ‫تکرار‬ ‫باشید‬ ‫داشته‬ ‫توجه‬ .‫کرد‬ ‫استفاده‬ ‫‌توان‬ ‫ی‬‫م‬ ‫زیر‬ ‫دستور‬ ‫از‬ ‫‌ها‬ ‫ل‬‫فای‬ ‫کردن‬ ‫کپی‬ ‫برای‬ ‫حال‬ .‫‌کند‬ ‫ی‬‫م‬ ‫کپی‬ ‫بیشتر‬ ‫تعداد‬ ‫در‬ ‫را‬ ‫فایل‬ binlog_do_db = newdatabase ‫یک‬ ‫فقط‬ ‫است‬ ‫‌ذکر‬ ‫ه‬‫ب‬ ‫الزم‬ .‫کنیم‬ ‫مشخص‬ ‫را‬ ‫‌شود‬ ‫ی‬‫م‬ ‫تهیه‬ ‫کپی‬ ‫نسخه‬ ‫آن‬ ‫از‬ ‫که‬ ‫را‬ ‫سروری‬ ‫‌بایست‬ ‫ی‬‫م‬ ً‫نهایتا‬ .‫کرد‬ ‫تعیین‬ ‫و‬ ‫گرفت‬ ‫نظر‬ ‫در‬ ‫را‬ ‫دیتابیس‬ ‫چند‬ ‫‌توان‬ ‫ی‬‫م‬ ،‫نیست‬ ‫الزم‬ ‫دیتابیس‬ binlog_do_db = newdatabase ( ‫و‬ ‫شده‬ ‫خارج‬ ‫آن‬ ‫از‬ ،‫تنظیمات‬ ‫انجام‬ ‫از‬ ‫پس‬ Mysql ( ‫را‬ ) restart .‫‌کنیم‬ ‫ی‬‫م‬ ) sudo service mysql restart ( ‫محیط‬ ‫در‬ ‫تنظیماتی‬ ‫بعدی‬ ‫قدم‬ shell ( .‫است‬ ‫دیتابیس‬ ) MySQL Shell .‫کنید‬ ‫باز‬ ‫را‬ ) mysql -u root -p
  • 307. ( ‫برای‬ ‫تا‬ ‫است‬ ‫نیاز‬ slave .‫کنیم‬ ‫مشخص‬ ‫عبور‬ ‫رمز‬ ‫و‬ ‫نام‬ ،) GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY 'password'; FLUSH PRIVILEGES; ( ‫یک‬ ‫در‬ ‫تا‬ ‫است‬ ‫نیاز‬ ‫فرآیند‬ ‫این‬ ‫کردن‬ ‫کامل‬ ‫برای‬ tab .‫کنید‬ ‫وارد‬ ‫را‬ ‫زیر‬ ‫دستورات‬ ‫جدید‬ ‫پنجره‬ ‫یا‬ ) USE newdatabase; FLUSH TABLES WITH READ LOCK; :‫کنید‬ ‫وارد‬ ‫نیز‬ ‫را‬ ‫زیر‬ ‫دستور‬ ‫آن‬ ‫در‬ SHOW MASTER STATUS; :‫‌شود‬ ‫ی‬‫م‬ ‫داده‬ ‫نمایش‬ ‫زیر‬ ‫همانند‬ ‫جدولی‬ ‫آن‬ ‫از‬ ‫پس‬ mysql> SHOW MASTER STATUS; +------------------+----------+--------------+------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +------------------+----------+--------------+------------------+ | mysql-bin.000001 | 107 | newdatabase | | +------------------+----------+--------------+------------------+ 1 row in set (0.00 sec) ( ‫که‬ ‫است‬ ‫این‬ ‫بیانگر‬ ‫جدول‬ ‫این‬ slave ‫را‬ ‫اعداد‬ ‫این‬ ‫است‬ ‫بهتر‬ .‫‌کند‬ ‫ی‬‫م‬ ‫برداری‬ ‫کپی‬ ‫به‬ ‫شروع‬ ‫دیتابیس‬ ‫کدام‬ ‫از‬ ) .‫داشت‬ ‫خواهید‬ ‫نیاز‬ ‫‌ها‬ ‫ن‬‫آ‬ ‫به‬ ‫ادامه‬ ‫در‬ .‫دارید‬ ‫نگه‬ ‫خود‬ ‫پیش‬ ( ‫یا‬ ‫پنجره‬ ‫در‬ ‫تغییری‬ ‫شما‬ ‫اگر‬ tab ( ‫اتوماتیک‬ ‫طور‬ ‫به‬ ‫دیتابیس‬ ،‫بدهید‬ ‫دیگری‬ ) unblock ‫‌همین‬ ‫ه‬‫ب‬ .‫‌شود‬ ‫ی‬‫م‬ ) .‫دهید‬ ‫ادامه‬ ‫را‬ ‫مراحل‬ ‫فقط‬ ‫جدید‬ ‫پنجره‬ ‫کردن‬ ‫باز‬ ‫از‬ ‫بعد‬ ‫دلیل‬ ( ‫محیط‬ ‫یک‬ ‫در‬ ‫را‬ ‫عمل‬ ‫این‬ ‫است‬ ‫تذکر‬ ‫به‬ ‫الزم‬ .‫کنید‬ ‫کپی‬ ‫جدید‬ ‫دیتابیس‬ ‫در‬ ‫را‬ ‫اطالعات‬ ‫و‬ ‫دیتا‬ ‫زیر‬ ‫دستور‬ ‫با‬ shell .‫دهید‬ ‫انجام‬ ‫جداگانه‬ ) mysqldump -u root -p --opt newdatabase > newdatabase.sql .‫برسانید‬ ‫پایان‬ ‫به‬ ‫را‬ ‫مراحل‬ ‫و‬ ‫بازگردید‬ ‫خود‬ ‫کار‬ ‫اصلی‬ ‫پنجره‬ ‫به‬ ‫اکنون‬
  • 308. UNLOCK TABLES; QUIT; :‫دوم‬ ‫گام‬ ( ‫تنظیمات‬ Slave Database ) ( ‫تنظیمات‬ ‫اول‬ ‫گام‬ ‫در‬ ‫که‬ ‌ ‫ن‬‫آ‬ ‫از‬ ‫پس‬ master database ( ‫تنظیم‬ ‫به‬ ‫نوبت‬ ،‫دادیم‬ ‫انجام‬ ‫را‬ ) Slave ‫وارد‬ .‫است‬ ) ( ‫سرور‬ Slave ( ‫و‬ ‫شوید‬ ) MySQL shell .‫ببندید‬ ‫را‬ ‫آن‬ ‫سپس‬ ‫و‬ ‫کنید‬ ‫ایجاد‬ ‫جدید‬ ‫دیتابیس‬ ‫یک‬ .‫کنید‬ ‫باز‬ ‫را‬ ) CREATE DATABASE newdatabase; EXIT; ( ‫دیتابیس‬ ‫از‬ ‫که‬ ‫را‬ ‫دیتابیسی‬ master .‫کنید‬ ‫وارد‬ ‫آن‬ ‫در‬ ‫را‬ ‫بودید‬ ‫کرده‬ ‫خارج‬ ) mysql -u root -p newdatabase < /path/to/newdatabase.sql ( ‫به‬ ‫مربوط‬ ‫تنظیمات‬ ‫حال‬ slave :‫‌دهیم‬ ‫ی‬‫م‬ ‫انجام‬ ‫را‬ ) sudo nano /etc/mysql/my.cnf ( ‫تا‬ ‫است‬ ‫نیاز‬ ‫نیز‬ ‫جا‬ ‫این‬ ‫در‬ server-id ‫باید‬ ‫نام‬ ‫این‬ ،‫شد‬ ‫گفته‬ ‫باال‬ ‫در‬ ‫که‬ ‫‌طور‬ ‫ن‬‫هما‬ .‫دهید‬ ‫تغییر‬ ‫را‬ ) .‫باشد‬ ‫‌فرد‬ ‫ه‬‫منحصرب‬ server-id = 2 .‫کنید‬ ‫کامل‬ ‫را‬ ‫‌ها‬ ‫ن‬‫آ‬ ‫و‬ ‫کنید‬ ‫طی‬ ‫را‬ ‫مراحل‬ ‫زیر‬ ‫شرح‬ ‫به‬ ‫سپس‬ relay-log = /var/log/mysql/mysql-relay-bin.log log_bi = /var/log/mysql/mysql-bin.log binlog_do_db = newdatabase ( ‫را‬ ‫مراحل‬ ‫دیتابیس‬ ‫ایجاد‬ ‫از‬ ‫پس‬ save .‫شوید‬ ‫خارج‬ ‫آن‬ ‫از‬ ‫سپس‬ ‫و‬ ‫کرده‬ ) ‫دوباره‬ (MySQL) ‫را‬ (restart) ‫کنید‬. sudo service mysql restart
  • 309. ( ‫کردن‬ ‫فعال‬ ‫بعدی‬ ‫قدم‬ Replication ( ‫محیط‬ ‫در‬ ) MySQL shell ‫در‬ ‫را‬ ‫زیر‬ ‫جزئیات‬ ‫و‬ ‫کنید‬ ‫باز‬ ‫دوباره‬ ‫را‬ ‫آن‬ .‫است‬ ) :‫کنید‬ ‫وارد‬ ‫آن‬ CHANGE MASTER TO MASTER_HOST='12.34.56.789',MASTER_USER='slave_user', MASTER_PASSWORD='password', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS= 107; :‫‌گردد‬ ‫ی‬‫م‬ ‫زیر‬ ‫تغییرات‬ ‫ایجاد‬ ‫باعث‬ ‫دستور‬ ‫این‬ • ( ‫‌عنوان‬ ‫ه‬‫ب‬ ‫را‬ ‫فعلی‬ ‫سرور‬ ‫عمل‬ ‫این‬ slave ( ‫برای‬ ) master .‫‌دهد‬ ‫ی‬‫م‬ ‫قرار‬ ) • ( ‫سنجی‬ ‫اعتبار‬ login .‫‌شود‬ ‫ی‬‫م‬ ‫انجام‬ ‫درست‬ ‫سرور‬ ‫در‬ ‫‌)ها‬ • ( ‫سرور‬ ‫به‬ ،‫آخر‬ ‫در‬ slave ‫که‬ ‫عددهایی‬ ‫همان‬ ‫(طبق‬ .‫کند‬ ‫آغاز‬ ‫را‬ ‫برداری‬ ‫کپی‬ ‫عمل‬ ‫کجا‬ ‫از‬ ‫تا‬ ‫‌کند‬ ‫ی‬‫م‬ ‫اعالم‬ ) )‫کردیم‬ ‫مشخص‬ ‫‌ها‬ ‫ن‬‫آ‬ ‫برای‬ ( ‫سرور‬ ،‫تنظیمات‬ ‫اتمام‬ ‫از‬ ‫پس‬ slave :‫‌کنیم‬ ‫ی‬‫م‬ ‫فعال‬ ‫را‬ ) START SLAVE; :‫‌کنیم‬ ‫ی‬‫م‬ ‫استفاده‬ ‫زیر‬ ‫دستور‬ ‫از‬ ‫نیز‬ ‫آن‬ ‫جزئیات‬ ‫مشاهده‬ ‫برای‬ SHOW SLAVE STATUSG :‫کرد‬ ‫استفاده‬ ‫‌توان‬ ‫ی‬‫م‬ ‫نیز‬ ‫زیر‬ ‫دستور‬ ‫از‬ ،‫شود‬ ‫وصل‬ ‫نتوانست‬ ‫و‬ ‫آمد‬ ‫پیش‬ ‫مشکلی‬ ‫ارتباط‬ ‫برقراری‬ ‫برای‬ ‫اگر‬ SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; SLAVE START; ‫سرور‬ ‫ودر‬ ‫کرده‬ ‫وارد‬ ‫مقداری‬ ‫جدول‬ ‫یک‬ ‫در‬ ‫آخر‬ ‫در‬ slave . ‫نه‬ ‫یا‬ ‫شده‬ ‫انجام‬ ‫درستی‬ ‫به‬ ‫فرایند‬ ‫میکنیم‬ ‫بررسی‬
  • 310. List of Server System Variables alter_algorithm • Description: The implied ALGORITHM for ALTER TABLE if no ALGORITHM clause is specified. The deprecated variable old_alter_table is an alias for this. • COPY corresponds to the pre-MySQL 5.1 approach of creating an intermediate table, copying data one row at a time, and renaming and dropping tables. • INPLACE requests that the operation be refused if it cannot be done natively inside a the storage engine. • DEFAULT (the default) chooses INPLACE if available, and falls back to COPY. • NOCOPY refuses to copy a table. • INSTANT refuses an operation that would involve any other than metadata changes. • Commandline: --alter-algorithm=default • Scope: Global, Session • Dynamic: Yes • Data Type: enumerated • Default Value: DEFAULT • Introduced: MariaDB 10.3.7 • Valid Values: DEFAULT, COPY, INPLACE, NOCOPY, INSTANT autocommit • Description: If set to 1, the default, all queries are committed immediately. The LOCK IN SHARE MODE and FOR UPDATE clauses therefore have no effect. If set to 0, they are only committed upon a COMMIT statement, or rolled back with a ROLLBACK statement. If autocommit is set to 0, and then changed to 1, all open transactions are immediately committed. • Commandline: --autocommit[=#] • Scope: Global, Session • Dynamic: Yes • Data Type: boolean • Default Value: 1 automatic_sp_privileges • Description: When set to 1, the default, when a stored routine is created, the creator is automatically granted permission to ALTER (which includes dropping) and to EXECUTE the routine. If set to 0, the creator is not automatically granted these privileges. • Commandline: --automatic-sp-privileges, --skip-automatic-sp- privileges • Scope: Global
  • 311. • Dynamic: Yes • Data Type: boolean • Default Value: 1 back_log • Description: Connections take a small amount of time to start, and this setting determines the number of outstanding connection requests MariaDB can have, or the size of the listen queue for incoming TCP/IP requests. Requests beyond this will be refused. Increase if you expect short bursts of connections. Cannot be set higher than the operating system limit (see the Unix listen() man page). If not set, set to 0, or the --autoset-back-log option is used, will be autoset to the lower of 900 and (50 + max_connections/5) (>= MariaDB 10.1.7). • Commandline: --back-log=# • Scope: Global • Dynamic: No • Type: number • Default Value: • The lower of 900 and (50 + max_connections/5) (>= MariaDB 10.1.7) • The lower of 150 or the value of max_connections (beween MariaDB 10.0.8 and MariaDB 10.1.7) • 50 (<= MariaDB 10.0.8) basedir • Description: Path to the MariaDB installation directory. Other paths are usually resolved relative to this base directory. • Commandline: --basedir=path or -b path • Scope: Global • Dynamic: No • Type: directory name big_tables • Description: Old variable, which if set to 1, allows large result sets by saving all temporary sets to disk, avoiding 'table full' errors. No longer needed, as the server now handles this automatically. sql_big_tables is a synonym. • Commandline: --big-tables • Scope: Global, Session • Dynamic: Yes
  • 312. • Data Type: boolean • Default Value: 0 bind_address • Description: By default, the MariaDB server listens for TCP/IP connections on a network socket bound to a single address, 0.0.0.0. You can specify an alternative when the server starts using this option; either a host name, an IPv4 or an IPv6 address. In Debian and Ubuntu, the default bind_address is 127.0.0.1, which binds the server to listen on localhost only. Has always been available as a mysqld option, from MariaDB 10.3.3 also available as a system variable. • Commandline: --bind-address=addr • Scope: Global • Dynamic: No • Data Type: string • Valid Values: Host name, IPv4, IPv6 (>= MariaDB 5.5) • Introduced: MariaDB 10.3.3 (as a system variable) bulk_insert_buffer_size • Description: Size in bytes of the per-thread cache tree used to speed up bulk inserts into MyISAM and Aria tables. A value of 0 disables the cache tree. • Commandline: --bulk-insert-buffer-size=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 8388608 • Range - 32 bit: 0 to 4294967295 • Range - 64 bit: 0 to 18446744073709547520 character_set_client • Description: Determines the character set for queries arriving from the client. It can be set per session by the client, although the server can be configured to ignore client requests with the -- skip-character-set-client-handshake option. If the client does not request a character set, or requests a character set that the server does not support, the global value will be used. utf16, utf32 and ucs2 cannot be used as client character sets. • Scope: Global, Session • Dynamic: Yes • Data Type: string
  • 313. • Default Value: utf8 (>= MariaDB 5.5) character_set_connection • Description: Character set used for number to string conversion, as well as for literals that don't have a character set introducer. • Scope: Global, Session • Dynamic: Yes • Data Type: string • Default Value: utf8 (>= MariaDB 5.5) character_set_database • Description: Character set used by the default database, and set by the server whenever the default database is changed. If there's no default database, character_set_database contains the same value as character_set_server. This variable is dynamic, but should not be set manually, only by the server. • Scope: Global, Session • Dynamic: Yes • Data Type: string • Default Value: latin1 character_set_filesystem • Description: The character set for the filesystem. Used for converting file names specified as a string literal from character_set_client to character_set_filesystem before opening the file. By default set to binary, so no conversion takes place. This could be useful for statements such as LOAD_FILE() or LOAD DATA INFILE on system where multi-byte file names are use. • Commandline: --character-set-filesystem=name • Scope: Global, Session • Dynamic: Yes • Data Type: string • Default Value: binary character_set_results • Description: Character set used for results and error messages returned to the client. • Scope: Global, Session • Dynamic: Yes
  • 314. • Data Type: string • Default Value: utf8 character_set_server • Description: Default character set used by the server. See character_set_database for character sets used by the default database. Defaults may be different on some systems, see for example Differences in MariaDB in Debian. • Commandline: --character-set-server • Scope: Global, Session • Dynamic: Yes • Data Type: string • Default Value: latin1 character_set_system • Description: Character set used by the server to store identifiers, always set to utf8. • Scope: Global • Dynamic: No • Data Type: string • Default Value: utf8 character_sets_dir • Description: Directory where the character sets are installed. • Commandline: --character-sets-dir=path • Scope: Global • Dynamic: No • Type: directory name check_constraint_checks • Description: If set to 0, will disable constraint checks, for example when loading a table that violates some constraints that you plan to fix later. • Commandline: --check-constraint-checks=[0|1] • Scope: Global, Session • Dynamic: Yes • Type: boolean • Default: ON
  • 315. • Introduced: MariaDB 10.2.1 collation_connection • Description: Collation used for the connection character set. • Scope: Global, Session • Dynamic: Yes • Data Type: string collation_database • Description: Collation used for the default database. Set by the server if the default database changes, if there is no default database the value from the collation_server variable is used. This variable is dynamic, but should not be set manually, only by the server. • Scope: Global, Session • Dynamic: Yes • Data Type: string collation_server • Description: Default collation used by the server. This is set to the default collation for a given character set automatically when character_set_server is changed, but it can also be set manually. Defaults may be different on some systems, see for example Differences in MariaDB in Debian. • Commandline: --collation-server=name • Scope: Global, Session • Dynamic: Yes • Data Type: string • Default Value: latin1_swedish_ci completion_type • Description: The transaction completion type. If set to NO_CHAIN or 0 (the default), there is no effect on commits and rollbacks. If set to CHAIN or 1, a COMMIT statement is equivalent to COMMIT AND CHAIN, while a ROLLBACK is equivalent to ROLLBACK AND CHAIN, so a new transaction starts straight away with the same isolation level as transaction that's just finished. If set to RELEASE or 2, a COMMIT statement is equivalent to COMMIT RELEASE, while a ROLLBACK is equivalent to ROLLBACK RELEASE, so the server will disconnect
  • 316. after the transaction completes. Note that the transaction completion type only applies to explicit commits, not implicit commits. • Commandline: --completion-type=name • Scope: Global, Session • Dynamic: Yes • Data Type: enumerated (>=MariaDB/MySQL 5.5.3), numeric (<= MariaDB/MySQL 5.5.2) • Default Value: NO_CHAIN (>=MariaDB/MySQL 5.5.3), 0 (<= MariaDB/MySQL 5.5.2) • Valid Values: 0, 1, 2 (All versions), NO_CHAIN, CHAIN, RELEASE (>=MariaDB/MySQL 5.5.3) concurrent_insert • Description: If set to AUTO or 1, the default, MariaDB allows concurrent INSERTs and SELECTs for MyISAM tables with no free blocks in the data. If set to NEVER or 0, concurrent inserts are disabled. If set to ALWAYS or 2, concurrent inserts are permitted for all MyISAM tables, even those with holes, in which case new rows are added at the end of a table if the table is being used by another thread. If the --skip-new option is used when starting the server, concurrent_insert is set to NEVER. • Commandline: --concurrent-insert[=name] • Scope: Global • Dynamic: Yes • Data Type: enumerated (>=MariaDB/MySQL 5.5.3), numeric (<= MariaDB/MySQL 5.5.2) • Default Value: AUTO (>=MariaDB/MySQL 5.5.3), 1 (<= MariaDB/MySQL 5.5.2) • Valid Values: 0, 1, 2 (All versions), AUTO, NEVER, ALWAYS (>=MariaDB/MySQL 5.5.3) • Documentation: concurrent-inserts • Notes: Changing the variable only affects new opened tables. Use FLUSH TABLES If you want it to affect also cached tables. connect_timeout • Description: Time in seconds that the server waits for a connect packet before returning a 'Bad handshake'. Increasing may help if clients regularly encounter 'Lost connection to MySQL server at 'X', system error: error_number' type-errors • Commandline: --connect-timeout=# • Scope: Global • Dynamic: Yes • Type: numeric
  • 317. • Default Value: 10 datadir • Description: Directory where the data is stored. • Commandline: --datadir=path or -h path • Scope: Global • Dynamic: No • Type: directory name date_format • Description: Unused. datetime_format • Description: Unused. debug • Description: Used in debugging to write to a trace file. MariaDB needs to be configured with - SWITH_DEBUG=1 to enable this option. • Commandline: --debug[=debug_options] • Scope: Global, Session • Dynamic: Yes • Data Type: string • Default Value: d:t:i:o,/tmp/mysqld.trace (Unix) or d:t:i:O,mysqld.trace (Windows) debug_no_thread_alarm • Description: Disable system thread alarm calls. Disabling it may be useful in debugging or testing, never do it in production. • Commandline: --debug-no-thead-alarm=# • Scope: Global • Dynamic: No • Data Type: boolean • Default Value: OFF • Introduced: MariaDB
  • 318. debug_sync • Description: Used in debugging to show the interface to the Debug Sync facility. MariaDB needs to be configured with -DENABLE_DEBUG_SYNC=1 for this variable to be available. • Scope: Session • Dynamic: Yes • Data Type: string • Default Value: OFF or ON - current signal signal name default_regex_flags • Description: Introduced to address remaining incompatibilities between PCRE and the old regex library. Accepts a comma-separated list of zero or more of the following values: Commandline: --default-regex-flags=value • Scope: Global, Session • Dynamic: Yes • Default Value: empty • Valid Values: DOTALL, DUPNAMES, EXTENDED, EXTRA, MULTILINE, UNGREEDY • Introduced: MariaDB 10.0.11 default_storage_engine • Description: The default storage engine. The default storage engine must be enabled at server startup or the server won't start. • Commandline: --default-storage-engine=name • Scope: Global, Session
  • 319. • Dynamic: Yes • Type: enumeration • Default Value: InnoDB (>= MariaDB 5.5), MyISAM (<MariaDB 5.3) • Introduced: MariaDB 5.5 (previously storage_engine) default_table_type • Description: A synonym for default_storage_engine. Removed in MariaDB 5.5. • Commandline: --default-table-type=name • Scope: Global, Session • Dynamic: Yes • Removed: MariaDB/MySQL 5.5 default_tmp_storage_engine • Description: Default storage engine that will be used for tables created with CREATE TEMPORARY TABLE where no engine is specified. For internal temporary tables see aria_used_for_temp_tables). The storage engine used must be active or the server will not start. See default_storage_engine for the default for non-temporary tables. Defaults to NULL, in which case the value from default_storage_engine is used. • Commandline: --default-tmp-storage-engine=name • Scope: Global, Session • Dynamic: Yes • Data Type: enumeration • Default Value: NULL • Introduced: MariaDB 10.1.0 default_week_format • Description: Default mode for the WEEK() function. See that page for details on the different modes • Commandline: --default-week-format=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 0 • Range: 0 to 7
  • 320. delay_key_write • Description: Specifies how MyISAM tables handles CREATE TABLE DELAY_KEY_WRITE. If set to ON, the default, any DELAY KEY WRITEs are honored. The key buffer is then flushed only when the table closes, speeding up writes. MyISAM tables should be automatically checked upon startup in this case, and --external locking should not be used, as it can lead to index corruption. If set to OFF, DELAY KEY WRITEs are ignored, while if set to ALL, all new opened tables are treated as if created with DELAY KEY WRITEs enabled. • Commandline: --delay-key-write[=name] • Scope: Global • Dynamic: Yes • Data Type: enumeration • Default Value: ON • Valid Values: ON, OFF, ALL delayed_insert_limit • Description: After this many rows have been inserted with INSERT DELAYED, the handler will check for and execute any waiting SELECT statements. • Commandline: --delayed-insert-limit=# • Scope: Global • Dynamic: Yes • Data Type: numeric • Default Value: 100 • Range: 1 to 4294967295 delayed_insert_timeout • Description: Time in seconds that the INSERT DELAYED handler will wait for INSERTs before terminating. • Commandline: --delayed-insert-timeout=# • Scope: Global • Dynamic: Yes • Data Type: numeric • Default Value: 300
  • 321. delayed_queue_size • Description: Number of rows, per table, that can be queued when performing INSERT DELAYED statements. If the queue becomes full, clients attempting to perform INSERT DELAYED's will wait until the queue has room available again. • Commandline: --delayed-queue-size=# • Scope: Global • Dynamic: Yes • Type: numeric • Default Value: 1000 • Range: 1 to 4294967295 div_precision_increment • Description: Number of digits to be returned after the decimal point in division operations. By default 4, so SELECT 2/15 would return 0.1333. After setting div_precision_increment to 6, for example, the same operation would return 0.133333. • Commandline: --div-precision-increment=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 4 • Range: 0 to 30 encrypt_tmp_disk_tables • Description: Encrypt tmp disk tables (created as part of query execution). See Table and Tablespace Encryption. • Commandline: --encrypt-tmp-disk-tables[={0|1}] • Scope: Global • Dynamic: Yes • Data Type: boolean • Default Value: OFF • Introduced: 10.1.3 encrypt_tmp_files • Description: Encrypt temporary files (created for filesort, binary log cache, etc). See Table and Tablespace Encryption. • Commandline: --encrypt-tmp-files[={0|1}]
  • 322. • Scope: Global • Dynamic: No • Data Type: boolean • Default Value: OFF (>= MariaDB 10.1.7), ON (<= MariaDB 10.1.6) • Introduced: MariaDB 10.1.5 encryption_algorithm • Description: Which encryption algorithm to use for table encryption. aes_cbc is the recommended one. See Table and Tablespace Encryption. • Commandline: --encryption-algorithm=value • Scope: Global • Dynamic: No • Data Type: enum • Default Value: none • Valid Values: none, aes_ecb, aes_cbc, aes_ctr • Introduced: MariaDB 10.1.3 • Removed: MariaDB 10.1.4 enforce_storage_engine • Description: Force the use of a particular storage engine for new tables. Used to avoid unwanted creation of tables using another engine. For example, setting to InnoDB will prevent any MyISAM tables from being created. If another engine is specified in a CREATE TABLE statement, the outcome depends on whether the NO_ENGINE_SUBSTITUTION SQL_MODE has been set or not. If set (the default from MariaDB 10.1.7), the query will fail, while if not set, a warning will be returned and the table created according to the engine specified by this variable. The variable has a session scope, but is only modifiable by a user with the SUPER privilege. • Commandline: None • Scope: Session • Dynamic: Yes • Data Type: string • Default Value: none • Introduced: MariaDB 10.1.4
  • 323. engine_condition_pushdown • Description: Deprecated in MariaDB 5.5 and removed and replaced by the optimizer_switch engine_condition_pushdown={on|off} flag in MariaDB 10.0.. Specifies whether the engine condition pushdown optimization is enabled. Since MariaDB 10.1.1, engine condition pushdown is enabled for all engines that support it. • Commandline: --engine-condition-pushdown • Scope: Global, Session • Dynamic: Yes • Data Type: boolean • Default Value: • OFF (MariaDB 5.5) • ON (<= MariaDB 5.3) • Deprecated: MariaDB 5.5 • Removed: MariaDB 10.0 error_count • Description: Read-only variable denoting the number of errors from the most recent statement in the current session that generated errors. See SHOW_ERRORS(). • Scope: Session • Dynamic: Yes • Data Type: numeric event_scheduler • Description: Status of the Event Scheduler. Can be set to ON or OFF, while DISABLED means it cannot be set at runtime. Setting the variable will cause a load of events if they were not loaded at startup. • Commandline: --event-scheduler[=value] • Scope: Global • Dynamic: Yes • Data Type: enumeration • Default Value: OFF • Valid Values: ON (or 1), OFF (or 0), DISABLED
  • 324. expensive_subquery_limit • Description: Number of rows to be examined for a query to be considered expensive, that is, maximum number of rows a subquery may examine in order to be executed during optimization and used for constant optimization. • Commandline: --expensive-subquery-limit=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 100 • Range: 0 upwards • Introduced: MariaDB 5.5.25 explicit_defaults_for_timestamp • Description: This option causes CREATE TABLE to create all TIMESTAMP columns as NULL with the DEFAULT NULL attribute, Without this option, TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses. The old behavior is deprecated. • Commandline: --explicit-defaults-for-timestamp=[={0|1}] • Scope: Global • Dynamic: No • Data Type: bolean • Default Value: OFF • Introduced: MariaDB 10.1.8 external_user • Description: External user name set by the plugin used to authenticate the client. NULL if native MariaDB authentication is used. • Scope: Session • Dynamic: No • Data Type: string • Default Value: NULL • Introduced: MariaDB 5.5 flush • Description: Usually, MariaDB writes changes to disk after each SQL statement, and the operating system handles synchronizing (flushing) it to disk. If set to ON, the server will synchronize all changes to disk after each statement.
  • 325. • Commandline: --flush • Scope: Global • Dynamic: Yes • Data Type: boolean • Default Value: OFF flush_time • Description: Interval in seconds that tables are closed to synchronize (flush) data to disk and free up resources. If set to 0, the default, there is no automatic synchronizing tables and closing of tables. This option should not be necessary on systems with sufficient resources. • Commandline: --flush_time=# • Scope: Global • Dynamic: Yes • Data Type: numeric • Default Value: 0 foreign_key_checks • Description: If set to 1 (the default) foreign key constraints (including ON UPDATE and ON DELETE behavior) InnoDB tables are checked, while if set to 0, they are not checked. 0 is not recommended for normal use, though it can be useful in situations where you know the data is consistent, but want to reload data in a different order from that that specified by parent/child relationships. Setting this variable to 1 does not retrospectively check for inconsistencies introduced while set to 0. • Commandline: None • Scope: Global, Session • Dynamic: Yes • Data Type: boolean • Default Value: 1 ft_boolean_syntax • Description: List of operators supported by an IN BOOLEAN MODE full-text search. If you wish to change, note that each character must be ASCII and non-alphanumeric, the full string must be 14 characters and the first or second character must be a space. Positions 10, 13 and 14 are reserved for future extensions. Also, no duplicates are permitted except for the phrase quoting characters in positions 11 and 12, which may be the same. • Commandline: --ft-boolean-syntax=name
  • 326. • Scope: Global • Dynamic: Yes • Data Type: string • Default Value: + -><()*:""&| ft_max_word_len • Description: Maximum length for a word to be included in the MyISAM full-text index. If this variable is changed, the full-text index must be rebuilt. The quickest way to do this is by issuing a REPAIR TABLE table_name QUICK statement. See innodb_ft_max_token_size for the InnoDB equivalent. • Commandline: --ft-max-word-len=# • Scope: Global • Dynamic: No • Data Type: numeric • Default Value: 84 • Minimum Value: 10 ft_min_word_len • Description: Minimum length for a word to be included in the MyISAM full-text index. If this variable is changed, the full-text index must be rebuilt. The quickest way to do this is by issuing a REPAIR TABLE table_name QUICK statement. See innodb_ft_min_token_size for the InnoDB equivalent. • Commandline: --ft-min-word-len=# • Scope: Global • Dynamic: No • Data Type: numeric • Default Value: 4 • Minimum Value: 1 ft_query_expansion_limit • Description: For full-text searches, denotes the numer of top matches when using WITH QUERY EXPANSION. • Commandline: --ft-query-expansion-limit=# • Scope: Global • Dynamic: No • Data Type: numeric
  • 327. • Default Value: 20 • Range: 0 to 1000 ft_stopword_file • Description: File containing a list of stopwords for use in MyISAM full-text searches. Unless an absolute path is specified the file will be looked for in the data directory. The file is not parsed for comments, so all words found become stopwords. By default, a built-in list of words (built from storage/myisam/ft_static.c file) is used. Stopwords can be disabled by setting this variable to '' (an empty string). If this variable is changed, the full-text index must be rebuilt. The quickest way to do this is by issuing a REPAIR TABLE table_name QUICK statement. See innodb_ft_server_stopword_table for the InnoDB equivalent. • Commandline: --ft-stopword-file=file_name • Scope: Global • Dynamic: No • Data Type: file name • Default Value: (built-in) general_log • Description: If set to 0, the default unless the --general-log option is used, the general query log is disabled, while if set to 1, the general query log is enabled. See log_output for how log files are written. If that variable is set to NONE, no logs will be written even if general_query_log is set to 1. • Commandline: --general-log • Scope: Global • Dynamic: Yes • Data Type: boolean • Default Value: 0 general_log_file • Description: Name of the general query log file. If this is not specified, the name is taken from the log-basename setting or from your system hostname with .log as a suffix. • Commandline: --general-log-file=file_name • Scope: Global • Dynamic: Yes • Data Type: file name • Default Value: host_name.log
  • 328. group_concat_max_len • Description: Maximum length in bytes of the returned result for a GROUP_CONCAT() function. • Commandline: --group-concat-max-len=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: • 1048576 (1M) >= MariaDB 10.2.4 • 1024 (1K) <= MariaDB 10.2.3 • Range - 32-bit: 4 to 4294967295 • Range - 64-bit: 4 to 18446744073709547520 . have_compress • Description: If the zlib compression library is accessible to the server, this will be set to YES, otherwise it will be NO. The COMPRESS() and UNCOMPRESS() functions will only be available if set to YES. • Scope: Global • Dynamic: No have_crypt • Description: If the crypt() system call is available this variable will be set to YES, otherwise it will be set to NO. If set to NO, the ENCRYPT() function cannot be used. • Scope: Global • Dynamic: No have_csv • Description: If the server supports CSV tables, will be set to YES, otherwise will be set to NO. Removed in MariaDB 10.0, use the Information Schema PLUGINS table or SHOW ENGINES instead. • Scope: Global • Dynamic: No • Removed: MariaDB 10.0
  • 329. have_dynamic_loading • Description: If the server supports dynamic loading of plugins, will be set to YES, otherwise will be set to NO. • Scope: Global • Dynamic: No have_geometry • Description: If the server supports spatial data types, will be set to YES, otherwise will be set to NO. • Scope: Global • Dynamic: No have_ndbcluster • Description: If the server supports NDBCluster (disabled in MariaDB). • Scope: Global • Dynamic: No • Removed: MariaDB 10.0 have_partitioning • Description: If the server supports partitioning, will be set to YES, unless the --skip- partition option is used, in which case will be set to DISABLED. Will be set to NO otherwise. Removed in MariaDB 10.0 - SHOW PLUGINS should be used instead. • Scope: Global • Dynamic: No • Removed: MariaDB 10.0 have_profiling • Description: If statement profiling is available, will be set to YES, otherwise will be set to NO. See SHOW PROFILES() and SHOW PROFILE(). • Scope: Global • Dynamic: No
  • 330. have_query_cache • Description: If the server supports the query cache, will be set to YES, otherwise will be set to NO. • Scope: Global • Dynamic: No have_rtree_keys • Description: If RTREE indexes (used for spatial indexes) are available, will be set to YES, otherwise will be set to NO. • Scope: Global • Dynamic: No have_symlink • Description: If symbolic link support is enabled, will be set to YES, otherwise will be set to NO. Required for the INDEX DIRECTORY and DATA DIRECTORY table options (see CREATE TABLE) and Windows symlink support. Will be set to DISABLED if the server is started with the --skip-symbolic-links option. • Scope: Global • Dynamic: No histogram_size • Description: Number of bytes used for a histogram. If set to 0, no histograms are created by ANALYZE. • Commandline: --histogram-size=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 0 • Range: 0 to 255 • Introduced: MariaDB 10.0.2 histogram_type • Description: Specifies the type of histograms created by ANALYZE. • SINGLE_PREC_HB - single precision height-balanced. • DOUBLE_PREC_HB - double precision height-balanced.
  • 331. • Commandline: --histogram-type=value • Scope: Global, Session • Dynamic: Yes • Data Type: enumeration • Default Value: SINGLE_PREC_HB • Valid Values: SINGLE_PREC_HB, DOUBLE_PREC_HB • Introduced: MariaDB 10.0.2 host_cache_size • Description: Number of host names that will be cached to avoid resolving. Setting to 0 disables the cache. Changing the value while the server is running causes an implicit FLUSH HOSTS, clearing the host cache and truncating the performance_schema.host_cache table. If you are connecting from a lot of different machines you should consider increasing. • Commandline: --host-cache-size=#. • Scope: Global • Dynamic: Yes • Data Type: numeric • Default Value: 128 • Range: 0 to 65536 • Introduced: MariaDB 10.0 hostname • Description: When the server starts, this variable is set to the server host name. • Scope: Global • Dynamic: No • Data Type: string identity • Description: A synonym for last_insert_id variable. idle_readonly_transaction_timeout • Description: Time in seconds that the server waits for idle read-only transactions before killing the connection. If set to 0, the default, connections are never killed. See also idle_transaction_timeout, idle_write_transaction_timeout and Transaction Timeouts. • Scope: Global, Session
  • 332. • Dynamic: Yes • Data Type: numeric • Default Value: 0 • Range: 0 to 31536000 • Introduced: MariaDB 10.3.0 idle_transaction_timeout • Description: Time in seconds that the server waits for idle transactions before killing the connection. If set to 0, the default, connections are never killed. See also idle_readonly_transaction_timeout, idle_write_transaction_timeout and Transaction Timeouts. • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 0 • Range: 0 to 31536000 • Introduced: MariaDB 10.3.0 idle_write_transaction_timeout • Description: Time in seconds that the server waits for idle read-write transactions before killing the connection. If set to 0, the default, connections are never killed. See also idle_transaction_timeout, idle_readonly_transaction_timeout and Transaction Timeouts. Called idle_readwrite_transaction_timeout until MariaDB 10.3.2. • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 0 • Range: 0 to 31536000 • Introduced: MariaDB 10.3.0 ignore_db_dirs • Description: Comma-delimited list of directories in the data directory that are not considered as database directories. Set from --ignore-db-dir at startup. • Scope: Global • Dynamic: No • Data Type: string • Introduced: MariaDB 5.5
  • 333. in_transaction • Description: Session-only and read-only variable that is set to 1 if you are in a transaction, and 0 if not. • Commandline: No • Scope: Session • Dynamic: No • Data Type: boolean • Default Value: 0 • Introduced: MariaDB 5.3 init_connect • Description: String containing one or more SQL statements, separated by semicolons, that will be executed by the server for each client connecting. If there's a syntax error in the one of the statements, the client will fail to connect. For this reason, the statements are not executed for users with the SUPER privilege, who can then still connect and correct the error. See also init_file. • Commandline: --init-connect=name • Scope: Global • Dynamic: Yes • Data Type: string init_file • Description: Name of a file containing SQL statements that will be executed by the server on startup. Each statement should be on a new line, and end with a semicolon. See also init_connect. • Commandline: init-file=file_name • Scope: Global • Dynamic: No • Data Type: file name insert_id • Description: Value to be used for the next statement inserting a new AUTO_INCREMENT value. • Scope: Session • Dynamic: Yes
  • 334. • Data Type: numeric interactive_timeout • Description: Time in seconds that the server waits for an interactive connection (one that connects with the mysql_real_connect() CLIENT_INTERACTIVE option) to become active before closing it. See also wait_timeout. • Commandline: --interactive-timeout=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 28800 • Range: (Windows): 1 to 2147483 • Range: (Other): 1 to 31536000 join_buffer_size • Description: Minimum size in bytes of the buffer used for queries that cannot use an index, and instead perform a full table scan. Increase to get faster full joins when adding indexes is not possible, although be aware of memory issues, since joins will always allocate the minimum size. Best left low globally and set high in sessions that require large full joins. In 64-bit platforms, Windows truncates values above 4GB to 4GB with a warning. • Commandline: --join-buffer-size=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 262144 (256kB) (>=MariaDB 10.1.7), 131072 (128kB) (<=MariaDB 10.1.6) • Range (>=MariaDB/MySQL 5.5): 128 to 18446744073709547520 • Range (<=MariaDB/MySQL 5.3, Windows): 8228 to 18446744073709547520 join_buffer_space_limit • Description: Maximum size in bytes of the query buffer, By default 1024*128*10. See Block- based join algorithms. • Commandline: --join-buffer-space-limit=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 2097152
  • 335. • Range: 2048 to 99999999997952 • Introduced: MariaDB 5.3 join_cache_level • Description: Controls which of the eight block-based algorithms can be used for join operations. See Block-based join algorithms for more information. • 1 – flat (Block Nested Loop) BNL • 2 – incremental BNL • 3 – flat Block Nested Loop Hash (BNLH) • 4 – incremental BNLH • 5 – flat Batch Key Access (BKA) • 6 – incremental BKA • 7 – flat Batch Key Access Hash (BKAH) • 8 – incremental BKAH • Commandline: --join-cache-level=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 2 • Range: 0 to 8 • Introduced: MariaDB 5.3 keep_files_on_create • Description: If a MyISAM table is created with no DATA DIRECTORY option, the .MYD file is stored in the database directory. When set to 0, the default, if MariaDB finds another .MYD file in the database directory it will overwrite it. Setting this variable to 1 means that MariaDB will return an error instead, just as it usually does in the same situation outside of the database directory. The same applies for .MYI files and no INDEX DIRECTORY option. • Commandline: --keep-files-on-create=# • Scope: Global, Session • Dynamic: Yes • Data Type: boolean • Default Value: OFF
  • 336. language • Description: Language to use for the server error messages. Either just the language name, or the directory where the error messages are stored. An alternative is to use lc_messages_dir and lc_messages instead. See Setting the language for error messages. • Commandline: --language=name, -L • Scope: Global • Dynamic: No • Data Type: directory name • Default Value: /usr/local/mysql/share/mysql/english/ large_files_support • Description: ON if the server if was compiled with large file support or not, else OFF • Scope: Global • Dynamic: No • Introduced: MySQL 3.23.28 large_page_size • Description: Indicates the size of memory page if large page support (Linux only) is enabled. The page size is determined from the Hugepagesize setting in /proc/meminfo. See large_pages. • Scope: Global • Dynamic: No • Data Type: numeric • Default Value: Autosized (see description) large_pages • Description: Indicates whether large page support (Linux only - called huge pages) is used. This is set with --large-pages or disabled with --skip-large-pages. Large pages are used for the innodb buffer pool and for online DDL (of size 3* innodb_sort_buffer_size (or 6 when encryption is used)). To use large pages, the Linux sysctl variable kernel.shmmax must be large than the llocation. Also the sysctl variable vm.nr_hugepages multipled by large-page) must be larger than the usage. The ulimit for locked memory must be sufficient to cover the amount used (ulimit -l and equalivent in /etc/security/limits.conf / or in systemd LimitMEMLOCK). If these operating system controls or insufficient free huge pages are available, the allocation of large pages will fall back to
  • 337. conventional memory allocation and a warning will appear in the logs. Only allocations of the default Hugepagesize currently occur (see /proc/meminfo). • Commandline: --large-pages, --skip-large-pages • Scope: Global • Dynamic: No • Data Type: boolean • Default Value: OFF last_insert_id • Description: Contains the same value as that returned by LAST_INSERT_ID(). Note that setting this variable doen't update the value returned by the underlying function. • Scope: Session • Dynamic: Yes • Data Type: numeric lc_messages • Description: Locale to use for error messages. This will be converted to a language name and along with lc_messages_dir will produce the location for the error message file. See locales for a list of available locales and their related languages. • Commandline: --lc-messages=name • Scope: Global, Session • Dynamic: Yes • Data Type: string • Default Value: en_us • Introduced: MariaDB 5.5 lc_messages_dir • Description: Directory where the error messages are located. Together with lc_messages will produce the location for the error message file. • Commandline: --lc-messages-dir=path • Scope: Global • Dynamic: No • Data Type: directory name • Introduced: MariaDB 5.5
  • 338. lc_time_names • Description: The locale that determines the language used for the date and time functions DAYNAME(), MONTHNAME() and DATE_FORMAT(). Locale names are language and region subtags, for example 'en_ZA' (English - South Africa) or 'es_US: Spanish - United States'. The default is always 'en-US' regardless of the system's locale setting. See server locale for a full list of supported locales. • Commandline: --lc-time-names=name • Scope: Global, Session • Dynamic: Yes • Data Type: string • Default Value: en_US license • Description: Server license, for example GPL. • Scope: Global • Dynamic: No • Data Type: string local_infile • Description: If set to 1, LOCAL is supported for LOAD DATA INFILE statements. If set to 0, usually for security reasons, attempts to perform a LOAD DATA LOCAL will fail with an error message. • Commandline: --local-infile=# • Scope: Global • Dynamic: Yes • Data Type: boolean • Default Value: ON lock_wait_timeout • Description: Timeout in seconds for attempts to acquire metadata locks. Statements using metadata locks include FLUSH TABLES WITH READ LOCK, LOCK TABLES, HANDLER and DML and DDL operations on tables, stored procedures and functions, and views. The timeout is separate for each attempt, of which there may be multiple in a single statement. 0 (from MariaDB 10.3.0) means no wait. See WAIT and NOWAIT. • Commandline: --lock-wait-timeout=# • Scope: Global, Session
  • 339. • Dynamic: Yes • Data Type: numeric • Default Value: • 86400 (1 day) >= MariaDB 10.2.4 • 31536000 (1 year) <= MariaDB 10.2.3 • Range: • 0 to 31536000 (>= MariaDB 10.3) • 1 to 31536000 (<= MariaDB 10.2) • Introduced: MariaDB 5.5 locked_in_memory • Description: Indicates whether --memlock was used to lock mysqld in memory. • Commandline: --memlock • Scope: Global • Dynamic: No • Data Type: boolean • Default Value: OFF log • Description: Deprecated and removed in MariaDB 10.0, use general_log instead. • Commandline: -l [filename] or --log[=filename] • Scope: Global • Dynamic: Yes • Data Type: string • Default Value: OFF • Deprecated: MySQL 5.1.29 and replaced by general_log • Removed: MariaDB 10.0 log_disabled_statements • Description: If set, the specified type of statements (slave or stored procedure statements) will not be logged to the general log. • Commandline: --log-disabled_statements=value • Scope: Global, Session • Dynamic: No • Data Type: set • Default Value: (empty string)
  • 340. • Valid Vales: slave and/or sp • Introduced: MariaDB 10.3.1 log_error • Description: Specifies the name of the error log. If --console is specified later in the configuration (Windows only) or this option isn't specified, errors will be logged to stderr. If no name is provided, errors will still be logged to hostname.err. • Commandline: --log-error[=name] • Scope: Global • Dynamic: No • Data Type: file name • Default Value: (empty string) log_output • Description: How the output for the general query log and the slow query log is stored. By default written to file (FILE), it can also be stored in the general_log and slow_log tables in the mysql database (TABLE), or not stored at all (NONE). More than one option can be chosen at the same time, with NONE taking precedence if present. Logs will not be written if logging is not enabled. See Writing logs into tables, and the slow_query_log and general_log server system variables. • Commandline: --log-output=name • Scope: Global • Dynamic: Yes • Data Type: set • Default Value: FILE • Valid Values: TABLE, FILE or NONE log_queries_not_using_indexes • Description: Queries that don't use an index, or that perform a full index scan where the index doesn't limit the number of rows, will be logged to the slow query log (regardless of time taken). The slow query log needs to be enabled for this to have an effect. • Commandline: --log-queries-not-using-indexes • Scope: Global • Dynamic: Yes • Data Type: boolean • Default Value: OFF
  • 341. log_slow_admin_statements • Description: Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to the slow log if it is open. Before MariaDB 10.1.13, this was only available as a mysqld option, not a server variable. See also log_slow_disabled_statements and log_slow_filter. • Commandline: --log-slow-admin-statements • Scope: Global • Dynamic: Yes • Data Type: boolean • Default Value: • ON (>= MariaDB 10.2.4) • OFF (<= MariaDB 10.2.3) • Introduced: MariaDB 10.1.13 (variable) log_slow_disabled_statements • Description: If set, the specified type of statements will not be logged to the slow query log. See also log_slow_admin_statements and log_slow_filter. • Commandline: --log-slow-disabled_statements=value • Scope: Global, Session • Dynamic: No • Data Type: set • Default Value: sp • Valid Vales: admin, call, slave and/or sp • Introduced: MariaDB 10.3.1 log_slow_filter • Description: Comma-delimited string containing one or more settings for filtering what is logged to the slow query log. If a query matches one of the types listed in the filter, and takes longer than long_query_time, it will be logged. Sets log-slow-admin-statements to ON. See also log_slow_disabled_statements. • admin log administrative queries (create, optimize, drop etc...) • filesort logs queries that use a filesort. • filesort_on_disk logs queries that perform a a filesort on disk. • filesort_priority_queue (from MariaDB 10.3.2) • full_join logs queries that perform a join without indexes. • full_scan logs queries that perform full table scans.
  • 342. • query_cache log queries that are resolved by the query cache . • query_cache_miss logs queries that are not found in the query cache. • tmp_table logs queries that create an implicit temporary table. • tmp_table_on_disk logs queries that create a temporary table on disk. • Commandline: log-slow-filter=value1[,value2...] • Scope: Global, Session • Dynamic: Yes • Data Type: enumeration • Default Value: • admin, filesort, filesort_on_disk, full_join, full_scan, query_cache, query_cache_miss, tmp_table, tmp_table_on_disk (<= MariaDB 10.3.0) • admin, filesort, filesort_on_disk, filsort_priority_queue, full_join, full_scan, query_cache, query_cache_miss, tmp_table, tmp_table_on_disk (>= MariaDB 10.3.1) • Valid Values: admin, filesort, filesort_on_disk, filsort_priority_queue, full_join, full_scan, query_cache, query_cache_miss, tmp_table, tmp_table_on_disk log_slow_queries • Description: Deprecated and removed in MariaDB 10.0, use slow_query_log instead. • Commandline: --log-slow-queries[=name] • Scope: Global • Dynamic: Yes • Data Type: boolean • Default Value: OFF • Deprecated: MySQL 5.1.29 • Removed: MariaDB 10.0/MySQL 5.6.1 log_slow_rate_limit • Description: The slow query log will log every this many queries. The default is 1, or every query, while setting it to 20 would log every 20 queries, or five percent. Aims to reduce I/O usage and excessively large slow query logs. See also Slow Query Log Extended Statistics. • Commandline: log-slow-rate-limit=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric
  • 343. • Default Value: 1 • Range: 1 upwards • Introduced: MariaDB 5.1 log_slow_verbosity • Description: Controls information to be added to the slow query log. Options are added in a comma-delimited string. See also Slow Query Log Extended Statistics. • query_plan logs query execution plan information • innodb an unused Percona XtraDB option for logging XtraDB/InnoDB statistics. • explain prints EXPLAIN output in the slow query log. See EXPLAIN in the Slow Query Log. (added in MariaDB 10.0.5) • Commandline: log-slow-verbosity=value1[,value2...] • Scope: Global, Session • Dynamic: Yes • Data Type: enumeration • Default Value: (Empty) • Valid Values: (Empty), query_plan, innodb, explain (from MariaDB 10.0.5) • Introduced: MariaDB 5.1 log_tc_size • Description: Size in bytes of the transaction coordinator log, defined in multiples of 4096. Always available as a commandline option, but added as a variable in MariaDB 10.1.3 • Commandline: log-tc-size=# • Scope: Global • Dynamic: No • Data Type: numeric • Default Value: 24576 • Range: 12288 to 18446744073709551615 • Introduced: MariaDB 10.1.3 (variable) log_warnings • Description: If set to 1, the default, all critical warnings are logged to the error log. Slave servers also log status information, including the binary log and relay log co-ordinates where they start replicating from, reconnects after a disconnect and when the slave switches to a new relay-log. If set to 0, warnings are not logged. If set to a number greater than 1, aborted connections and access-denied errors are also logged. Specifically, the following are logged:
  • 344. • log_warnings >= 1 • Events_scheduler info and warnings • Access denied errors • Connections that were forced to be closed or aborted • System signals • Wrong usage of --user • Failed setrlimit() and mlockall() • Changed limits • Wrong values of lower_case_table_names and stack_size • Wrong values for command line options • Start log position and some master information when starting slaves • Slave reconnects • Killed slaves • Error reading relay logs • Before MariaDB 10.0.14: Statements that were unsafe to log as statement-based (when BINLOG_FLAG_UNSAFE_STMT_PRINTED is also set) • Disabled plugins that one tried to enable or use • UDF files that didn't include the required init functions. • log_warnings >= 2 • Table handler errors • Starting from MariaDB 10.0.14: Statements that were unsafe to log as statement- based (when BINLOG_FLAG_UNSAFE_STMT_PRINTED is also set) • log_warnings >= 3 • All errors and warnings during MyISAM repair and auto recover. • log_warnings >=4 • Too many connections errors. • Commandline: -W [level] or --log-warnings[=level] • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: • 2 (>= MariaDB 10.2.4) • 1 (<= MariaDB 10.2.3) • Range: 0 to 4294967295 long_query_time • Description: If a query takes longer than this many seconds to execute (microseconds can be specified too), the Slow_queries status variable is incremented and, if enabled, the query is logged to the slow query log.
  • 345. • Commandline: --long-query-time=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 10.000000 >= MariaDB 10.1.13, 10 <= MariaDB 10.1.12 • Range: 0 upwards low_priority_updates • Description: If set to 1 (0 is the default), for storage engines that use only table-level locking (Aria, MyISAM, MEMORY and MERGE), all INSERTs, UPDATEs, DELETEs and LOCK TABLE WRITEs will wait until there are no more SELECTs or LOCK TABLE READs pending on the relevant tables. Set this to 1 if reads are prioritized over writes. Previously named sql_low_priority_updates, which is still a synonym. • Commandline: --low-priority-updates • Scope: Global, Session • Dynamic: Yes • Data Type: boolean • Default Value: 0 lower_case_file_system • Description: Read-only variable describing whether the file system is case-sensitive. If set to OFF, file names are case-sensitive. If set to ON, they are not case-sensitive. • Scope: Global • Dynamic: No • Data Type: boolean • Default Value: ## lower_case_table_names • Description: If set to 0 (the default on Unix-based systems), table names and aliases and database names are compared in a case-sensitive manner. If set to 1 (the default on Windows), names are stored in lowercase and not compared in a case-sensitive manner. If set to 2 (the default on Mac OS X), names are stored as declared, but compared in lowercase. • Commandline: --lower-case-table-names[=#] • Scope: Global • Dynamic: No • Data Type: numeric
  • 346. • Default Value: 0 (Unix), 1 (Windows), 2 (Mac OS X) • Range: 0 to 2 max_allowed_packet • Description: Maximum size in bytes of a packet or a generated/intermediate string. The packet message buffer is initialized with the value from net_buffer_length, but can grow up to max_allowed_packet bytes. Set as large as the largest BLOB, in multiples of 1024. If this value is changed, it should be changed on the client side as well. See slave_max_allowed_packet for a specific limit for replication purposes. • Commandline: --max-allowed-packet=# • Scope: Global, Session • Dynamic: Yes (Global), No (Session) • Data Type: numeric • Default Value: • 16777216 (16M) >= MariaDB 10.2.4 • 4194304 (4M) >= MariaDB 10.1.7 • 1048576 (1MB) <= MariaDB 10.1.6 • 1073741824 (1GB) (client-side) • Range: 1024 to 1073741824 max_connect_errors • Description: Limit to the number of successive failed connects from a host before the host is blocked from making further connections. The count for a host is reset to zero if they successfully connect. To unblock, flush the host cache with a FLUSH HOSTS statement or mysqladmin flush-hosts. • Commandline: --max-connect-errors=# • Scope: Global • Dynamic: Yes • Data Type: numeric • Default Value: 100 (from MariaDB 10.0), 10 (before MariaDB 10.0) max_connections • Description: The maximum number of simultaneous client connections. See also Handling Too Many Connections. Note that this value affects the number of file descriptors required on the operating system. • Commandline: --max-connections=#
  • 347. • Scope: Global • Dynamic: Yes • Data Type: numeric • Default Value: 151 • Range: 1 to 100000 max_delayed_threads • Description: Limits to the number of INSERT DELAYED threads. Once this limit is reached, the insert is handled as if there was no DELAYED attribute. If set to 0, DELAYED is ignored entirely. The session value can only be set to 0 or to the same as the global value. • Commandline: --max-delayed-threads=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 20 • Range: 0 to 16384 max_digest_length • Description: Maximum length considered for computing a statement digest, such as used by the Performance Schema and query rewrite plugins. Statements that differ after this many bytes produce the same digest, and are aggregated for statistics purposes. The variable is allocated per session. Increasing will allow longer statements to be distinguished from each other, but increase memory use, while decreasing will reduce memory use, but more statements may become indistinguishable. • Commandline: --max-digest-length=# • Scope: Global, • Dynamic: Yes • Data Type: numeric • Default Value: 1024 • Range: 0 to 1048576 • Introduced: MariaDB 10.1.5 max_error_count • Description: Specifies the maximum number of messages stored for display by SHOW ERRORS and SHOW WARNINGS statements. • Commandline: --max-error-count=#
  • 348. • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 64 • Range: 0 to 65535 max_heap_table_size • Description: Maximum size in bytes for user-created MEMORY tables. Setting the variable while the server is active has no effect on existing tables unless they are recreated or altered. The smaller of max_heap_table_size and tmp_table_size also limits internal in-memory tables. When the maximum size is reached, any further attempts to insert data will receive a "table ... is full" error. Temporary tables created with CREATE TEMPORARY will not be converted to Aria, as occurs with internal temporary tables, but will also receive a table full error. • Commandline: --max-heap-table-size=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 16777216 • Range : 16384 to 4294966272 max_insert_delayed_threads • Description: Synonym for max_delayed_threads. max_join_size • Description: Statements will not be performed if they are likely to need to examine more than this number of rows, row combinations or do more disk seeks. Can prevent poorly-formatted queries from taking server resources. Changing this value to anything other the default will reset sql_big_selects to 0. If sql_big_selects is set again, max_join_size will be ignored. This limit is also ignored if the query result is sitting in the query cache. Previously named sql_max_join_size, which is still a synonym. • Commandline: --max-join-size=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 18446744073709551615 (>= MariaDB/MySQL 5.5.0), 4294967295 (< MariaDB/MySQL 5.5.0)
  • 349. • Range: 1 to 18446744073709551615 (>= MariaDB/MySQL 5.5.0), 1 to 4294967295 (< MariaDB/MySQL 5.5.0) max_length_for_sort_data • Description: Used to decide which algorithm to choose when sorting rows. If the total size of the column data, not including columns that are part of the sort, is less than max_length_for_sort_data, then we add these to the sort key. This can speed up the sort as we don't have to re-read the same row again later. Setting the value too high can slow things down as there will be a higher disk activity for doing the sort. • Commandline: --max-length-for-sort-data=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 1024 • Range: 4 to 8388608 max_long_data_size • Description: Maximum size for parameter values sent with mysql_stmt_send_long_data(). If not set, will default to the value of max_allowed_packet. Deprecated; use max_allowed_packet instead. • Commandline: --max-long-data-size=# • Scope: Global • Dynamic: No • Data Type: numeric • Default Value: • 16777216 (16M) >= MariaDB 10.2.4 • 4194304 (4M) <= MariaDB 10.2.3, >= MariaDB 10.1.7 • 1048576 (1M) <= MariaDB 10.1.6 • Range: 1024 to 4294967295 • Introduced: MariaDB 5.5 • Deprecated: MariaDB 5.5 max_prepared_stmt_count • Description: Maximum number of prepared statements on the server. Can help prevent certain forms of denial-of-service attacks. If set to 0, no prepared statements are permitted on the server.
  • 350. • Commandline: --max-prepared-stmt-count=# • Scope: Global • Dynamic: Yes • Data Type: numeric • Default Value: 16382 • Range: 0 to 4294967295 (>= MariaDB 10.3.6), 0 to 1048576 (<= MariaDB 10.3.5) max_recursive_iterations • Description: Maximum number of iterations when executing recursive queries. • Commandline: --max-recursive-iterations=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 4294967295 • Range: 0 to 4294967295 • Introduced: MariaDB 10.2.2 max_seeks_for_key • Description: The optimizer assumes that the number specified here is the most key seeks required when searching with an index, regardless of the actual index cardinality. If this value is set lower than its default and maximum, indexes will tend to be preferred over table scans. • Commandline: --max-seeks-for-key=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 4294967295 • Range: 1 to 4294967295 max_session_mem_used • Description: Amount of memory a single user session is allowed to allocate. This limits the value of the session variable MEM_USED. • Commandline: --max-session-mem-used=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 9223372036854775807 (8.6GB)
  • 351. • Range: 8192 to 18446744073709551615 • Introduced: MariaDB 10.1.21 max_sort_length • Description: Maximum size in bytes used for sorting data values - anything exceeding this is ignored. • Commandline: --max-sort-length=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 1024 • Range: 4 to 8388608 max_sp_recursion_depth • Description: Permitted number of recursive calls for a stored procedure. 0, the default, no recursion is permitted. Increasing this value increases the thread stack requirements, so you may need to increase thread_stack as well. This limit doesn't apply to stored functions. • Commandline: --max-sp-recursion-depth[=#] • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 0 • Range: 0 to 255 max_statement_time • Description: Maximum time in seconds that a query can execute before being aborted. This includes all queries, not just SELECT statements, but excludes statements in stored procedures. If set to 0, no limit is applied. See Aborting statements that take longer than a certain time to execute. Useful when combined with SET STATEMENT for limiting the execution times of individual queries. • Commandline: --max-statement-time[=#] • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 0.000000 >= MariaDB 10.1.13, 0 <= MariaDB 10.1.12 • Range: 0 upwards
  • 352. • Introduced: MariaDB 10.1.1 max_tmp_tables • Description: Unused. max_user_connections • Description: Maximum simultaneous connections permitted for each user account. When set to 0, there is no per user limit. From MariaDB 5.3, setting it to -1 stops users without the SUPER privilege from connecting to the server. The session variable is always read-only and only privileged users can modify user limits. The session variable defaults to the global max_user_connections variable, unless the user's specific MAX_USER_CONNECTIONS resource option is non-zero. When both global variable and the user resource option are set, the user's MAX_USER_CONNECTIONS is used. Note: This variable does not affect users with the SUPER privilege. • Commandline: --max-user-connections=# • Scope: Global, Session • Dynamic: Yes, (except when globally set to 0 or -1) • Data Type: numeric • Default Value: 0 • Range: -1 to 4294967295 max_write_lock_count • Description: Read lock requests will be permitted for processing after this many write locks. Applies only to storage engines that use table level locks (thr_lock), so no effect with InnoDB/XtraDB or Archive. • Commandline: --max-write-lock-count=# • Scope: Global • Dynamic: No • Data Type: numeric • Default Value: 4294967295 • Range: 0-4294967295
  • 353. metadata_locks_cache_size • Description: Size of the metadata locks cache, used for reducing the need to create and destroy synchronization objects. It is particularly helpful on systems where this process is inefficient, such as Windows XP. • Commandline: --metadata-locks-cache-size=# • Scope: Global • Dynamic: No • Data Type: numeric • Default Value: 1024 • Range: 1 to 1048576 • Introduced: MariaDB 5.5 metadata_locks_hash_instances • Description: Number of hashes used by the set of metadata locks. The metadata locks are partitioned into separate hashes in order to reduce contention. • Commandline: --metadata-locks-hash-instances=# • Scope: Global • Dynamic: No • Data Type: numeric • Default Value: 8 • Range: 1 to 1024 • Introduced: MariaDB 10.0 min_examined_row_limit • Description: If a query examines more than this number of rows, it is logged to the slow-query- log. If set to 0, the default, no row limit is used. • Commandline: --min-examined-row-limit=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 0 • Range: 0-4294967295 mrr_buffer_size • Description: Size of buffer to use when using multi-range read with range access. See Multi Range Read optimization for more information.
  • 354. • Commandline: --mrr-buffer-size=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 262144 • Range 8192 to 2147483648 • Introduced: MariaDB 5.3 multi_range_count • Description: Deprecated in 5.1 and ignored from MariaDB 5.3. Use mrr_buffer_size instead. • Default Value: 256 • Deprecated: MariaDB 5.1 mysql56_temporal_format • Description: If set (the default), MariaDB uses the MySQL 5.6 low level formats for TIME, DATETIME and TIMESTAMP instead of the MariaDB 5.3 version. The version MySQL introduced in 5.6 requires more storage, but potentially allows negative dates and has some advantages in replication. There should be no reason to revert to the old MariaDB 5.3 microsecond format. See also MDEV-10723. • Commandline: --mysql56-temporal-format • Scope: Global • Dynamic: No • Data Type: boolean • Default Value: ON • Introduced: MariaDB 10.1.2 named_pipe • Description: On Windows systems, determines whether connections over named pipes are permitted. • Commandline: --enable-named-pipe • Scope: Global • Dynamic: No • Data Type: boolean • Default Value: OFF
  • 355. net_buffer_length • Description: The starting size, in bytes, for the connection and thread buffers for each client thread. The size can grow to max_allowed_packet. This variable's session value is read-only. Can be set to the expected length of client statements if memory is a limitation. • Commandline: --net-buffer-length=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 16384 • Range: 1024 to 1048576 net_read_timeout • Description: Time in seconds the server will wait for a client connection to send more data before aborting the read. See also net_write_timeout and slave_net_timeout • Commandline: --net-read-timeout=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 30 • Range: 1 upwards net_retry_count • Description: Permit this many retries before aborting when attempting to read or write on a communication port. On FreeBSD systems should be set higher as threads are sent internal interrupts.. • Commandline: --net-retry-count=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 10 • Range: 1 to 4294967295 net_write_timeout • Description: Time in seconds to wait on writing a block to a connection before aborting the write. See also net_read_timeout and slave_net_timeout. • Commandline: --net-write-timeout=#
  • 356. • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 60 • Range: 1 upwards old • Description: Disabled by default, enabling it reverts index hints to those used before MySQL 5.1.17. Enabling may lead to replication errors. Being replaced by old_mode. Before MariaDB 5.5, the variable was read-only and global in scope only. • Commandline: --old • Scope: Global, Session • Dynamic: Yes • Data Type: boolean • Default Value: OFF old_alter_table • Description: From MariaDB 10.3.7, an alias for alter_algorithm. Prior to that, if set to 1 (0 is default), MariaDB reverts to the non-optimized, pre-MySQL 5.1, method of processing ALTER TABLE statements. A temporary table is created, the data is copied over, and then the temporary table is renamed to the original. • Commandline: --old-alter-table • Scope: Global, Session • Dynamic: Yes • Data Type: enumerated (>=MariaDB 10.3.7), boolean (<= MariaDB 10.3.6) • Default Value: See alter_algorithm (>= MariaDB 10.3.7), 0 (<= MariaDB 10.3.6) • Valid Values: See alter_algorithm for the full list. • Deprecated: MariaDB 10.3.7 (superceded by alter_algorithm) old_mode • Description: Used for getting MariaDB to emulate behavior from an old version of MySQL or MariaDB. See OLD Mode. Will be used to replace the old variable over time. • Commandline: --old-mode • Scope: Global, Session • Dynamic: Yes • Data Type: string
  • 357. • Default Value: (empty string) • Introduced: MariaDB 5.5.35 • Valid Values: See OLD Mode for the full list. old_passwords • Description: If set to 1 (0 is default), MariaDB reverts to the pre-MySQL 4.1 form of password hashing. • Scope: Global, Session • Dynamic: Yes • Data Type: boolean • Default Value: OFF open_files_limit • Description: The number of file descriptors available to mysqld. Increase if you are getting the Too many open files error. If set to 0, then mysqld will reserve max_connections*5 or max_connections + table_open_cache*2 (whichever is larger) number of files. Note that MariaDB cannot set this to exceed the hard limit imposed by the operating system, and you may need to change this. For example, by adding the following lines to /etc/security/limits.conf mysql soft nofile 65535 mysql hard nofile 65535 rebooting, and then create /etc/systemd/system/mysqld.service.d/filelimit.conf or /etc/systemd/system/mariadb.service.d/filelimit.conf (corresponding to the service name). [Service] LimitNOFILE=infinity • Commandline: --open-files-limit=count • Scope: Global • Dynamic: No • Data Type: numeric • Default Value: Autosized (see description) • Range: 0 to 4294967295
  • 358. optimizer_prune_level • Description: If set to 1, the default, the optimizer will use heuristics to prune less-promising partial plans from the optimizer search space. If set to 0, heuristics are disabled and an exhaustive search is performed. • Commandline: --optimizer-prune-level[=#] • Scope: Global, Session • Dynamic: Yes • Data Type: boolean • Default Value: 1 optimizer_search_depth • Description: Maximum search depth by the query optimizer. Smaller values lead to less time spent on execution plans, but potentially less optimal results. If set to 0, MariaDB will automatically choose a reasonable value. Since the better results from more optimal planning usually offset the longer time spent on planning, this is set as high as possible by default. 63 is a valid value, but its effects (switching to the original find_best search) are deprecated. • Commandline: --optimizer-search-depth[=#] • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 62 • Range: 0 to 63 optimizer_selectivity_sampling_limit • Description: Controls number of record samples to check condition selectivity • Commandline: optimizer-selectivity-sampling-limit[=#] • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 100 • Range: 10 upwards • Introduced: MariaDB 10.0 optimizer_switch • Description: A series of flags for controlling the query optimizer. See Optimizer Switch for defaults, and a comparison to MySQL.
  • 359. • Commandline: --optimizer-switch=value • Scope: Global, Session • Dynamic: Yes • Data Type: string • Valid Values: • condition_pushdown_for_derived={on|off} (>=MariaDB 10.2.2) • default - set all optimizations to their default values. • derived_merge={on|off} (>=MariaDB 5.3) - see Derived table merge optimization • derived_with_keys={on|off} (>=MariaDB 5.3) - see Derived table with key optimization • engine_condition_pushdown={on|off} (>=MariaDB 5.5). Deprecated in MariaDB 10.1.1 as engine condition pushdown is now automatically enabled for all engines that support it. • exists_to_in={on|off} (>=MariaDB 10.0) - see EXISTS-to-IN optimization • extended_keys={on|off} (>= MariaDB 5.5) - see Extended Keys • firstmatch={on|off} (>=MariaDB 5.3) - see First Match Strategy • index_condition_pushdown={on|off} (>=MariaDB 5.3) - see Index Condition Pushdown • index_merge={on|off} • index_merge_intersection={on|off} • index_merge_sort_intersection={on|off} (>=MariaDB 5.3) - more details • index_merge_sort_union={on|off} • index_merge_union={on|off} • in_to_exists={on|off} (>=MariaDB 5.3) - see IN-TO-EXISTS transformation • join_cache_bka={on|off} (>=MariaDB 5.3) - see Block-Based Join Algorithms • join_cache_hashed={on|off} (>=MariaDB 5.3) - see Block-Based Join Algorithms • join_cache_incremental={on|off} (>=MariaDB 5.3) - see Block-Based Join Algorithms • loosescan={on|off} (>=MariaDB 5.3) - see LooseScan strategy • materialization={on|off} (>=MariaDB 5.3) - Semi-join and non semi-join materialization. • mrr={on|off} (>=MariaDB 5.3) - see Multi Range Read optimization • mrr_cost_based={on|off} (>=MariaDB 5.3) - see Multi Range Read optimization • mrr_sort_keys={on|off} (>=MariaDB 5.3) - see Multi Range Read optimization
  • 360. • optimize_join_buffer_size={on|off} (>=MariaDB 5.3) - see Block-Based Join Algorithms • orderby_uses_equalities={on|off} (>= MariaDB 10.1.15, MariaDB 10.2.1) - if not set, the optimizer ignores equality propagation. See MDEV-8989. • outer_join_with_cache={on|off} (>=MariaDB 5.3) - see Block-Based Join Algorithms • partial_match_rowid_merge={on|off} (>= MariaDB 5.3) - see Non-semi- join subquery optimizations • partial_match_table_scan={on|off} (>= MariaDB 5.3) - see Non-semi-join subquery optimizations • semijoin={on|off} (>=MariaDB 5.3) - see Semi-join subquery optimizations • semijoin_with_cache={on|off} (>=MariaDB 5.3) - see Block-Based Join Algorithms • subquery_cache={on|off} (>=MariaDB 5.5) - see subquery cache. • table_elimination={on|off} (>=MariaDB 5.3) - see Table Elimination User Interface optimizer_use_condition_selectivity • Description: Controls which statistics can be used by the optimizer when looking for the best query execution plan. • 1 Use selectivity of predicates as in MariaDB 5.5. • 2 Use selectivity of all range predicates supported by indexes. • 3 Use selectivity of all range predicates estimated without histogram. • 4 Use selectivity of all range predicates estimated with histogram. • 5 Additionally use selectivity of certain non-range predicates calculated on record sample. • Commandline: --optimizer-use-condition-selectivity=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 1 • Range: 1 to 5 • Introduced: MariaDB 10.0
  • 361. pam_use_cleartext_plugin • Description: Use mysql_cleartext_plugin on the client side instead of the dialog plugin. This may be needed for compatibility reasons, but it only supports simple PAM policies that don't require anything besides a password. See PAM Authentication Plugin. • Commandline: <<code>>--pam-use-cleartext-plugin</code>> • Scope: Global • Dynamic: No • Data Type: boolean • Default Value: OFF • Introduced: MariaDB 10.1.3 (default) pid_file • Description: Full path of the process ID file. • Commandline: --pid-file=file_name • Scope: Global • Dynamic: No • Data Type: file name plugin_dir • Description: Path to the plugin directory. For security reasons, either make sure this directory can only be read by the server, or set secure_file_priv. • Commandline: --plugin-dir=path • Scope: Global • Dynamic: No • Data Type: directory name • Default Value: BASEDIR/lib/plugin • Introduced: MariaDB 5.5 plugin_maturity • Description: The lowest acceptable plugin maturity. MariaDB will not load plugins less mature than that. • Commandline: --plugin-maturity=level • Scope: Global • Dynamic: No • Type: enum
  • 362. • Default Value: One less than the server maturity (>= MariaDB 10.3.3), unknown (<= MariaDB 10.3.2) • Valid Values: unknown, experimental, alpha, beta, gamma, stable • Introduced: MariaDB 5.2.1 port • Description: Port to listen for TCP/IP connections. If set to 0, will default to, in order of preference, my.cnf, the MYSQL_TCP_PORT environment variable, /etc/services, built-in default (3306). • Commandline: --port=#, -P • Scope: Global • Dynamic: No • Data Type: numeric • Default Value: 3306 • Range: 0 to 65535 preload_buffer_size • Description: Size in bytes of the buffer allocated when indexes are preloaded. • Commandline: --preload-buffer-size=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 32768 • Range: 1024 to 1073741824 profiling • Description: If set to 1 (0 is default), statement profiling will be enabled. See SHOW PROFILES() and SHOW PROFILE(). • Scope: Global, Session • Dynamic: Yes • Data Type: boolean • Default Value: OFF
  • 363. profiling_history_size • Description: Number of statements about which profiling information is maintained. If set to 0, no profiles are stored. See SHOW PROFILES. • Commandline: --profiling-history-size=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 15 • Range: 0 to 100 progress_report_time • Description: Time in seconds between sending progress reports to the client for time- consuming statements. If set to 0, progress reporting will be disabled. • Commandline: --progress-report-time=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 56 before MariaDB 5.5.39 and MariaDB 10.0.10, 5 as of MariaDB 5.5.40 and MariaDB 10.0.11 • Range: 0 to 4294967295 • Introduced: MariaDB 5.3 protocol_version • Description: The version of the client/server protocol used by the MariaDB server. • Commandline: None • Scope: Global • Dynamic: No • Data Type: numeric • Default Value: 10 • Range: 0 to 4294967295 proxy_protocol_networks • Description: Enable proxy protocol for these source networks. The syntax is a comma separated list of IPv4 and IPv6 networks. If the network doesn't contain a mask, it is considered to be a single host. "*" represents all networks and must be the only directive on the line. String
  • 364. "localhost" represents non-TCP local connections (Unix domain socket, Windows named pipe or shared memory). See Proxy Protocol Support. • Commandline: --proxy-protocol-networks=value • Scope: Global • Dynamic: Yes (>= MariaDB 10.3.6), No (<= MariaDB 10.3.5) • Data Type: string • Default Value: (empty) • Introduced: MariaDB 10.3.1 proxy_user • Description: Set to the proxy user account name if the current client is a proxy, else NULL. • Scope: Session • Dynamic: No • Data Type: string • Introduced: MariaDB 5.5.20 pseudo_slave_mode • Description: For internal use by the server. • Scope: Session • Dynamic: Yes • Data Type: numeric • Default Value: OFF • Introduced: MariaDB/MySQL 5.5.30 pseudo_thread_id • Description: For internal use only. • Scope: Session • Dynamic: Yes • Data Type: numeric query_alloc_block_size • Description: Size in bytes of the extra blocks allocated during query parsing and execution (after query_prealloc_size is used up). • Commandline: --query-alloc-block-size=# • Scope: Global, Session
  • 365. • Dynamic: Yes • Data Type: numeric • Default Value: 16384 (from MariaDB 10.1.2), 8192 (before MariaDB 10.1.2) • Range: 1024 to 4294967295 query_cache_limit • Description: Size in bytes for which results larger than this are not stored in the query cache. • Commandline: --query-cache-limit=# • Scope: Global • Dynamic: Yes • Data Type: numeric • Default Value: 1048576 (1MB) • Range: 0 to 4294967295 query_cache_min_res_unit • Description: Minimum size in bytes of the blocks allocated for query cache results. • Commandline: --query-cache-min-res-unit=# • Scope: Global • Dynamic: Yes • Data Type: numeric • Default Value: 4096 (4KB) • Range: 0 to 4294967295 query_cache_size • Description: Size in bytes available to the query cache. About 40KB is needed for query cache structures, so setting a size lower than this will result in a warning. 0, the default before MariaDB 10.1.7, effectively disables the query cache. Starting from MariaDB 10.1.7, query_cache_type is automatically set to ON if the server is started with the query_cache_size set to a non-zero (and non-default) value. • Commandline: --query-cache-size=# • Scope: Global • Dynamic: Yes • Data Type: numeric • Default Value: 1M (>= MariaDB 10.1.7), 0 (<= MariaDB 10.1.6) (although frequently given a default value in some setups) • Valid Values: 0 upwards in units of 1024.
  • 366. query_cache_strip_comments • Description: If set to 1 (0 is default), the server will strip any comments from the query before searching to see if it exists in the query cache. Multiple space, line feeds, tab and other white space characters will also be removed. • Commandline: query-cache-strip-comments • Scope: Session (from MariaDB 5.5.20), Global • Dynamic: Yes • Data Type: boolean • Default Value: OFF query_cache_type • Description: If set to 0, the query cache is disabled (although a buffer of query_cache_size bytes is still allocated). If set to 1 all SELECT queries will be cached unless SQL_NO_CACHE is specified. If set to 2 (or DEMAND), only queries with the SQL CACHE clause will be cached. Note that if the server is started with the query cache disabled, it cannot be enabled at runtime. Starting from MariaDB 10.1.7, query_cache_type is automatically set to ON if the server is started with the query_cache_size set to a non-zero (and non-default) value. • Commandline: --query-cache-type=# • Scope: Global, Session • Dynamic: Yes • Data Type: enumeration • Default Value: OFF (>= MariaDB 10.1.7), ON (<= MariaDB 10.1.6) • Valid Values: 0 or OFF, 1 or ON, 2 or DEMAND query_cache_wlock_invalidate • Description: If set to 0, the default, results present in the query cache will be returned even if there's a write lock on the table. If set to 1, the client will first have to wait for the lock to be released. • Commandline: --query-cache-wlock-invalidate • Scope: Global, Session • Dynamic: Yes • Data Type: boolean • Default Value: OFF
  • 367. query_prealloc_size • Description: Size in bytes of the persistent buffer for query parsing and execution, allocated on connect and freed on disconnect. Increasing may be useful if complex queries are being run, as this will reduce the need for more memory allocations during query operation. See also query_alloc_block_size. • Commandline: --query-prealloc-size=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 24576 (from MariaDB 10.1.2) 8192 (before MariaDB 10.1.2) • Range: 1024 to 4294967295 (from MariaDB 10.1.2), 8192 to 4294967295 (before MariaDB 10.1.2) rand_seed1 • Description: rand_seed1 and rand_seed2 facilitate replication of the RAND() function. The master passes the value of these to the slaves so that the random number generator is seeded in the same way, and generates the same value, on the slave as on the master. Until MariaDB 10.1.4, the variable value could not be viewed, with the SHOW VARIABLES output always displaying zero. • Commandline: None • Scope: Session • Dynamic: Yes • Data Type: numeric • Default Value: Varies • Range: 0 to 18446744073709551615 rand_seed2 • Description: See rand_seed1. range_alloc_block_size • Description: Size in bytes of blocks allocated during range optimization. The unit size in 1024. • Commandline: --range-alloc-block-size=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 4096
  • 368. • Range - 32 bit: 4096 to 4294967295 read_buffer_size • Description: Each thread performing a sequential scan (for MyISAM, Aria and MERGE tables) allocates a buffer of this size in bytes for each table scanned. Increase if you perform many sequential scans. If not in a multiple of 4KB, will be rounded down to the nearest multiple. Also used in ORDER BY's for caching indexes in a temporary file (not temporary table), for caching results of nested queries, for bulk inserts into partitions, and to determine the memory block size of MEMORY tables. • Commandline: --read-buffer-size=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 131072 • Range: 8200 to 2147479552 read_only • Description: When set to 1 (0 is default), no updates are permitted except from users with the SUPER privilege or slave servers updating from a master. The read_only variable is useful for slave servers to ensure no updates are accidentally made outside of what are performed on the master. Inserting rows to log tables, updates to temporary tables and OPTIMIZE or ANALYZE TABLE statements are excluded from this limitation. From MariaDB 5.5, if read_only is set to 1, SET PASSWORD is limited only to users with the SUPER privilege. Attempting to set this variable to 1 will fail if the current session has table locks or transactions pending, while if other sessions hold table locks, the statement will wait until these locks are released before completing. While the attempt to set read_only is waiting, other requests for table locks or transactions will also wait until read_only has been set. • Commandline: --read-only • Scope: Global • Dynamic: Yes • Data Type: boolean • Default Value: OFF
  • 369. read_rnd_buffer_size • Description: Size in bytes of the buffer used when reading rows from a MyISAM table in sorted order after a key sort. Larger values improve ORDER BY performance, although rather increase the size by SESSION where the need arises to avoid excessive memory use. • Commandline: --read-rnd-buffer-size=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 262144 • Range: 8200 to 2147483647 - - rowid_merge_buff_size • Description: The maximum size in bytes of the memory available to the Rowid-merge strategy. See Non-semi-join subquery optimizations for more information. • Commandline: --rowid-merge-buff-size=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 8388608 • Range: 0 to 2147483647 • Introduced: MariaDB 5.3.0 rpl_recovery_rank • Description: Unused. • Removed: MariaDB 10.1.2 safe_show_database • Description: This variable was removed in MariaDB 5.5, and has been replaced by the more flexible SHOW DATABASES privilege. • Commandline: --safe-show-database (until MySQL 4.1.1) • Scope: Global • Dynamic: Yes • Data Type: boolean
  • 370. • Removed: MariaDB 5.5 secure_auth • Description: Connections will be blocked unless clients use the current password format. Prior to MySQL 4.1 passwords used an old, less secure format.. For the mysql client, the -- secure-auth option blocks connections to servers requiring the old format. The server will also fail to start if the privilege tables are in the old, pre-MySQL 4.1 format. • Commandline: --secure-auth • Scope: Global • Dynamic: Yes • Data Type: boolean • Default Value: ON (>= MariaDB 10.1.7), OFF (<= MariaDB 10.1.6) secure_file_priv • Description: LOAD DATA, SELECT ... INTO and LOAD FILE() will only work with files in the specified path. If not set, the default, the statements will work with any files that can be accessed. • Commandline: --secure-file-priv=path • Scope: Global • Dynamic: No • Data Type: path name • Default Value: None secure_timestamp • Description: Restricts direct setting of a session timestamp. Possible levels are: • YES - timestamp cannot deviate from the system clock • REPLICATION - replication thread can adjust timestamp to match the master's • SUPER - a user with this privilege and a replication thread can adjust timestamp • NO - historical behavior, anyone can modify session timestamp • Commandline: --secure-timestamp=value • Scope: Global • Dynamic: No • Data Type: enum • Default Value: NO • Introduced: MariaDB 10.3.7
  • 371. session_track_schema • Description: Whether to track changes to the default schema within the current session. • Commandline: --session-track-schema={0|1} • Scope: Global, Session • Dynamic: Yes • Data Type: boolean • Default Value: ON • Introduced: MariaDB 10.2.2 session_track_state_change • Description: Whether to track changes to the session state. • Commandline: --session-track-state-change={0|1} • Scope: Global, Session • Dynamic: Yes • Data Type: boolean • Default Value: OFF • Introduced: MariaDB 10.2.2 session_track_system_variables • Description: Comma-separated list of session system variables for which to track changes. In MariaDB 10.2, by default no variables are tracked. For compatibility with MySQL defaults, this variable should be set to "autocommit, character_set_client, character_set_connection, character_set_results, time_zone" (the default from MariaDB 10.3.1). The * character tracks all session variables. • Commandline: --session-track-system-variables=value • Scope: Global, Session • Dynamic: Yes • Data Type: string • Default Value: autocommit, character_set_client, character_set_connection, character_set_results, time_zone (>= MariaDB 10.3.1), empty string (<= MariaDB 10.3.0) • Introduced: MariaDB 10.2.2 session_track_transaction_info • Description: Track changes to the transaction attributes. OFF to disable; STATE to track just transaction state (Is there an active transaction? Does it have any data? etc.);
  • 372. CHARACTERISTICS to track transaction state and report all statements needed to start a transaction with the same characteristics (isolation level, read only/read write,snapshot - but not any work done / data modified within the transaction). • Commandline: --session-track-transaction-info=value • Scope: Global, Session • Dynamic: Yes • Data Type: enum • Default Value: OFF • Valid Values: OFF, STATE, CHARACTERISTICS • Introduced: MariaDB 10.2.2 shared_memory • Description: Windows only, determines whether the server permits shared memory connections. See also shared_memory_base_name. • Scope: Global • Dynamic: No shared_memory_base_name • Description: Windows only, specifies the name of the shared memory to use for shared memory connection. Mainly used when running more than one instance on the same physical machine. By default the name is MYSQL and is case sensitive. See also shared_memory. • Scope: Global • Dynamic: No • Data Type: string • Default Value: MYSQL skip_external_locking • Description: If set, external locking for MyISAM tables is disabled. • Commandline: --skip-external-locking • Scope: Global • Dynamic: No • Data Type: boolean • Default Value: 1
  • 373. skip_name_resolve • Description: If set to 1 (0 is the default), only IP addresses are used for connections. Host names are not resolved. All host values in the GRANT tables must be IP addresses (or localhost). • Commandline: --skip-name-resolve • Scope: Global • Dynamic: No • Data Type: boolean • Default Value: 0 skip_networking • Description: If set to 1, (0 is the default), the server does not listen for TCP/IP connections. All interaction with the server by be through socket files (Unix) or named pipes or shared memory (Windows). It's recommended to use this option if only local clients are permitted to connect to the server. Enabling this option also prevents a server from functioning as a replication client. • Commandline: --skip-networking • Scope: Global • Dynamic: No • Data Type: boolean • Default Value: 0 skip_show_database • Description: If set to 1, (0 is the default), only users with the SHOW DATABASES privilege can use the SHOW DATABASES statement to see all database names. • Commandline: --skip-show-database • Scope: Global • Dynamic: No • Data Type: boolean • Default Value: 0 slow_launch_time • Description: Time in seconds. If a thread takes longer than this to launch, the slow_launch_threads server status variable is incremented. • Commandline: --slow-launch-time=# • Scope: Global • Dynamic: Yes
  • 374. • Data Type: numeric • Default Value: 2 slow_query_log • Description: If set to 0, the default unless the --slow-query-log option is used, the slow query log is disabled, while if set to 1 (both global and session variables), the slow query log is enabled. MariaDB 10.1 added support for session variables. • Commandline: --slow-query-log • Scope: Global, Session (MariaDB 10.1) • Dynamic: Yes • Data Type: boolean • Default Value: 0 • See also: See log_output to see how log files are written. If that variable is set to NONE, no logs will be written even if slow_query_log is set to 1. slow_query_log_file • Description: Name of the slow query log file. • Commandline: --slow-query-log-file=file_name • Scope: Global • Dynamic: Yes • Data Type: file name • Default Value: host_name-slow.log socket • Description: On Unix-like systems, this is the name of the socket file used for local client connections, by default /tmp/mysql.sock, often changed by the distribution, for example /var/lib/mysql/mysql.sock. On Windows, this is the name of the named pipe used for local client connections, by default MySQL. On Windows, this is not case-sensitive. • Commandline: --socket=name • Scope: Global • Dynamic: No • Data Type: file name • Default Value: /tmp/mysql.sock (Unix), MySQL (Windows)
  • 375. sort_buffer_size • Description: Each session performing a sort allocates a buffer with this amount of memory. Not specific to any storage engine. If the status variable sort_merge_passes is too high, you may need to look at improving your query indexes, or increasing this. Consider reducing where there are many small sorts, such as OLTP, and increasing where needed by session. 16k is a suggested minimum. • Commandline: --sort-buffer-size=# • Scope: Global, Session • Dynamic: Yes • Data Type: number • Default Value: 2M (2097152) (some distributions increase the default) sql_auto_is_null • Description: If set to 1, the query SELECT * FROM table_name WHERE auto_increment_column IS NULL will return an auto-increment that has just been successfully inserted, the same as the LAST_INSERT_ID() function. Some ODBC programs make use of this IS NULL comparison. • Scope: Global, Session • Dynamic: Yes • Data Type: boolean • Default Value: 0 (>= MariaDB/MySQL 5.5.3), 1 (MariaDB/MySQL <= 5.5.2) sql_big_selects • Description: If set to 0, MariaDB will not perform large SELECTs. See max_join_size for details. If max_join_size is set to anything but DEFAULT, sql_big_selects is automatically set to 0. If sql_big_selects is again set, max_join_size will be ignored. • Scope: Global, Session • Dynamic: Yes • Data Type: boolean • Default Value: 1 sql_big_tables • Description: A synonym for big_tables.
  • 376. sql_buffer_result • Description: If set to 1 (0 is default), results from SELECT statements are always placed into temporary tables. This can help the server when it takes a long time to send the results to the client by allowing the table locks to be freed early. • Scope: Global, Session • Dynamic: Yes • Data Type: boolean • Default Value: 0 sql_log_off • Description: If set to 1 (0 is the default), no logging to the general query log is done for the client. Only clients with the SUPER privilege can update this variable. • Scope: Session • Dynamic: Yes • Data Type: boolean • Default Value: 0 sql_log_update • Description: Removed. Use sql_log_bin instead. • Removed: MariaDB/MySQL 5.5 sql_low_priority_updates • Description: Synonym for low_priority_updates, the preferred name. sql_max_join_size • Description: Synonym for max_join_size, the preferred name. • Deprecated: MariaDB 5.5 • Removed: MariaDB 10.0 sql_mode • Description: Sets the SQL Mode. Multiple modes can be set, separated by a comma. • Commandline: --sql-mode=value[,value[,value...]] • Scope: Global, Session • Dynamic: Yes
  • 377. • Data Type: string • Default Value: • STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREA TE_USER,NO_ENGINE_SUBSTITUTION (>= MariaDB 10.2.4) • NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION (>= MariaDB 10.1.7) • (empty string) (<= MariaDB 10.1.6) • Valid Values: See SQL Mode for the full list. sql_notes • Description: If set to 1, the default, warning_count is incremented each time a Note warning is encountered. If set to 0, Note warnings are not recorded. mysqldump has outputs to set this variable to 0 so that no unnecessary increments occur when data is reloaded. • Commandline: None • Scope: Global, Session • Dynamic: Yes • Data Type: boolean • Default Value: 1 sql_quote_show_create • Description: If set to 1, the default, the server will quote identifiers for SHOW CREATE DATABASE, SHOW CREATE TABLE and SHOW CREATE VIEW statements. Quoting is disabled if set to 0. Enable to ensure replications works when identifiers require quoting. • Scope: Global, Session • Dynamic: Yes • Data Type: boolean • Default Value: 1 sql_safe_updates • Description: If set to 1, UPDATEs and DELETEs need either a key in the WHERE clause, or a LIMIT clause, or else they will aborted. Prevents the common mistake of accidentally deleting or updating every row in a table. • Dynamic: Yes • Data Type: boolean • Default Value: OFF (0)
  • 378. sql_select_limit • Description: Maximum number of rows that can be returned from a SELECT query. Default is the maximum number of rows permitted per table by the server, usually 232-1 or 264-1. Can be restored to the default value after being changed by assigning it a value of DEFAULT. • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 0 sql_warnings • Description: If set to 1, single-row INSERTs will produce a string containing warning information if a warning occurs. • Scope: Global, Session • Dynamic: Yes • Data Type: boolean • Default Value: OFF (0) storage_engine • Description: See default_storage_engine. • Deprecated: MariaDB 5.5 standard_compliant_cte • Description: Allow only standard-compliant common table expressions. Prior to version 10.2.4, this variable was named standards_compliant_cte. • Commandline: --standard-compliant-cte={0|1} • Scope: Global, Session • Dynamic: Yes • Data Type: boolean • Default Value: ON • Introduced: MariaDB 10.2.2 stored_program_cache • Description: Limit to the number of stored routines held in the stored procedures and stored functions caches. Each time a stored routine is executed, this limit is first checked, and if the number held in the cache exceeds this, that cache is flushed and memory freed.
  • 379. • Commandline: --stored-program-cache=# • Scope: Global • Dynamic: Yes • Data Type: numeric • Default Value: 256 • Range: 256 to 524288 • Introduced: MariaDB/MySQL 5.5.21 strict_password_validation • Description: When password validation plugins are enabled, reject passwords that cannot be validated (passwords specified as a hash). This excludes direct updates to the privilege tables. • Commandline: --strict-password-validation • Scope: Global • Dynamic: Yes • Data Type: boolean • Default Value: ON • Introduced: MariaDB 10.1.2 sync_frm • Description: If set to 1, the default, each time a non-temporary table is created, its .frm definition file is synced to disk. Fractionally slower, but safer in case of a crash. • Commandline: --sync-frm • Scope: Global • Dynamic: Yes • Data Type: boolean • Default Value: TRUE system_time_zone • Description: Server system time zone, inherited from the machine setting when the server starts. Usually specified by the TZ environment variable, can also be specified by the -- timezone option of the mysqld_safe script, or affected by the environment of the account starting the server. Not the same as the time_zone system variable, which is used for client time zones. • Scope: Global • Dynamic: No • Data Type: string
  • 380. table_definition_cache • Description: Number of table definitions that can be cached. Table definitions are taken from the .frm files, and if there are a large number of tables increasing the cache size can speed up table opening. Unlike the table_open_cache, as the table_definition_cache doesn't use file descriptors, and is much smaller. • Commandline: --table-definition-cache=# • Scope: Global • Dynamic: Yes • Data Type: numeric • Default Value: 400 • Range: 400 to 524288 table_lock_wait_timeout • Description: Unused, and removed in MariaDB/MySQL 5.5.3 • Commandline: --table-lock-wait-timeout=# • Scope: Global • Dynamic: Yes • Data Type: numeric • Default Value: 50 • Range: 1 to 1073741824 • Removed: MariaDB/MySQL 5.5.3 table_open_cache • Description: Maximum number of open tables cached in one table cache instance. See Optimizing table_open_cache for suggestions on optimizing. Increasing table_open_cache increases the number of file descriptors required. • Commandline: --table-open-cache=# • Scope: Global • Dynamic: Yes • Data Type: numeric • Default Value: 2000 (>= MariaDB 10.1.7), 400 (<= MariaDB 10.1.6) • Range: 1 to 1048576 (1024K) (>= MariaDB 10.1.20, MariaDB 10.0.35), 1 to 524288 (512K) (<= MariaDB 10.1.19, MariaDB 10.0.34)
  • 381. table_open_cache_instances • Description: From MariaDB 10.2.2, specifies the maximum number of table cache instances. This is different to the MySQL version which specifies the number of table cache instances. The MariaDB implementation is more efficient, and always starts with 1 instance, increasing the number up to the maximum when there's contention. Whenever an instance is activated a note is written to error log, for example Detected table cache mutex contention at instance 1: 25% waits. Additional table cache instance activated. Number of instances after activation: 2. The number of instances does not decrease again. The current default value (8) is expected to handle up to 100 CPU cores - beyond this, the setting should be increased. Until MariaDB 10.0.7, this was an unused MySQL 5.6 compatibility option, as MariaDB achieved similar results in a different way (see MDEV-4702). • Scope: Global • Dynamic: No • Data Type: numeric • Default Value: 8 (>= MariaDB 10.2.2), 1 (<= MariaDB 10.0.6) • Range: 1 to 64 • Introduced: MariaDB 10.2.2 (previously in MariaDB 10.0.4) • Removed: MariaDB 10.0.7, reintroduced MariaDB 10.2.2 table_type • Description: Removed and replaced by storage_engine in MariaDB/MySQL 5.5.3. Use default_storage_engine instead. tcp_keepalive_interval • Description: The interval, in seconds, between when successive keep-alive packets are sent if no acknowledgement is received. If set to 0, the system dependent default is used. • Commandline: --tcp-keepalive-interval=# • Scope: Global • Dynamic: Yes • Data Type: numeric • Default Value: 0 • Range: 0 to 2147483 • Introduced: MariaDB 10.3.3
  • 382. tcp_keepalive_probes • Description: The number of unacknowledged probes to send before considering the connection dead and notifying the application layer. If set to 0, a system dependent default is used. • Commandline: --tcp-keepalive-probes=# • Scope: Global • Dynamic: Yes • Data Type: numeric • Default Value: 0 • Range: 0 to 2147483 • Introduced: MariaDB 10.3.3 tcp_keepalive_time • Description: Timeout, in milliseconds, with no activity until the first TCP keep-alive packet is sent. If set to 0, a system dependent default is used. • Commandline: --tcp-keepalive-time=# • Scope: Global • Dynamic: Yes • Data Type: numeric • Default Value: 0 • Range: 0 to 2147483 • Introduced: MariaDB 10.3.3 thread_cache_size • Description: Number of threads server caches for re-use. If this limit hasn't been reached, when a client disconnects, its threads are put into the cache, and re-used where possible. These are freed after 5 minutes of idle time. Normally this setting has little effect, as the other aspects of the thread implementation are more important, but increasing it can help servers with high volumes of connections per second so that most can use a cached, rather than a new, thread. The cache miss rate can be calculated as the server status variables threads_created/connections. If the thread pool is active, thread_cache_size is ignored. From MariaDB 10.2.0, the default is automatically set to the smaller of either 256, or the max_connections size. • Commandline: --thread-cache-size=# • Scope: Global • Dynamic: Yes • Data Type: numeric • Default Value: 0 (<= MariaDB 10.1), Auto (from MariaDB 10.2.0) • Range: 0 to 16384
  • 383. thread_concurrency • Description: Allows applications to give the system a hint about the desired number of threads. Specific to Solaris only, invokes thr_setconcurrency(). Deprecated and has no effect in MariaDB 5.5. • Commandline: --thread-concurrency=# • Scope: Global • Dynamic: No • Data Type: numeric • Default Value: 10 • Range: 1 to 512 • Deprecated: MariaDB 5.5 thread_stack • Description: Stack size for each thread. If set too small, limits recursion depth of stored procedures and complexity of SQL statements the server can handle in memory. Also affects limits in the crash-me test. • Commandline: --thread-stack=# • Scope: Global • Dynamic: No • Data Type: numeric • Default Value: • 299008 (MariaDB 10.2.5) • 297984 (MariaDB 10.2.1) • 296960 (MariaDB 10.2.0) • 295936 (MariaDB 10.1) • 294912 (<= MariaDB 10.0) • Range: 131072 to 18446744073709551615 time_format • Description: Unused. time_zone • Description: The current time zone, used to initialize the time zone for a client when it connects. Set to SYSTEM by default, in which the client uses the system time zone value.
  • 384. • Commandline: --default-time-zone=string • Scope: Global, Session • Dynamic: Yes • Data Type: string • Default Value: SYSTEM timed_mutexes • Description: Determines whether InnoDB mutexes are timed. OFF, the default, disables mutex timing, while ON enables it. See also SHOW ENGINE for more on mutex statistics. Deprecated in MariaDB 5.5.39, as has no effect anymore. • Commandline: --timed-mutexes • Scope: Global • Dynamic: Yes • Data Type: boolean • Default Value: OFF • Deprecated: MariaDB 5.5.39 timestamp • Description: Sets the time for the client. This will affect the result returned by the NOW() function, not the SYSDATE() function, unless the server is started with the --sysdate-is-now option, in which case SYSDATE becomes an alias of NOW, and will also be affected. Also used to get the original timestamp when restoring rows from the binary log. • Scope: Session • Dynamic: Yes • Valid Values: timestamp_value (Unix epoch timestamp, not MariaDB timestamp), DEFAULT tmp_disk_table_size • Description: Max size for data for an internal temporary on-disk MyISAM or Aria table. These tables are created as part of complex queries when the result doesn't fit into the memory engine. You can set this variable if you want to limit the size of temporary tables created in your temporary directory tmpdir. • Commandline: --tmp-disk-table-size=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric
  • 385. • Default Value: 18446744073709551615 (max unsigned integer, no limit) • Range: 1024 to 18446744073709551615 • Introduced: MariaDB 10.2.7 tmp_memory_table_size • Description: An alias for tmp_table_size. • Commandline: --tmp-memory-table-size=# • Introduced: MariaDB 10.2.7 tmp_table_size • Description: The largest size for temporary tables in memory (not MEMORY tables) although if max_heap_table_size is smaller the lower limit will apply. If a table exceeds the limit, MariaDB converts it to a MyISAM or Aria table. You can see if it's necessary to increase by comparing the status variables Created_tmp_disk_tables and Created_tmp_tables to see how many temporary tables out of the total created needed to be converted to disk. Often complex GROUP BY queries are responsible for exceeding the limit. Defaults may be different on some systems, see for example Differences in MariaDB in Debian. From MariaDB 10.2.7, tmp_memory_table_size is an alias. • Commandline: --tmp-table-size=# • Scope: Global, Session • Dynamic: Yes • Data Type: numeric • Default Value: 16777216 (16MB) • Range: 1024 to 4294967295 tmpdir • Description: Directory for storing temporary tables and files. Can specify a list (separated by semicolons in Windows, and colons in Unix that will then be used in round-robin fashion. This can be used for load balancing across several disks. Note that if the server is a replication slave, and slave_load_tmpdir, which overrides tmpdir for slave replication, is not set, you should not set tmpdir to a directory that is cleared when the machine restarts, or else replication may fail. • Commandline: --tmpdir=path or -t path • Scope: Global • Dynamic: No • Type: directory name/s
  • 386. transaction_alloc_block_size • Description: Size in bytes to increase the memory pool available to each transaction when the available pool is not large enough. See transaction_prealloc_size. • Commandline: --transaction-alloc-block-size=# • Scope: Global, Session • Dynamic: Yes • Type: numeric • Default Value: 8192 • Range: 1024 to 4294967295 • Block Size: 1024 transaction_prealloc_size • Description: Initial size of a memory pool available to each transaction for various memory allocations. If the memory pool is not large enough for an allocation, it is increased by transaction_alloc_block_size bytes, and truncated back to transaction_prealloc_size bytes when the transaction is completed. If set large enough to contain all statements in a transaction, extra malloc() calls are avoided. • Commandline: --transaction-prealloc-size=# • Scope: Global, Session • Dynamic: Yes • Type: numeric • Default Value: 4096 • Range: 1024 to 4294967295 • Block Size: 1024 tx_isolation • Description: The transaction isolation level. See also SET TRANSACTION ISOLATION LEVEL. • Commandline: --transaction-isolation=name • Scope: Global, Session • Dynamic: Yes • Type: enumeration • Default Value: REPEATABLE-READ • Valid Values: READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE
  • 387. tx_read_only • Description: Default transaction access mode. If set to OFF, the default, access is read/write. If set to ON, access is read-only. The SET TRANSACTION statement can also change the value of this variable. See SET TRANSACTION and START TRANSACTION. • Commandline: --transaction-read-only=# • Scope: Global, Session • Dynamic: Yes • Type: boolean • Default Value: OFF-READ • Introduced: MariaDB 10.0 unique_checks • Description: If set to 1, the default, secondary indexes in InnoDB tables are performed. If set to 0, storage engines can (but are not required to) assume that duplicate keys are not present in input data. Set to 0 to speed up imports of large tables to InnoDB. The storage engine will still issue a duplicate key error if it detects one, even if set to 0. • Scope: Global, Session • Dynamic: Yes • Type: boolean • Default Value: 1 updatable_views_with_limit • Description: Determines whether view updates can be made with an UPDATE or DELETE statement with a LIMIT clause if the view does not contain all primary or not null unique key columns from the underlying table. 0 prohibits this, while 1 permits it while issuing a warning (the default). • Commandline: --updatable-views-with-limit=# • Scope: Global, Session • Dynamic: Yes • Type: boolean • Default Value: 1 use_stat_tables • Description: Controls the use of engine-independent table statistics. • never The optimizer will not use data from statistics tables.
  • 388. • complementary The optimizer uses data from statistics tables if the same kind of data is not provided by the storage engine. • preferably Prefer the data from statistics tables, if it's not available there, use the data from the storage engine. • Commandline: --use-stat-tables=mode • Scope: Global, Session • Dynamic: Yes • Data Type: enum • Default Value: never • Introduced: MariaDB 10.0.1 userstat • Description: If set to 1, user statistics will be activated. • Commandline: --userstat=1 • Scope: Global • Dynamic: Yes • Data Type: boolean • Default Value: OFF • Introduced: MariaDB 5.2.0 version • Description: Server version number. It may also include a suffix with configuration or build information. -debug indicates debugging support was enabled on the server, and -log indicates at least one of the binary log, general log or slow query log are enabled, for example 10.0.1-MariaDB-mariadb1precise-log. From MariaDB 10.2.1, this variable can be set at startup in order to fake the server version. • Commandline: -V, --version[=name] (>= MariaDB 10.2.1), --version (<= MariaDB 10.2.0) • Scope: Global • Dynamic: No • Type: string version_comment • Description: Value of the COMPILATION_COMMENT option specified by CMake when building MariaDB, for example mariadb.org binary distribution. • Scope: Global
  • 389. • Dynamic: No • Type: string version_compile_machine • Description: The machine type or architecture MariaDB was built on, for example i686. • Scope: Global • Dynamic: No • Type: string version_compile_os • Description: Operating system that MariaDB was built on, for example debian-linux- gnu. • Scope: Global • Dynamic: No • Type: string version_malloc_library • Description: Version of the used malloc library. • Commandline: No • Scope: Global • Dynamic: No • Type: string • Introduced: MariaDB 10.0.8 version_source_revision • Description: Source control revision id for MariaDB source code, enabling one to see exactly which version of the source was used for a build. • Commandline: None • Scope: Global • Dynamic: No • Type: string • Introduced: MariaDB 10.3.2
  • 390. wait_timeout • Description: Time in seconds that the server waits for a connection to become active before closing it. The session value is initialized when a thread starts up from either the global value, if the connection is non-interactive, or from the interactive_timeout value, if the connection is interactive. • Commandline: --wait-timeout=# • Scope: Global, Session • Dynamic: Yes • Type: numeric • Default Value: 28800 • Range: (Windows): 1 to 2147483 • Range: (Other): 1 to 31536000 warning_count • Description: Read-only variable indicating the number of warnings, errors and notes resulting from the most recent statement that generated messages. See SHOW WARNINGS for more. Note warnings will only be recorded if sql_notes is true (the default). • Scope: Session • Dynamic: No • Type: numeric List of Server Status Variables Aborted_clients • Description: Number of aborted client connections. This can be due to the client not calling mysql_close() before exiting, the client sleeping without issuing a request to the server for more seconds than specified by wait_timeout or interactive_timeout, or by the client program ending in the midst of transferring data. • Scope: Global • Data Type: numeric Aborted_connects • Description: Number of failed server connection attempts. This can be due to a client using an incorrect password, a client not having privileges to connect to a database, a connection packet not containing the correct information, or if it takes more than connect_timeout seconds to get a connect packet.
  • 391. • Scope: Global • Data Type: numeric Access_denied_errors • Description: Number of access denied errors. • Scope: Global • Data Type: numeric • Introduced: MariaDB 5.2 Acl_column_grants • Description: Number of column permissions granted (rows in the mysql.columns_priv table). • Scope: Global • Data Type: numeric • Introduced:MariaDB 10.1.4 Acl_database_grants • Description: Number of database permissions granted (rows in the mysql.db table). • Scope: Global • Data Type: numeric • Introduced: MariaDB 10.1.4 Acl_function_grants • Description: Number of function permissions granted (rows in the mysql.procs_priv table with a routine type of FUNCTION). • Scope: Global • Data Type: numeric • Introduced: MariaDB 10.1.4 Acl_package_body_grants • Description: • Scope: Global • Data Type: numeric • Introduced: MariaDB 10.3.5
  • 392. Acl_package_spec_grants • Description: • Scope: Global • Data Type: numeric • Introduced: MariaDB 10.3.5 Acl_procedure_grants • Description: Number of procedure permissions granted (rows in the mysql.procs_priv table with a routine type of PROCEDURE). • Scope: Global • Data Type: numeric • Introduced: MariaDB 10.1.4 Acl_proxy_users • Description: Number of proxy permissions granted (rows in the mysql.proxies_priv table). • Scope: Global • Data Type: numeric • Introduced: MariaDB 10.1.4 Acl_role_grants • Description: Number of role permissions granted (rows in the mysql.roles_mapping table). • Scope: Global • Data Type: numeric • Introduced: MariaDB 10.1.4 Acl_roles • Description: Number of roles (rows in the mysql.user table where is_role='Y'). • Scope: Global • Data Type: numeric • Introduced: MariaDB 10.1.4 Acl_table_grants • Description: Number of table permissions granted (rows in the mysql.tables_priv table). • Scope: Global
  • 393. • Data Type: numeric • Introduced: MariaDB 10.1.4 Acl_users • Description: Number of users (rows in the mysql.user table where is_role='N'). • Scope: Global • Data Type: numeric • Introduced: MariaDB 10.1.4 Busy_time • Description: Cumulative time in seconds of activity on connections. • Scope: Global • Data Type: numeric • Introduced: MariaDB 5.3 Bytes_received • Description: Total bytes received from all clients. • Scope: Global • Data Type: numeric Bytes_sent • Description: Total bytes sent to all clients. • Scope: Global, Session • Data Type: numeric Com_admin_commands • Description: Number of admin commands executed. These include table dumps, change users, binary log dumps, shutdowns, pings and debugs. • Scope: Global, Session • Data Type: numeric Com_alter_db • Description: Number of ALTER DATABASE commands executed.
  • 394. • Scope: Global, Session • Data Type: numeric Com_alter_db_upgrade • Description: Number of ALTER DATABASE ... UPGRADE commands executed. • Scope: Global, Session • Data Type: numeric Com_alter_event • Description: Number of ALTER EVENT commands executed. • Scope: Global, Session • Data Type: numeric Com_alter_function • Description: Number of ALTER FUNCTION commands executed. • Scope: Global, Session • Data Type: numeric Com_alter_procedure • Description: Number of ALTER PROCEDURE commands executed. • Scope: Global, Session • Data Type: numeric Com_alter_sequence • Description: Number of ALTER SEQUENCE commands executed. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.3.1 Com_alter_server • Description: Number of ALTER SERVER commands executed. • Scope: Global, Session • Data Type: numeric
  • 395. Com_alter_table • Description: Number of ALTER TABLE commands executed. • Scope: Global, Session • Data Type: numeric Com_alter_tablespace • Description: Number of ALTER TABLESPACE commands executed. • Scope: Global, Session • Data Type: numeric Com_alter_user • Description: Number of ALTER USER commands executed. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.2.0 Com_analyze • Description: Number of ANALYZE commands executed. • Scope: Global, Session • Data Type: numeric Com_assign_to_keycache • Description: Number of assign to keycache commands executed. • Scope: Global, Session • Data Type: numeric Com_backup_table • Description: Removed in MariaDB 5.5. In older versions, Com_backup_table contains the number of BACKUP TABLE commands executed. • Scope: Global, Session • Data Type: numeric • Removed: MariaDB 5.5
  • 396. Com_begin • Description: Number of BEGIN statements executed. • Scope: Global, Session • Data Type: numeric Com_binlog • Description: Number of BINLOG commands executed. • Scope: Global, Session • Data Type: numeric Com_call_procedure • Description: Number of CALL procedure_name statements executed. • Scope: Global, Session • Data Type: numeric Com_change_db • Description: Number of USE database_name commands executed. • Scope: Global, Session • Data Type: numeric Com_check • Description: Number of CHECK TABLE commands executed. • Scope: Global, Session • Data Type: numeric Com_checksum • Description: Number of CHECKSUM TABLE commands executed. • Scope: Global, Session • Data Type: numeric
  • 397. Com_commit • Description: Number of COMMIT commands executed. Differs from Handler_commit, which counts internal commit statements. • Scope: Global, Session • Data Type: numeric Com_compound_sql • Description: Number of compund sql statements. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.1.1 Com_create_db • Description: Number of CREATE DATABASE commands executed. • Scope: Global, Session • Data Type: numeric Com_create_event • Description: Number of CREATE EVENT commands executed. Differs from Executed_events in that it is incremented when the CREATE EVENT is run, and not when the event executes. • Scope: Global, Session • Data Type: numeric Com_create_function • Description: Number of CREATE FUNCTION commands executed. • Scope: Global, Session • Data Type: numeric Com_create_index • Description: Number of CREATE INDEX commands executed. • Scope: Global, Session • Data Type: numeric
  • 398. Com_create_package • Description: • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.3.5 Com_create_package_body • Description: • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.3.5 Com_create_procedure • Description: Number of CREATE PROCEDURE commands executed. • Scope: Global, Session • Data Type: numeric Com_create_role • Description: Number of CREATE ROLE commands executed. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.0.5 Com_create_sequence • Description: Number of CREATE SEQUENCE commands executed. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.3.0 Com_create_server • Description: Number of CREATE SERVER commands executed. • Scope: Global, Session • Data Type: numeric
  • 399. Com_create_table • Description: Number of CREATE TABLE commands executed. • Scope: Global, Session • Data Type: numeric Com_create_temporary_table • Description: Number of CREATE TEMPORARY TABLE commands executed. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.1.6 Com_create_trigger • Description: Number of CREATE TRIGGER commands executed. • Scope: Global, Session • Data Type: numeric Com_create_udf • Description: Number of CREATE UDF commands executed. • Scope: Global, Session • Data Type: numeric Com_create_user • Description: Number of CREATE USER commands executed. • Scope: Global, Session • Data Type: numeric Com_create_view • Description: Number of CREATE VIEW commands executed. • Scope: Global, Session • Data Type: numeric Com_dealloc_sql • Description: Number of DEALLOCATE commands executed.
  • 400. • Scope: Global, Session • Data Type: numeric Com_delete • Description: Number of DELETE commands executed. Differs from Handler_delete, which counts the number of times rows have been deleted from tables. • Scope: Global, Session • Data Type: numeric Com_delete_multi • Description: Number of multi-table DELETE commands executed. • Scope: Global, Session • Data Type: numeric Com_do • Description: Number of DO commands executed. • Scope: Global, Session • Data Type: numeric Com_drop_db • Description: Number of DROP DATABASE commands executed. • Scope: Global, Session • Data Type: numeric Com_drop_event • Description: Number of DROP EVENT commands executed. • Scope: Global, Session • Data Type: numeric Com_drop_function • Description: Number of DROP FUNCTION commands executed. • Scope: Global, Session • Data Type: numeric
  • 401. Com_drop_index • Description: Number of DROP INDEX commands executed. • Scope: Global, Session • Data Type: numeric Com_drop_package • Description: • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.3.5 Com_drop_package_body • Description: • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.3.5 Com_drop_procedure • Description: Number of DROP PROCEDURE commands executed. • Scope: Global, Session • Data Type: numeric Com_drop_role • Description: Number of DROP ROLE commands executed. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.0.5 Com_drop_sequence • Description: Number of DROP SEQUENCE commands executed. • Scope: Global, Session • Data Type: numeric
  • 402. • Introduced: MariaDB 10.3.0 Com_drop_server • Description: Number of DROP SERVER commands executed. • Scope: Global, Session • Data Type: numeric Com_drop_table • Description: Number of DROP TABLE commands executed. • Scope: Global, Session • Data Type: numeric Com_drop_temporary_table • Description: Number of DROP TEMPORARY TABLE commands executed. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.1.6 Com_drop_trigger • Description: Number of DROP TRIGGER commands executed. • Scope: Global, Session • Data Type: numeric Com_drop_user • Description: Number of DROP USER commands executed. • Scope: Global, Session • Data Type: numeric Com_drop_view • Description: Number of DROP VIEW commands executed. • Scope: Global, Session • Data Type: numeric
  • 403. Com_empty_query • Description: Number of queries to the server that do not produce SQL queries. An SQL query simply returning no results does not increment Com_empty_query - see Empty_queries instead. An example of an empty query sent to the server is mysql --comments -e '-- sql comment' • Scope: Global, Session • Data Type: numeric Com_execute_immediate • Description: Number of EXECUTE IMMEDIATE statements executed. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.2.3 Com_execute_sql • Description: Number of EXECUTE statements executed. • Scope: Global, Session • Data Type: numeric Com_flush • Description: Number of FLUSH commands executed. This differs from Flush_commands, which also counts internal server flush requests. • Scope: Global, Session • Data Type: numeric Com_get_diagnostics • Description: Number of GET DIAGNOSTICS commands executed. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.0.4 / MySQL 5.6.4 Com_grant • Description: Number of GRANT commands executed. • Scope: Global, Session
  • 404. • Data Type: numeric Com_grant_role • Description: Number of GRANT role commands executed. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.0.5 Com_ha_close • Description: Number of HANDLER table_name CLOSE commands executed. • Scope: Global, Session • Data Type: numeric Com_ha_open • Description: Number of HANDLER table_name OPEN commands executed. • Scope: Global, Session • Data Type: numeric Com_ha_read • Description: Number of HANDLER table_name READ commands executed. • Scope: Global, Session • Data Type: numeric Com_help • Description: Number of HELP commands executed. • Scope: Global, Session • Data Type: numeric Com_insert • Description: Number of INSERT commands executed. • Scope: Global, Session • Data Type: numeric
  • 405. Com_insert_select • Description: Number of INSERT ... SELECT commands executed. • Scope: Global, Session • Data Type: numeric Com_install_plugin • Description: Number of INSTALL PLUGIN commands executed. • Scope: Global, Session • Data Type: numeric Com_kill • Description: Number of KILL commands executed. • Scope: Global, Session • Data Type: numeric Com_load • Description: Number of LOAD commands executed. • Scope: Global, Session • Data Type: numeric Com_load_master_data • Description: • Scope: Global, Session • Data Type: numeric • Removed: MariaDB 5.5 Com_load_master_table • Description: • Scope: Global, Session • Data Type: numeric • Removed: MariaDB 5.5
  • 406. Com_multi • Description: • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.2.0 Com_lock_tables • Description: Number of [lock-tables|LOCK TABLES]] commands executed. • Scope: Global, Session • Data Type: numeric Com_optimize • Description: Number of OPTIMIZE commands executed. • Scope: Global, Session • Data Type: numeric Com_preload_keys • Description: • Scope: Global, Session • Data Type: numeric Com_prepare_sql • Description: Number of PREPARE statements executed. • Scope: Global, Session • Data Type: numeric Com_purge • Description: Number of PURGE commands executed. • Scope: Global, Session • Data Type: numeric Com_purge_before_date • Description: Number of PURGE BEFORE commands executed.
  • 407. • Scope: Global, Session • Data Type: numeric Com_release_savepoint • Description: Number of RELEASE SAVEPOINT commands executed. • Scope: Global, Session • Data Type: numeric Com_rename_table • Description: Number of RENAME TABLE commands executed. • Scope: Global, Session • Data Type: numeric Com_rename_user • Description: Number of RENAME USER commands executed. • Scope: Global, Session • Data Type: numeric Com_repair • Description: Number of REPAIR TABLE commands executed. • Scope: Global, Session • Data Type: numeric Com_replace • Description: Number of REPLACE commands executed. • Scope: Global, Session • Data Type: numeric Com_replace_select • Description: Number of REPLACE ... SELECT commands executed. • Scope: Global, Session • Data Type: numeric
  • 408. Com_reset • Description: Number of RESET commands executed. • Scope: Global, Session • Data Type: numeric Com_resignal • Description: Number of RESIGNAL commands executed. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Com_restore_table • Description: Removed in MariaDB 5.5. In older versions, Com_restore_table contains the number of RESTORE TABLE commands executed. • Scope: Global, Session • Data Type: numeric • Removed: MariaDB 5.5 Com_revoke • Description: Number of REVOKE commands executed. • Scope: Global, Session • Data Type: numeric Com_revoke_all • Description: Number of REVOKE ALL commands executed. • Scope: Global, Session • Data Type: numeric Com_revoke_grant • Description: Number of REVOKE role commands executed. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.0.5
  • 409. Com_rollback • Description: Number of ROLLBACK commands executed. Differs from Handler_rollback, which is the number of transaction rollback requests given to a storage engine. • Scope: Global, Session • Data Type: numeric Com_rollback_to_savepoint • Description: Number of ROLLBACK ... TO SAVEPOINT commands executed. • Scope: Global, Session • Data Type: numeric Com_savepoint • Description: Number of SAVEPOINT commands executed. Differs from Handler_savepoint, which is the number of transaction savepoint creation requests. • Scope: Global, Session • Data Type: numeric Com_select • Description: Number of SELECT commands executed. Since MariaDB 5.5, this also includes queries that make use of the query cache. • Scope: Global, Session • Data Type: numeric Com_set_option • Description: Number of SET OPTION commands executed. • Scope: Global, Session • Data Type: numeric Com_signal • Description: Number of SIGNAL statements executed. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5
  • 410. Com_show_authors • Description: Number of SHOW AUTHORS commands executed. • Scope: Global, Session • Data Type: numeric Com_show_binlog_events • Description: Number of SHOW BINLOG EVENTS statements executed. • Scope: Global, Session • Data Type: numeric Com_show_binlogs • Description: Number of SHOW BINARY LOGS commands executed. • Scope: Global, Session • Data Type: numeric Com_show_charsets • Description: Number of SHOW CHARACTER SET commands executed. • Scope: Global, Session • Data Type: numeric Com_show_client_statistics • Description: Number of SHOW CLIENT STATISTICS commands executed. Removed in MariaDB 10.1.1 when that statement was replaced by the generic SHOW information_schema_table. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.2 • Removed: MariaDB 10.1.1 Com_show_collations • Description: Number of SHOW COLLATION commands executed. • Scope: Global, Session • Data Type: numeric
  • 411. Com_show_column_types • Description: • Scope: Global, Session • Data Type: numeric • Removed: MariaDB 5.5 Com_show_contributors • Description: Number of SHOW CONTRIBUTORS commands executed. • Scope: Global, Session • Data Type: numeric Com_show_create_db • Description: Number of SHOW CREATE DATABASE commands executed. • Scope: Global, Session • Data Type: numeric Com_show_create_event • Description: Number of SHOW CREATE EVENT commands executed. • Scope: Global, Session • Data Type: numeric Com_show_create_func • Description: Number of SHOW CREATE FUNCTION commands executed. • Scope: Global, Session • Data Type: numeric Com_show_create_package • Description: • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.3.5
  • 412. Com_show_create_package_body • Description: • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.3.5 Com_show_create_proc • Description: Number of SHOW CREATE PROCEDURE commands executed. • Scope: Global, Session • Data Type: numeric Com_show_create_table • Description: Number of SHOW CREATE TABLE commands executed. • Scope: Global, Session • Data Type: numeric Com_show_create_trigger • Description: Number of SHOW CREATE TRIGGER commands executed. • Scope: Global, Session • Data Type: numeric Com_show_create_user • Description: Number of SHOW CREATE USER commands executed. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.2.0 Com_show_databases • Description: Number of SHOW DATABASES commands executed. • Scope: Global, Session • Data Type: numeric
  • 413. Com_show_engine_logs • Description: Number of SHOW ENGINE LOGS commands executed. • Scope: Global, Session • Data Type: numeric Com_show_engine_mutex • Description: Number of SHOW ENGINE MUTEX commands executed. • Scope: Global, Session • Data Type: numeric Com_show_engine_status • Description: Number of SHOW ENGINE STATUS commands executed. • Scope: Global, Session • Data Type: numeric Com_show_events • Description: Number of SHOW EVENTS commands executed. • Scope: Global, Session • Data Type: numeric Com_show_errors • Description: Number of SHOW ERRORS commands executed. • Scope: Global, Session • Data Type: numeric Com_show_explain • Description: Number of SHOW EXPLAIN commands executed. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.0.0 Com_show_fields • Description: Number of SHOW COLUMNS or SHOW FIELDS commands executed.
  • 414. • Scope: Global, Session • Data Type: numeric Com_show_function_status • Description: Number of SHOW FUNCTION STATUS commands executed. • Scope: Global, Session • Data Type: numeric Com_show_generic • Description: Number of generic SHOW commands executed, such as SHOW INDEX_STATISTICS and SHOW TABLE_STATISTICS • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.1.1 Com_show_grants • Description: Number of SHOW GRANTS commands executed. • Scope: Global, Session • Data Type: numeric Com_show_keys • Description: Number of SHOW INDEX or SHOW KEYS commands executed. • Scope: Global, Session • Data Type: numeric Com_show_index_statistics • Description: Number of SHOW INDEX_STATISTICS commands executed. Removed in MariaDB 10.1.1 when that statement was replaced by the generic SHOW information_schema_table. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.2 • Removed: MariaDB 10.1.1
  • 415. Com_show_open_tables • Description: Number of SHOW OPEN TABLES commands executed. • Scope: Global, Session • Data Type: numeric Com_show_package_status • Description: • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.3.5 Com_show_package_body_status • Description: • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.3.5 Com_show_plugins • Description: Number of SHOW PLUGINS commands executed. • Scope: Global, Session • Data Type: numeric Com_show_privileges • Description: Number of SHOW PRIVILEGES commands executed. • Scope: Global, Session • Data Type: numeric Com_show_procedure_status • Description: Number of SHOW PROCEDURE STATUS commands executed. • Scope: Global, Session • Data Type: numeric
  • 416. Com_show_processlist • Description: Number of SHOW PROCESSLIST commands executed. • Scope: Global, Session • Data Type: numeric Com_show_profile • Description: Number of SHOW PROFILE commands executed. • Scope: Global, Session • Data Type: numeric Com_show_profiles • Description: Number of SHOW PROFILES commands executed. • Scope: Global, Session • Data Type: numeric Com_show_relaylog_events • Description: Number of SHOW RELAYLOG EVENTS commands executed. • Scope: Global, Session • Data Type: numeric Com_show_status • Description: Number of SHOW STATUS commands executed. • Scope: Global, Session • Data Type: numericst Com_show_storage_engines • Description: Number of SHOW STORAGE ENGINES - or SHOW ENGINES - commands executed. • Scope: Global, Session • Data Type: numeric
  • 417. Com_show_table_statistics • Description: Number of SHOW TABLE STATISTICS commands executed. Removed in MariaDB 10.1.1 when that statement was replaced by the generic SHOW information_schema_table. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.2 • Removed: MariaDB 10.1.1 Com_show_table_status • Description: Number of SHOW TABLE STATUS commands executed. • Scope: Global, Session • Data Type: numeric Com_show_tables • Description: Number of SHOW TABLES commands executed. • Scope: Global, Session • Data Type: numeric Com_show_triggers • Description: Number of SHOW TRIGGERS commands executed. • Scope: Global, Session • Data Type: numeric Com_show_user_statistics • Description: Number of SHOW USER STATISTICS commands executed. Removed in MariaDB 10.1.1 when that statement was replaced by the generic SHOW information_schema_table. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.2 • Removed: MariaDB 10.1.1
  • 418. Com_show_variable • Description: Number of SHOW VARIABLES commands executed. • Scope: Global, Session • Data Type: numeric Com_show_warnings • Description: Number of SHOW WARNINGS commands executed. • Scope: Global, Session • Data Type: numeric Com_shutdown • Description: Number of SHUTDOWN commands executed. • Scope: Global, Session • Data Type: numeric Com_stmt_close • Description: Number of prepared statements closed (deallocated or dropped). • Scope: Global, Session • Data Type: numeric Com_stmt_execute • Description: Number of prepared statements executed. • Scope: Global, Session • Data Type: numeric Com_stmt_fetch • Description: Number of prepared statements fetched. • Scope: Global, Session • Data Type: numeric Com_stmt_prepare • Description: Number of prepared statements prepared. • Scope: Global, Session
  • 419. • Data Type: numeric Com_stmt_reprepare • Description: Number of prepared statements reprepared. • Scope: Global, Session • Data Type: numeric Com_stmt_reset • Description: Number of prepared statements where the data of a prepared statement which was accumulated in chunks by sending long data has been reset. • Scope: Global, Session • Data Type: numeric Com_stmt_send_long_data • Description: Number of prepared statements where the parameter data has been sent in chunks (long data). • Scope: Global, Session • Data Type: numeric Com_truncate • Description: Number of TRUNCATE commands executed. • Scope: Global, Session • Data Type: numeric Com_uninstall_plugin • Description: Number of UNINSTALL PLUGIN commands executed. • Scope: Global, Session • Data Type: numeric Com_unlock_tables • Description: Number of UNLOCK TABLES commands executed. • Scope: Global, Session • Data Type: numeric
  • 420. Com_update • Description: Number of UPDATE commands executed. • Scope: Global, Session • Data Type: numeric Com_update_multi • Description: Number of multi-table UPDATE commands executed. • Scope: Global, Session • Data Type: numeric Com_xa_commit • Description: Number of XA statements committed. • Scope: Global, Session • Data Type: numeric Com_xa_end • Description: Number of XA statements ended. • Scope: Global, Session • Data Type: numeric Com_xa_prepare • Description: Number of XA statements prepared. • Scope: Global, Session • Data Type: numeric Com_xa_recover • Description: Number of XA RECOVER statements executed. • Scope: Global, Session • Data Type: numeric
  • 421. Com_xa_rollback • Description: Number of XA statements rolled back. • Scope: Global, Session • Data Type: numeric Com_xa_start • Description: Number of XA statements started. • Scope: Global, Session • Data Type: numeric Compression • Description: Whether client-server traffic is compressed. • Scope: Session • Data Type: boolean Connection_errors_accept • Description: Number of errors that occurred during calls to accept() on the listening port. • Scope: Global • Data Type: numeric • Introduced: MariaDB 10.0.4 / MySQL 5.6.5 Connection_errors_internal • Description: Number of refused connections due to internal server errors, for example out of memory errors, or failed thread starts. • Scope: Global • Data Type: numeric • Introduced: MariaDB 10.0.4 / MySQL 5.6.5 Connection_errors_max_connections • Description: Number of refused connections due to the max_connections limit being reached. • Scope: Global • Data Type: numeric • Introduced: MariaDB 10.0.4 / MySQL 5.6.5
  • 422. Connection_errors_peer_address • Description: Number of errors while searching for the connecting client IP address. • Scope: Global • Data Type: numeric • Introduced: MariaDB 10.0.4 / MySQL 5.6.5 Connection_errors_select • Description: Number of errors during calls to select() or poll() on the listening port. The client would not necessarily have been rejected in these cases. • Scope: Global • Data Type: numeric • Introduced: MariaDB 10.0.4 / MySQL 5.6.5 Connection_errors_tcpwrap • Description: Number of connections the libwrap library refused. • Scope: Global • Data Type: numeric • Introduced: MariaDB 10.0.4 / MySQL 5.6.5 Connections • Description: Number of connection attempts (both successful and unsuccessful) • Scope: Global • Data Type: numeric Cpu_time • Description: Total CPU time used. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.3 Created_tmp_disk_tables • Description: Number of on-disk temporary tables created. • Scope: Global, Session • Data Type: numeric
  • 423. Created_tmp_files • Description: Number of in-memory temporary tables created. • Scope: Global • Data Type: numeric Created_tmp_tables • Description: Number of temporary tables created. • Scope: Global • Data Type: numeric Delayed_errors • Description: Number of errors which occurred while doing INSERT DELAYED. • Scope: Global • Data Type: numeric Delayed_insert_threads • Description: Number of INSERT DELAYED threads. • Scope: Global • Data Type: numeric Delayed_writes • Description: Number of INSERT DELAYED rows written. • Scope: Global • Data Type: numeric Delete_scan • Description: Number of DELETEs that required a full table scan. • Scope: Global • Data Type: numeric • Introduced: MariaDB 10.1.17, MariaDB 10.0.27
  • 424. Empty_queries • Description: Number of queries returning no results. Note this is not the same as Com_empty_query. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.2 Executed_events • Description: Number of times events created with CREATE EVENT have executed. This differs from Com_create_event in that it is only incremented when the event has run, not when it executes. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5.28 Executed_triggers • Description: Number of times triggers created with CREATE TRIGGER have executed. This differs from Com_create_trigger in that it is only incremented when the trigger has run, not when it executes. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5.28 Feature_check_constraint • Description: Number of times constraints were checked. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.2.2 Feature_custom_aggregate_functions • Description: Number of queries which make use of custom aggregate functions. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.3.6
  • 425. Feature_delay_key_write • Description: Number of tables opened that are using delay_key_write. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.0.13 Feature_dynamic_columns • Description: Number of times the COLUMN_CREATE() function was used. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Feature_fulltext • Description: Number of times the MATCH … AGAINST() function was used. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Feature_gis • Description: Number of times a table with a any of the geometry columns was opened. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Feature_invisible_columns • Description: Number of invisible columns in all opened tables. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.3.3 Feature_json • Description: Number of times JSON functionality has been used, such as one of the JSON functions. Does not include the CONNECT engine JSON type, or EXPLAIN/ANALYZE FORMAT=JSON.
  • 426. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.3.7 Feature_locale • Description: Number of times the @@lc_messages variable was assigned into. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Feature_subquery • Description: Number of subqueries (excluding subqueries in the FROM clause) used. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Feature_system_versioning • Description: Number of times system versioning functionality has been used (opening a table WITH SYSTEM VERSIONING). • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.3.7 Feature_timezone • Description: Number of times an explicit timezone (excluding UTC and SYSTEM) was specified. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Feature_trigger • Description: Number of triggers loaded. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5
  • 427. Feature_window_functions • Description: Number of times window functions were used. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.2.2 Feature_xml • Description: Number of times XML functions (EXTRACTVALUE() and UPDATEXML()) were used. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Flush_commands • Description: Number of FLUSH statements executed, as well as due to internal server flush requests. This differs from Com_flush, which simply counts FLUSH statements, not internal server flush operations. • Scope: Global • Data Type: numeric Handler_commit • Description: Number of internal COMMIT requests. Differs from Com_commit, which counts the number of COMMIT statements executed. • Scope: Global, Session • Data Type: numeric Handler_delete • Description: Number of times rows have been deleted from tables. Differs from Com_delete, which counts DELETE statements. • Scope: Global, Session • Data Type: numeric
  • 428. Handler_discover • Description: Discovery is when the server asks the NDBCLUSTER storage engine if it knows about a table with a given name. Handler_discover indicates the number of times that tables have been discovered in this way. • Scope: Global, Session • Data Type: numeric Handler_external_lock • Description: Incremented for each call to the external_lock() function, which generally occurs at the beginning and end of access to a table instance. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.0.0 Handler_icp_attempts • Description: Number of times pushed index condition was checked. The smaller the ratio of Handler_icp_attempts to Handler_icp_match the better the filtering. See Index Condition Pushdown. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.3 Handler_icp_match • Description: Number of times pushed index condition was matched. The smaller the ratio of Handler_icp_attempts to Handler_icp_match the better the filtering. See See Index Condition Pushdown. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.3 Handler_mrr_init • Description: Counts how many MRR (multi-range read) scans were performed. See Multi Range Read optimization. • Scope: Global, Session • Data Type: numeric
  • 429. • Introduced: MariaDB 5.3 Handler_mrr_key_refills • Description: Number of times key buffer was refilled (not counting the initial fill). A non-zero value indicates there wasn't enough memory to do key sort-and-sweep passes in one go. See Multi Range Read optimization. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.3 Handler_mrr_rowid_refills • Description: Number of times rowid buffer was refilled (not counting the initial fill). A non- zero value indicates there wasn't enough memory to do rowid sort-and-sweep passes in one go. See Multi Range Read optimization. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.3 Handler_prepare • Description: Number of two-phase commit prepares. • Scope: Global, Session • Data Type: numeric Handler_read_first • Description: Number of requests to read the first row from an index. A high value indicates many full index scans, e.g. SELECT a FROM table_name where a is an indexed column. • Scope: Global, Session • Data Type: numeric Handler_read_key • Description: Number of row read requests based on an index value. A high value indicates indexes are regularly being used, which is usually positive. • Scope: Global, Session • Data Type: numeric
  • 430. Handler_read_last • Description: Number of requests to read the last row from an index. ORDER BY DESC results in a last-key request followed by several previous-key requests. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Handler_read_next • Description: Number of requests to read the next row from an index (in order). Increments when doing an index scan or querying an index column with a range constraint. • Scope: Global, Session • Data Type: numeric Handler_read_prev • Description: Number of requests to read the previous row from an index (in order). Mostly used with ORDER BY DESC. • Scope: Global, Session • Data Type: numeric Handler_read_retry • Description: Number of read retrys triggered by semi_consistent_read (InnoDB feature). • Scope: Global • Data Type: numeric • Introduced: MariaDB 10.0.27 Handler_read_rnd • Description: Number of requests to read a row based on its position. If this value is high, you may not be using joins that don't use indexes properly, or be doing many full table scans. • Scope: Global, Session • Data Type: numeric
  • 431. Handler_read_rnd_deleted • Description: Number of requests to delete a row based on its position. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.3 Handler_read_rnd_next • Description: Number of requests to read the next row. A large number of these may indicate many table scans and improperly used indexes. • Scope: Global, Session • Data Type: numeric Handler_rollback • Description: Number of transaction rollback requests given to a storage engine. Differs from Com_rollback, which is the number of ROLLBACK commands executed. • Scope: Global, Session • Data Type: numeric Handler_savepoint • Description: Number of transaction savepoint creation requests. Differs from Com_savepoint which is the number of SAVEPOINT commands executed. • Scope: Global, Session • Data Type: numeric Handler_savepoint_rollback • Description: Number of requests to rollback to a transaction savepoint. • Scope: Global, Session • Data Type: numeric Handler_tmp_delete • Description: Number of requests to delete a row in a temporary table. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.3.0
  • 432. Handler_tmp_update • Description: Number of requests to update a row to a temporary table. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.3 Handler_tmp_write • Description: Number of requests to write a row to a temporary table. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.3 Handler_update • Description: Number of requests to update a row in a table. Since MariaDB 5.3, this no longer counts temporary tables - see Handler_tmp_update. • Scope: Global, Session • Data Type: numeric Handler_write • Description: Number of requests to write a row to a table. Since MariaDB 5.3, this no longer counts temporary tables - see Handler_tmp_write. • Scope: Global, Session • Data Type: numeric Key_blocks_not_flushed • Description: Number of key cache blocks which have been modified but not flushed to disk. • Scope: Global • Data Type: numeric Key_blocks_unused • Description: Number of unused key cache blocks. • Scope: Global
  • 433. • Data Type: numeric Key_blocks_used • Description: Max number of key cache blocks which have been used simultaneously. • Scope: Global • Data Type: numeric Key_blocks_warm • Description: Number of key cache blocks in the warm list. • Scope: Global • Data Type: numeric • Introduced: MariaDB 5.1 Key_read_requests • Description: Number of key cache block read requests. See Optimizing key_buffer_size. • Scope: Global • Data Type: numeric Key_reads • Description: Number of physical index block reads. See Optimizing key_buffer_size. • Scope: Global • Data Type: numeric Key_write_requests • Description: Number of requests to write a block to the key cache. • Scope: Global • Data Type: numeric Key_writes • Description: Number of key cache block write requests • Scope: Global • Data Type: numeric
  • 434. Last_query_cost • Description: The most recent query optimizer query cost calculation. Can not be calculated for complex queries, such as subqueries or UNION. It will be set to 0 for complex queries. • Scope: Session • Data Type: numeric Maria_* • Description: When the Maria storage engine was renamed Aria, the Maria variables existing at the time were renamed at the same time. See Aria Server Status Variables. Max_statement_time_exceeded • Description: Number of queries that exceeded the execution time specified by max_statement_time. See Aborting statements that take longer than a certain time to execute. • Data Type: numeric • Introduced: MariaDB 10.1.1 Max_used_connections • Description: Max number of connections ever open at the same time. • Scope: Session • Data Type: numeric Memory_used • Description: Global or per-connection memory usage, in bytes. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.0.1 Memory_used_initial • Description: • Scope: Global • Data Type: numeric • Introduced: MariaDB 10.3.3
  • 435. Not_flushed_delayed_rows • Description: Number of INSERT DELAYED rows waiting to be written. • Scope: Global • Data Type: numeric Open_files • Description: Number of regular files currently opened by the server. Does not include sockets or pipes, or storage engines using internal functions. • Scope: Global • Data Type: numeric Open_streams • Description: Number of currently opened streams, usually log files. • Scope: Global • Data Type: numeric Open_table_definitions • Description: Number of currently cached .frm files. • Scope: Global • Data Type: numeric Open_tables • Description: Number of currently opened tables, excluding temporary tables. • Scope: Global, Session • Data Type: numeric Opened_files • Description: Number of files the server has opened. • Scope: Global • Data Type: numeric Opened_table_definitions • Description: Number of .frm files that have been cached.
  • 436. • Scope: Global, Session • Data Type: numeric Opened_tables • Description: Number of tables the server has opened. • Scope: Global, Session • Data Type: numeric Opened_views • Description: Number of views the server has opened. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Performance_schema_accounts_lost • Description: Number of times a row could not be added to the performance schema accounts table due to it being full. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.0.0 Performance_schema_cond_classes_lost • Description: Number of condition instruments that could not be loaded. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Performance_schema_cond_instances_lost • Description: Number of instances a condition object could not be created. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5
  • 437. Performance_schema_digest_lost • Description: • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Performance_schema_file_classes_lost • Description: Number of file instruments that could not be loaded. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Performance_schema_file_handles_lost • Description: Number of instances a file object could not be opened. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Performance_schema_file_instances_lost • Description: Number of instances a file object could not be created. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Performance_schema_hosts_lost • Description: Number of times a row could not be added to the performance schema hosts table due to it being full. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.0.0 Performance_schema_locker_lost • Description: Number of events not recorded, due to either being recursive, or having a deeper nested events stack than the implementation limit.
  • 438. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Performance_schema_mutex_classes_lost • Description: Number of mutual exclusion instruments that could not be loaded. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Performance_schema_mutex_instances_lost • Description: Number of instances a mutual exclusion object could not be created. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Performance_schema_rwlock_classes_lost • Description: Number of read/write lock instruments that could not be loaded. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Performance_schema_rwlock_instances_lost • Description: Number of instances a read/write lock object could not be created. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Performance_schema_socket_classes_lost • Description: • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.0.0
  • 439. Performance_schema_socket_instances_lost • Description: Number of instances a socket object could not be created. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.0.0 Performance_schema_stage_classes_lost • Description: Number of stage event instruments that could not be loaded. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.0.0 Performance_schema_statement_classes_lost • Description: Number of statement instruments that could not be loaded. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.0.0 Performance_schema_table_handles_lost • Description: Number of instances a table object could not be opened. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Performance_schema_table_instances_lost • Description: Number of instances a table object could not be created. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Performance_schema_thread_classes_lost • Description: Number of thread instruments that could not be loaded. • Scope: Global, Session • Data Type: numeric
  • 440. • Introduced: MariaDB 5.5 Performance_schema_thread_instances_lost • Description: Number of instances thread object could not be created. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Performance_schema_users_lost • Description: Number of times a row could not be added to the performance schema users table due to it being full. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.5 Prepared_stmt_count • Description: Current number of prepared statements. • Scope: Global • Data Type: numeric Qcache_free_blocks • Description: Number of free query cache memory blocks. • Scope: Global • Data Type: numeric Qcache_free_memory • Description: Amount of free query cache memory. • Scope: Global • Data Type: numeric Qcache_hits • Description: Number of requests served by the query cache. • Scope: Global
  • 441. • Data Type: numeric Qcache_inserts • Description: Number of queries ever cached in the query cache. • Scope: Global • Data Type: numeric Qcache_lowmem_prunes • Description: Number of pruning operations performed to remove old results to make space for new results in the query cache. • Scope: Global • Data Type: numeric Qcache_not_cached • Description: Number of queries that are uncacheable by the query cache, or use SQL_NO_CACHE. • Scope: Global • Data Type: numeric Qcache_queries_in_cache • Description: Number of queries currently cached by the query cache. • Scope: Global • Data Type: numeric Qcache_total_blocks • Description: Number of blocks used by the query cache. • Scope: Global • Data Type: numeric Queries • Description: Number of statements executed by the server, excluding COM_PING and COM_STATISTICS. Differs from Questions in that it also counts statements executed within stored programs.
  • 442. • Scope: Global, Session • Data Type: numeric Questions • Description: Number of statements executed by the server, excluding COM_PING, COM_STATISTICS, COM_STMT_PREPARE, COM_STMT_CLOSE, and COM_STMT_RESET statements. Differs from Queries in that it doesn't count statements executed within stored programs. • Scope: Global, Session • Data Type: numeric Rows_read • Description: Number of requests to read a row (excluding temporary tables). • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.3 Rows_sent • Description: • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.3 Rows_tmp_read • Description: Number of requests to read a row in a temporary table. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.3 Select_full_join • Description: Number of joins which did not use an index. If not zero, you may need to check table indexes. • Scope: Global, Session • Data Type: numeric
  • 443. Select_full_range_join • Description: Number of joins which used a range search of the first table. • Scope: Global, Session • Data Type: numeric Select_range • Description: Number of joins which used a range on the first table. • Scope: Global, Session • Data Type: numeric Select_range_check • Description: Number of joins without keys that check for key usage after each row. If not zero, you may need to check table indexes. • Scope: Global, Session • Data Type: numeric Select_scan • Description: Number of joins which used a full scan of the first table. • Scope: Global, Session • Data Type: numeric Slow_launch_threads • Description: Number of threads which took longer than slow_launch_time to create. • Scope: Global, Session • Data Type: numeric Slow_queries • Description: Number of queries which took longer than long_query_time to run. The slow query log does not need to be active for this to be recorded. • Scope: Global, Session • Data Type: numeric
  • 444. Sort_merge_passes • Description: Number of merge passes performed by the sort algorithm. If too high, you may need to look at improving your query indexes, or increasing the sort_buffer_size. • Scope: Global, Session • Data Type: numeric Sort_priority_queue_sorts • Description: The number of times that sorting was done through a priority queue. (The total number of times sorting was done is a sum Sort_range and Sort_scan). See filesort with small LIMIT optimization. • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 10.0.13 Sort_range • Description: Number of sorts which used a range. • Scope: Global, Session • Data Type: numeric Sort_rows • Description: Number of rows sorted. • Scope: Global, Session • Data Type: numeric Sort_scan • Description: Number of sorts which used a full table scan. • Scope: Global, Session • Data Type: numeric Subquery_cache_hit • Description: Counter for all subquery cache hits • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.3
  • 445. Subquery_cache_miss • Description: Counter for all subquery cache misses • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.3 Syncs • Description: Number of times my_sync() has been called, or the number of times the server has had to force data to disk. Covers the binary log, .frm creation (if these operations are configured to sync) and some storage engines (Archive, CSV, Aria), but not XtraDB/InnoDB). • Scope: Global, Session • Data Type: numeric • Introduced: MariaDB 5.1 Table_locks_immediate • Description: Number of table locks which were completed immediately. • Scope: Global • Data Type: numeric Table_locks_waited • Description: Number of table locks which had to wait. Indicates table lock contention. • Scope: Global • Data Type: numeric Table_open_cache_active_instances • Description: Number of active instances for open tables cache lookups. • Scope: • Data Type: numeric • Introduced: MariaDB 10.3.3 Table_open_cache_hits • Description: Number of hits for open tables cache lookups.
  • 446. • Scope: • Data Type: numeric • Introduced: MariaDB 10.3.3 Table_open_cache_misses • Description: Number of misses for open tables cache lookups. • Scope: • Data Type: numeric • Introduced: MariaDB 10.3.3 Table_open_cache_overflows • Description: Number of overflows for open tables cache lookups. • Scope: • Data Type: numeric • Introduced: MariaDB 10.3.3 Tc_log_max_pages_used • Description: Max number of pages used by the transaction coordinator recovery log. • Scope: Global • Data Type: numeric Tc_log_page_size • Description: Page size of the transaction coordinator recovery log. • Scope: Global • Data Type: numeric Tc_log_page_waits • Description: Number of times a two-phase commit was forced to wait for a free transaction coordinator recovery log page. • Scope: Global • Data Type: numeric
  • 447. Threads_cached • Description: Number of threads cached in the thread cache. Will be zero if the thread pool is in use (see Thread pool in MariaDB 5.5). • Scope: Global • Data Type: numeric Threads_connected • Description: Number of open connections. See Handling Too Many Connections. • Scope: Global • Data Type: numeric Threads_created • Description: Number of threads created to respond to client connections. If too large, look at increasing thread_cache_size. • Scope: Global • Data Type: numeric Threads_running • Description: Number of threads that are actively running, not sleeping. Until MariaDB 10.3.2, a global counter was updated on the fly. From MariaDB 10.3.3, as a performance improvement, all threads having a command not equal to COM_SLEEP are included. This means that the querying the session value will always return 1 (before MariaDB 10.3.3, global and session returned the same value). • Scope: Global • Data Type: numeric Update_scan • Description: Number of updates that required a full table scan. • Scope: Global • Data Type: numeric • Introduced: MariaDB 10.1.17, MariaDB 10.0.27 Uptime • Description: Number of seconds the server has been running.
  • 448. • Scope: Global • Data Type: numeric Uptime_since_flush_status • Description: Number of seconds since the last FLUSH STATUS. • Scope: Global • Data Type: numeric This page documents status variables related to the Aria storage engine. See Server Status Variables for a complete list of status variables that can be viewed with SHOW STATUS. See also the Full list of MariaDB options, system and status variables. Aria_pagecache_blocks_not_flushed • Description: The number of dirty blocks in the Aria page cache. • Scope: Global • Data Type: numeric • Introduced: MariaDB 5.3 Aria_pagecache_blocks_unused • Description: Free blocks in the Aria page cache. • Scope: Global • Data Type: numeric • Introduced: MariaDB 5.3 Aria_pagecache_blocks_used • Description: Blocks used in the Aria page cache. • Scope: Global • Data Type: numeric • Introduced: MariaDB 5.3 Aria_pagecache_read_requests • Description: The number of requests to read something from the Aria page cache.
  • 449. • Scope: Global • Data Type: numeric • Introduced: MariaDB 5.3 Aria_pagecache_reads • Description: The number of Aria page cache read requests that caused a block to be read from the disk. • Scope: Global • Data Type: numeric • Introduced: MariaDB 5.3 Aria_pagecache_write_requests • Description: The number of requests to write a block to the Aria page cache. • Scope: Global • Data Type: numeric • Introduced: MariaDB 5.3 Aria_pagecache_writes • Description: The number of blocks written to disk from the Aria page cache. • Scope: Global • Data Type: numeric • Introduced: MariaDB 5.3 Aria_transaction_log_syncs • Description: The number of Aria log fsyncs. • Scope: Global • Data Type: numeric • Introduced: MariaDB 5.3