====== Instaliranje mysql servera (konfiguracija i kompajliranje) ====== ===== Priprema za instalaciju ===== Potrebno je preuzeti instalacioni kod sa sledece adrese http://www.mysql.com/downloads/mysql/ (Generic Linux (Architecture Independent), Compressed TAR Archive)\\ \\ Neophodni paket potrebni za instalaciju. yum install kernel-devel mc gcc make ncurses-devel gcc-c++ openssl-devel libxml2-devel curl-devel libjpeg-devel libpng-devel aspell-devel zlib-devel freetype-devel libc-client-devel libmcrypt-devel GeoIP-devel autoconf libevent-devel krb5-devel libtool pcre-devel bzip2-devel openldap-devel \\ ===== Kompajliranje i instalacija ===== Sledeci korak je dodavanje mysql korisnika (http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s1-users-tools.html) useradd -r mysql\\ Raspakovanje instalacionog paketa. (http://www.gnu.org/s/tar/manual/tar.html) tar zxvf mysql-VERSION.tar.gz\\ Prelazimo u direktorijum raspakovanog instalacionog paketa mysql-VERSION cd mysql-VERSION\\ Konfigurisanje instalacije mysql servera (http://dev.mysql.com/doc/refman/5.1/en/source-configuration-options.html) ./configure --prefix=/usr/local/mysql-VERSION --with-plugins=innobase,partition --with-unix-socket-path=/var/lib/mysql/mysql.sock\\ Kompajliranje instalacije make\\ Instalacija make install\\ ===== Konfiguracija servera ===== Radi komotnijeg rada sa serverom pravimo sledeci symlink ln -s /usr/local/mysql-VERSION /usr/local/mysql\\ Kopiramo konfiguracioni fajl (http://dev.mysql.com/doc/refman/5.1/en/option-files.html) cp support-files/my-small.cnf /usr/local/mysql/my.cnf cd /usr/local/mysql\\ Menjamo vlasnika svih fajlova u /usr/local/mysql direktorijumu chown -R mysql .\\ Menjamo grupu korisnika svih fajlova u /usr/local/mysql direktorijumu chgrp -R mysql .\\ Pokrecemo MySql server (u ovom koraku nije potrebno da podesimo root nalog) bin/mysql_install_db --user=mysql\\ Postavljamo root nalog i brisemo sve test tabele (http://dev.mysql.com/doc/refman/5.1/en/mysql-secure-installation.html) /usr/local/mysql/bin/mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. You already have a root password set, so you can safely answer 'n'. Change the root password? [Y/n] Y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! 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... ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist ... Failed! Not critical, keep moving... - 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! \\ Posle inicijalizacije servera podesavamo dozvole nad fajlovima chown -R root . chown -R mysql var Podrazumevana lokacija data fajlova je /var/lib/mysql ln -s /var/lib/mysql /usr/local/mysql/var\\ ===== Skript za automatsko pokretanje servera ===== Da bi se MySql server automatski pokretao kreiramo sledeci fajl (http://dev.mysql.com/doc/refman/5.1/en/automatic-start.html) cp support-files/mysql.server /etc/init.d/mysql.server chmod +x /etc/init.d/mysql.server chkconfig --level 345 mysql.server on ili kraca verzija chkconfig mysql.server on\\ ===== Par korisnih saveta ... ===== Da ne biste morali stalno da kucate za pristupanje mysql shell-u mysql -uroot -pxxxx u svom home/username direktorijumu kreirajte .my.cnf fajl sa sledecim sadrzajem: [client] user=root password= -- lozinka za root nalog -- default-character-set=utf8 \\ Sada je dovoljno da otkucate mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.1.52 Source distribution Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> \\ Komanda za pokretanje MySql servera /etc/init.d/mysql.server start Komanda za stopiranje MySql servera /etc/init.d/mysql.server stop Komanda za restartovanje MySql servera /etc/init.d/mysql.server restart Podesavanje PATH-a echo 'export PATH=$PATH:/usr/local/mysql/bin' >> /etc/bashrc \\ \\ [[aleksandar.atanasijevic| Povratak]]