MySQL-ஐ install செய்தல்
MySQL-ஐ install செய்யும்போது, நாம் கவனிக்க வேண்டிய விஷயங்கள் பின்வருமாறு.
* MySQL-ஐ install செய்வதற்கு நமக்கு அனுமதி இருக்க வேண்டும். பொதுவாக MySQL-ன் ஒரு பிரதியை நமது machine-ல் install செய்து கொள்வது நல்லது. இதை மிகவும் கடினமான விஷயமாக எண்ணி வருந்தத் தேவையில்லை. ஏனெனில் BSD, LinuX, Mac OS X, Solaris மற்றும் windows போன்ற பெரும்பாலான platform-ல் இந்த MySQL-ஆனது எளிதாக install செய்யப்படும்.
* MySQL server-ஐ அணுகுவதற்கு அனைத்து permissions-ஐயும் கொண்ட ஒரு account இருக்க வேண்டும். பொதுவாக MySQL-ஐ முதன்முதலில் install செய்யும்போது உருவாக்கப்படும் root account இவ்வாறு அனைத்து permissions-ஐயும் கொண்டதாக அமையும்.
* பின்னர் ஒரு MySQL client தேவை. பொதுவாக MySQL command-line அல்லது MySQL query browser ஆகியவற்றைப் பயன்படுத்துவது சிறந்தது. இந்தப் பகுதியில் உள்ள அனைத்து உதாரணங்களும் MySQL command-line-ஐக் கருத்தில் கொண்டே கொடுக்கப்பட்டுள்ளன.
1.3.1 Ubuntu Linux-ல் MySQL-ஐ install செய்தல்
சமீபத்திய உபுண்டு லினக்ஸ் நிறுவும் வழிகளை இங்கு காண்போம். இது debian மற்றும் ubuntu சார்ந்த Linux Mint distribution-களுக்கும் பொருந்தும்.
Terminal-ல் கீழ்வரும் கட்டளையைத் தரவும்.
sudo apt-get install mysql-server mysql-client
இப்போது MySQL-க்குத் தேவையான மென்பொருட்கள் அனைத்தும் repository-ல் இருந்து download ஆகி install செய்யப்படும். இப்போது MySQL-ன் root user-க்கான password கேட்கப்படும். மிகவும் சிக்கலான சொல்லையே password ஆக தர வேண்டும்.
MySQL-ன் செயல்பாடுகளை மேலும் பாதுகாக்க கீழ்வரும் கட்டளையை இயக்கவும்.
sudo mysql_secure_installation
இது பின்வரும் பணிகளைச் செய்கிறது.
1. Anonymous users-ஐ நீக்குதல்
2. localhost-ல் இருந்து மட்டுமே root-ஐ அனுமதித்தல்
3. test database-ஐ நீக்குதல்
மேற்கண்ட கட்டளையைக் கொடுத்த உடன், கீழ்கண்டவாறு வரிசையாக பதில்களைக் கொடுத்து Enter அடிக்கவும்.
By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.
Remove anonymous users? [Y/n] y
… Success!
Normally, root should only be allowed to connect from ‘localhost’. This ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
… Success!
By default, MySQL comes with a database named ‘test’ that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.
Remove test database and access to it? [Y/n] y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!
Reloading the privilege tables will ensure that all changes made so far will take effect immediately.
Reload privilege tables now? [Y/n] y
… Success!
Cleaning up…
All done! If you’ve completed all of the above steps, your MySQL installation should now be secure.
Thanks for using MySQL!
அவ்வளவுதான் MySQL-ஐ நிறுவிவிட்டோம்.
1.3.1.1 Configuration
இப்போது MySQL-ன் பல்வேறு configuration options-ஐப் பற்றிப் பார்ப்போம்.
/etc/mysql என்ற directory-தான் MySQL-ன் config directory ஆகும்.
/etc/mysql/my.cnf என்ற file ஆனது MySQL-ன் மொத்த configuration options-ஐயும் கொண்டுள்ளது.
Log file, port number, ip binding, performance என பல்வேறு options உள்ளன. இதில் சில options பற்றி இங்கே பார்ப்போம்.
port=3306
இது MySQL server -ஆனது 3306 என்ற port-ல் இயங்குவதைக் குறிக்கிறது.
user=mysql
லினக்ஸில் mysql என்ற user உருவாகி, அதே user-ஆக server இயங்கும். இதனால் லினக்ஸ் server-ன் பாதுகாப்பு அதிகரிக்கிறது.
data dir = /var/lib/mysql
MySQL-ன் database அனைத்தும் இந்த folder-ல் சேமிக்கப்படுகின்றன. Backup செய்யும் போது, இந்த folder-ஐ கண்டிப்பாக backup செய்ய வேண்டும்.
bind-address = 127.0.0.1
எந்த ip address-ல் MySQL server இயங்க வேண்டும் என இங்கே தரலாம்.
log_error = /var/log/mysql/error.log
Configuration அல்லது connection-ல் பிழை இருந்தால் இந்த file-ல் log செய்யப்படுகிறது.
1.3.1.2 Query cache
MySQL server-ல் அடிக்கடி இயங்கும் select queries-ம், results-ம் cache-ல் சேமித்து வைக்கப்படும். இதனால், server-ன் திறனும் வேகமும் அதிகரிக்கிறது. இதற்கான options பின்வருமாறு.
query_cache_limit = 1m
query_cache_size = 16m
இங்கு m என்பது mb ஆகும். நமது RAM-ன் அளவைப் பொறுத்து இதை அதிகரிக்கலாம். உதாரணம்.
query_cache_limit = 2m
query_cache_size=32m
இந்த my.cnf file-ல் எந்த மாற்றம் செய்தாலும், MySQL server-ஐ restart செய்ய வேண்டும்.
MySQL server-ஐ restart செய்தல்
sudo service mysql restart
MySQL server-ஐ stop செய்தல்
sudo service mysql stop
MySQL server-ஐ start செய்தல்
sudo service mysql start
1.3.1.3 MySQL clients
Command line client மட்டுமின்றி GUI வழியாக, MySQL-ஐ பயன்படுத்த பல்வேறு clients உபுண்டு லினக்ஸில் உள்ளன.
MySQL Work Bench
sudo apt-get install MySQL-workbench
MySQL Navigator
sudo apt-get install MySQL-navigator
Emma
sudo apt-get install emma
MySQL Admin
sudo apt-get install MySQL-admin
PHPMyAdmin
sudo aptitude install phpmyadmin
(தொடர்ந்து வரும்)