Difference between revisions of "MySQL (Српски)"

From ArchWiki
Jump to: navigation, search
 
(10 intermediate revisions by 6 users not shown)
Line 1: Line 1:
[[Category:Daemons and system services (Српски)]]
 
 
[[Category:Database management systems (Српски)]]
 
[[Category:Database management systems (Српски)]]
[[Category:HOWTOs (Српски)]]
+
[[cs:MySQL]]
{{i18n|MySQL}}
+
 
[[de:MySQL]]
 
[[de:MySQL]]
 +
[[en:MySQL]]
 +
[[es:MySQL]]
 
[[fr:MySQL]]
 
[[fr:MySQL]]
 +
[[it:MySQL]]
 +
[[tr:MySQL]]
 +
[[zh-CN:MySQL]]
 +
MySQL jе siroko rasprostranjena SQL baza podataka koja ima vise niti i namenjena je za vise korisnika. Za vise informacija o funkcijama pogledajte [http://www.mysql.com/ oficijalnu home stranicu].
 +
== Instalacija ==
 +
Instalirajte {{Pkg|mysql}} paket.
  
MySQL is a widely spread, multi-threaded, multi-user SQL database. For more information about features, see the [http://www.mysql.com/ official homepage].
+
Nakon instalacije MySQL-a pokrenite skriptu za podesavanje kao root:
== Installation ==
+
Install the mysql package:
+
# pacman -S mysql
+
After installing MySQL you should run the setup script as root:
+
 
  # /etc/rc.d/mysqld start && mysql_secure_installation
 
  # /etc/rc.d/mysqld start && mysql_secure_installation
  
Then restart MySQL:
+
Zatim restartujte MySQL:
 
  # /etc/rc.d/mysqld restart
 
  # /etc/rc.d/mysqld restart
  
To start MySQL automatically at boot, edit /etc/rc.conf and add the mysqld daemon:
+
Da startujete MySQL automatski prilikom startovanja, editujte {{ic|/etc/rc.conf}} i dodajte {{ic|mysqld}} daemon:
 
  DAEMONS=(... mysqld ...)
 
  DAEMONS=(... mysqld ...)
  
== Configuration ==
+
== Konfigurisanje ==
Once you've started the MySQL server, you probably want to add a root account in order to maintain your MySQL users and databases. This can be done manually or automatically, as mentioned by the output of the above script. Either run the commands to set a password for the root account, or run the secure installation script.
+
Kada ste startovali MySQL server, verovatno cete zeleti da dodate root nalog kako bi ste mogli da odrzavate Vase MySQL korisnike i baze. Ovo se moze uraditi rucno ili automatski, kao sto je napomenuto u izlazu gornje skripte. Ili izvrsite komande da podesite sifru za root nalog, ili izvrsite sigurnosnu instalacionu skriptu.
  
You now should be able to do further configuration using your favorite interface. For example you can use MySQL's command line tool to login as root into your MySQL server:
+
Sada bi trebalo da mozete da nastavite sa daljim konfigurisanjem preko Vaseg omiljenog interfejsa. Naprimer, mozete da koristite MySQL-ovu komandnu liniju za prijavljivanje kao root na Vas MySQL server:
 
  $ mysql -p -u root
 
  $ mysql -p -u root
  
To start MySQL at bootup add {{Codeline|mysqld}} to the list of daemons in {{Filename|/etc/rc.conf}} or add {{Codeline|/etc/rc.d/mysqld start}} to {{Filename|/etc/rc.local}}.
+
Da startujete MySQL prilikom startovanja dodajte {{ic|mysqld}} u listu daemona u {{ic|/etc/rc.conf}}.
  
=== Enable remote access ===
+
=== Omogucite udaljeni pristup ===
The MySQL server does not listen on the TCP port 3306 by default. To allow (remote) TCP connections, comment the following line in {{Filename|/etc/mysql/my.cnf}}:
+
{{out of date}}
 +
MySQL server ne slusa na TCP portu 3306 po difoltu. Da dozvolite (udaljene) TCP konekcije, stavite pod komentar sledecu liniju u {{ic|/etc/mysql/my.cnf}}:
 
  skip-networking
 
  skip-networking
Remember to edit {{Filename|/etc/hosts.allow}} by adding the following lines:  
+
Zapamtite da izmenite {{ic|/etc/hosts.allow}} dodavanjem sledecih linija:
 
  mysqld: ALL : ALLOW
 
  mysqld: ALL : ALLOW
 
  mysqld-max: ALL : ALLOW
 
  mysqld-max: ALL : ALLOW
  
== Upgrading ==
+
== Osvezavanje ==
Might consider to run this command after you have upgraded MySQL and started it:
+
Pozeljno je izvrsiti ovu komandu nakon sto ste osvezili MySQL i startovali ga:
 
  # mysql_upgrade -u root -p
 
  # mysql_upgrade -u root -p
  
== Troubleshooting ==
+
== Resavanje problema ==
=== Mysql daemon can't start ===
+
=== Mysql daemon ne moze da startuje ===
If you see something like this:
+
Ako vidite nesto poput ovoga:
 
   # /etc/rc.d/mysqld restart
 
   # /etc/rc.d/mysqld restart
 
   :: Stopping MySQL  [FAIL]  
 
   :: Stopping MySQL  [FAIL]  
 
   :: Starting MySQL  [FAIL]
 
   :: Starting MySQL  [FAIL]
and no entry in log files, you might check permission of files in directories {{Filename|/var/lib/mysql}} and {{Filename|/var/lib/mysql/mysql}}. If owner of files in this directories isn't mysql:mysql, you should do following:
+
i nema unosa u log fajlovima, proverite dozvole fajlova u direktorijumima {{ic|/var/lib/mysql}} i {{ic|/var/lib/mysql/mysql}}. Ako vlasnik fajlova u ovim direktorijumima nije mysql:mysql, uradite sledece:
 
   # chown mysql:mysql /var/lib/mysql -R
 
   # chown mysql:mysql /var/lib/mysql -R
If you run into permission problems despite having followed the above ensure that your {{Filename|my.cnf}} is copied to /etc/:
+
Ako imate problema sa dozvolama uprkos sto ste pratili gornje uputstvo, uverite se da je Vas {{ic|my.cnf}} kopiran u /etc/:
 
   # cp /etc/mysql/my.cnf /etc/my.cnf
 
   # cp /etc/mysql/my.cnf /etc/my.cnf
Now try and restart the daemon.
+
Sada restartujte daemon.
  
If you get these messages in your {{Filename|/var/lib/mysql/hostname.err}}
+
Ako dobijete sledece poruke u Vasem {{ic|/var/lib/mysql/hostname.err}}
 
   [ERROR] Can't start server : Bind on unix socket: Permission denied
 
   [ERROR] Can't start server : Bind on unix socket: Permission denied
 
   [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?
 
   [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?
 
   [ERROR] Aborting
 
   [ERROR] Aborting
you should change permissions of {{Filename|/var/run/mysqld}} like so:
+
proverite dozvole od {{ic|/var/run/mysqld}} na sledeci nacin:
 
   # chown mysql:mysql /var/run/mysqld -R
 
   # chown mysql:mysql /var/run/mysqld -R
If you run mysqld and the following error appears:
+
Ako pokrecete mysqld i slececa greska se pojavljuje:
 
   Fatal error: Can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t exist
 
   Fatal error: Can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t exist
Run the following command to install the default tables:
+
Izvrsite sledecu komandu da instalirate difolt tabele:
 
   # mysql_install_db --user=mysql --ldata=/var/lib/mysql/
 
   # mysql_install_db --user=mysql --ldata=/var/lib/mysql/
  
=== Unable to run mysql_upgrade cause MySQL can't start. ===
+
=== Nije moguce pokrenuti mysql_upgrade jer MySQL ne moze da startuje. ===
Try run MySQL in safemode:
+
Pokusajte da izvrsite MySQL u safemode-u
 
  # mysqld_safe --datadir=/var/lib/mysql/
 
  # mysqld_safe --datadir=/var/lib/mysql/
And then run:
+
I zatim izvrsite:
 
  # mysql_upgrade -u root -p
 
  # mysql_upgrade -u root -p
  
=== How to Reset the Root Password ===
+
=== Kako da resetujete Root sifru ===
Stop mysqld daemon
+
Zaustavite mysqld daemon
 
  # /etc/rc.d/mysqld stop
 
  # /etc/rc.d/mysqld stop
 
  # mysqld_safe --skip-grant-tables &
 
  # mysqld_safe --skip-grant-tables &
Connect to mysql server
+
Konektujte se na mysql server
 
  # mysql -u root mysql
 
  # mysql -u root mysql
Change root password:
+
Promenite root sifru:
 
   mysql> UPDATE user SET password=PASSWORD("NEW_PASSWORD") WHERE User='root';
 
   mysql> UPDATE user SET password=PASSWORD("NEW_PASSWORD") WHERE User='root';
 
   mysql> FLUSH PRIVILEGES;
 
   mysql> FLUSH PRIVILEGES;
 
   mysql> exit
 
   mysql> exit
Then restart daemon:
+
Zatim restartujte daemon:
 
  # /etc/rc.d/mysqld restart
 
  # /etc/rc.d/mysqld restart
You're done
+
To bi trebalo da je to
  
== More Resources ==
+
== Vise izvora ==
* [[LAMP]] - Arch wiki article covering the setup of a LAMP server (Linux Apache MySQL PHP)
+
* [[LAMP (Српски)]] - Arch wiki clanak koji pokriva podesavanje LAMP servera (Linux Apache MySQL PHP)
 
* http://www.mysql.com/
 
* http://www.mysql.com/
* Frontend [http://aur.archlinux.org/packages.php?ID=42212 aur/mysql-gui-tools] [http://www.archlinux.org/packages/?q=mysql-workbench community/mysql-workbench]
+
* Front-end {{AUR|mysql-gui-tools}} {{AUR|mysql-workbench}}

Revision as of 06:56, 29 November 2012

MySQL jе siroko rasprostranjena SQL baza podataka koja ima vise niti i namenjena je za vise korisnika. Za vise informacija o funkcijama pogledajte oficijalnu home stranicu.

Instalacija

Instalirajte mysql paket.

Nakon instalacije MySQL-a pokrenite skriptu za podesavanje kao root:

# /etc/rc.d/mysqld start && mysql_secure_installation

Zatim restartujte MySQL:

# /etc/rc.d/mysqld restart

Da startujete MySQL automatski prilikom startovanja, editujte /etc/rc.conf i dodajte mysqld daemon:

DAEMONS=(... mysqld ...)

Konfigurisanje

Kada ste startovali MySQL server, verovatno cete zeleti da dodate root nalog kako bi ste mogli da odrzavate Vase MySQL korisnike i baze. Ovo se moze uraditi rucno ili automatski, kao sto je napomenuto u izlazu gornje skripte. Ili izvrsite komande da podesite sifru za root nalog, ili izvrsite sigurnosnu instalacionu skriptu.

Sada bi trebalo da mozete da nastavite sa daljim konfigurisanjem preko Vaseg omiljenog interfejsa. Naprimer, mozete da koristite MySQL-ovu komandnu liniju za prijavljivanje kao root na Vas MySQL server:

$ mysql -p -u root

Da startujete MySQL prilikom startovanja dodajte mysqld u listu daemona u /etc/rc.conf.

Omogucite udaljeni pristup

Tango-view-refresh-red.pngThis article or section is out of date.Tango-view-refresh-red.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:MySQL (Српски)#)

MySQL server ne slusa na TCP portu 3306 po difoltu. Da dozvolite (udaljene) TCP konekcije, stavite pod komentar sledecu liniju u /etc/mysql/my.cnf:

skip-networking

Zapamtite da izmenite /etc/hosts.allow dodavanjem sledecih linija:

mysqld: ALL : ALLOW
mysqld-max: ALL : ALLOW

Osvezavanje

Pozeljno je izvrsiti ovu komandu nakon sto ste osvezili MySQL i startovali ga:

# mysql_upgrade -u root -p

Resavanje problema

Mysql daemon ne moze da startuje

Ako vidite nesto poput ovoga:

 # /etc/rc.d/mysqld restart
 :: Stopping MySQL  [FAIL] 
 :: Starting MySQL  [FAIL]

i nema unosa u log fajlovima, proverite dozvole fajlova u direktorijumima /var/lib/mysql i /var/lib/mysql/mysql. Ako vlasnik fajlova u ovim direktorijumima nije mysql:mysql, uradite sledece:

 # chown mysql:mysql /var/lib/mysql -R

Ako imate problema sa dozvolama uprkos sto ste pratili gornje uputstvo, uverite se da je Vas my.cnf kopiran u /etc/:

 # cp /etc/mysql/my.cnf /etc/my.cnf

Sada restartujte daemon.

Ako dobijete sledece poruke u Vasem /var/lib/mysql/hostname.err

 [ERROR] Can't start server : Bind on unix socket: Permission denied
 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?
 [ERROR] Aborting

proverite dozvole od /var/run/mysqld na sledeci nacin:

 # chown mysql:mysql /var/run/mysqld -R

Ako pokrecete mysqld i slececa greska se pojavljuje:

 Fatal error: Can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t exist

Izvrsite sledecu komandu da instalirate difolt tabele:

 # mysql_install_db --user=mysql --ldata=/var/lib/mysql/

Nije moguce pokrenuti mysql_upgrade jer MySQL ne moze da startuje.

Pokusajte da izvrsite MySQL u safemode-u

# mysqld_safe --datadir=/var/lib/mysql/

I zatim izvrsite:

# mysql_upgrade -u root -p

Kako da resetujete Root sifru

Zaustavite mysqld daemon

# /etc/rc.d/mysqld stop
# mysqld_safe --skip-grant-tables &

Konektujte se na mysql server

# mysql -u root mysql

Promenite root sifru:

 mysql> UPDATE user SET password=PASSWORD("NEW_PASSWORD") WHERE User='root';
 mysql> FLUSH PRIVILEGES;
 mysql> exit

Zatim restartujte daemon:

# /etc/rc.d/mysqld restart

To bi trebalo da je to

Vise izvora