Benutzer-Werkzeuge

Webseiten-Werkzeuge


tachtler:mysql

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
tachtler:mysql [2012/05/08 22:55] klaustachtler:mysql [Unbekanntes Datum] (aktuell) – gelöscht - Externe Bearbeitung (Unbekanntes Datum) 127.0.0.1
Zeile 1: Zeile 1:
-====== MySQL ====== 
- 
-[[http://www.mysql.de/|{{:tachtler:index:mysql-48x48.png }}]] Die [[http://www.mysql.de/|MySQL]]-Datenbank ist eine der meist verbreitetsten **__noch__** **freien** Datenbanken und bei den allermeisten Linux-Distributoren als Installationspaket enthalten. Viele OpenSource-Projekte setzten und setzen die [[http://www.mysql.de/|MySQL]]-Datenbank ein. 
- 
-:!: **Hinweis** - **Die nachfolgenden Ausführungen erheben keinen Anspruch auf Vollständigkeit, sondern stellen eine "Basiskonfiguration" eins [[http://www.mysql.de/|MySQL]]-Datenbank-Servers für ein kleines privates Netzwerk dar!!!** 
- 
-Ab hier werden zur Ausführung nachfolgender Befehle **''root''**-Rechte benötigt. Um der Benutzer ''root'' zu werden, melden Sie sich bitte als ''root''-Benutzer am System an, oder wechseln mit nachfolgendem Befehl zum Benutzer ''root'': 
-<code> 
-$ su - 
-Password: 
-</code> 
- 
-===== Installation ===== 
- 
-Zur Installation eines [[http://www.mysql.de/|MySQL]]-Datenbank-Servers wird nachfolgendes Paket benötigt: 
-  * **''mysql-server''** - ist im ''base''-Repository von [[http://www.centos.org|CentOS]] enthalten 
-installiert werden. 
- 
-Zur Installation des [[http://www.mysql.de/|MySQL]]-Datenbank-Servers ist nachfolgender Befehl auszuführen: 
-<code> 
-# yum install mysql-server 
-Loaded plugins: fastestmirror 
-Loading mirror speeds from cached hostfile 
- * base: centos.intergenia.de 
- * extras: centos.intergenia.de 
- * updates: centos.intergenia.de 
-Setting up Install Process 
-Resolving Dependencies 
---> Running transaction check 
----> Package mysql-server.x86_64 0:5.1.52-1.el6_0.1 set to be updated 
---> Processing Dependency: mysql = 5.1.52-1.el6_0.1 for package: mysql-server-5.1.52-1.el6_0.1.x86_64 
---> Processing Dependency: perl-DBI for package: mysql-server-5.1.52-1.el6_0.1.x86_64 
---> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.52-1.el6_0.1.x86_64 
---> Processing Dependency: perl(DBI) for package: mysql-server-5.1.52-1.el6_0.1.x86_64 
---> Running transaction check 
----> Package mysql.x86_64 0:5.1.52-1.el6_0.1 set to be updated 
----> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 set to be updated 
----> Package perl-DBI.x86_64 0:1.609-4.el6 set to be updated 
---> Finished Dependency Resolution 
- 
-Dependencies Resolved 
- 
-================================================================================ 
- Package              Arch         Version                  Repository     Size 
-================================================================================ 
-Installing: 
- mysql-server         x86_64       5.1.52-1.el6_0.1         updates       8.1 M 
-Installing for dependencies: 
- mysql                x86_64       5.1.52-1.el6_0.1         updates       889 k 
- perl-DBD-MySQL       x86_64       4.013-3.el6              base          134 k 
- perl-DBI             x86_64       1.609-4.el6              base          705 k 
- 
-Transaction Summary 
-================================================================================ 
-Install       4 Package(s) 
-Upgrade       0 Package(s) 
- 
-Total download size: 9.8 M 
-Installed size: 28 M 
-Is this ok [y/N]: y 
-Downloading Packages: 
-(1/4): mysql-5.1.52-1.el6_0.1.x86_64.rpm                 | 889 kB     00:01      
-(2/4): mysql-server-5.1.52-1.el6_0.1.x86_64.rpm          | 8.1 MB     00:06      
-(3/4): perl-DBD-MySQL-4.013-3.el6.x86_64.rpm             | 134 kB     00:00      
-(4/4): perl-DBI-1.609-4.el6.x86_64.rpm                   | 705 kB     00:00      
--------------------------------------------------------------------------------- 
-Total                                           1.0 MB/s | 9.8 MB     00:09      
-Running rpm_check_debug 
-Running Transaction Test 
-Transaction Test Succeeded 
-Running Transaction 
-  Installing     : perl-DBI-1.609-4.el6.x86_64                              1/4  
-  Installing     : perl-DBD-MySQL-4.013-3.el6.x86_64                        2/4  
-  Installing     : mysql-5.1.52-1.el6_0.1.x86_64                            3/4  
-  Installing     : mysql-server-5.1.52-1.el6_0.1.x86_64                     4/ 
- 
-Installed: 
-  mysql-server.x86_64 0:5.1.52-1.el6_0.1                                         
- 
-Dependency Installed: 
-  mysql.x86_64 0:5.1.52-1.el6_0.1      perl-DBD-MySQL.x86_64 0:4.013-3.el6      
-  perl-DBI.x86_64 0:1.609-4.el6        
- 
-Complete! 
-</code> 
- 
-Mit nachfolgendem Befehl, kann der Inhalt des **Hauptpaketes - ''mysql-server''** aufgelistet werden: 
-<code> 
-# rpm -qil mysql-server 
-Name        : mysql-server                 Relocations: (not relocatable) 
-Version     : 5.1.52                            Vendor: CentOS 
-Release     : 1.el6_0.1                     Build Date: Sat 25 Jun 2011 07:53:02 AM CEST 
-Install Date: Thu 25 Aug 2011 12:49:51 PM CEST      Build Host: c6b6.bsys.dev.centos.org 
-Group       : Applications/Databases        Source RPM: mysql-5.1.52-1.el6_0.1.src.rpm 
-Size        : 24481725                         License: GPLv2 with exceptions 
-Signature   : RSA/8, Wed 06 Jul 2011 03:41:45 AM CEST, Key ID 0946fca2c105b9de 
-Packager    : CentOS BuildSystem <http://bugs.centos.org> 
-URL         : http://www.mysql.com 
-Summary     : The MySQL server and related files 
-Description : 
-MySQL is a multi-user, multi-threaded SQL database server. MySQL is a 
-client/server implementation consisting of a server daemon (mysqld) 
-and many different client programs and libraries. This package contains 
-the MySQL server and some accompanying files and directories. 
-/etc/rc.d/init.d/mysqld 
-/usr/bin/innochecksum 
-/usr/bin/myisam_ftdump 
-/usr/bin/myisamchk 
-/usr/bin/myisamlog 
-/usr/bin/myisampack 
-/usr/bin/mysql_convert_table_format 
-/usr/bin/mysql_fix_extensions 
-/usr/bin/mysql_fix_privilege_tables 
-/usr/bin/mysql_install_db 
-/usr/bin/mysql_secure_installation 
-/usr/bin/mysql_setpermission 
-/usr/bin/mysql_tzinfo_to_sql 
-/usr/bin/mysql_upgrade 
-/usr/bin/mysql_zap 
-/usr/bin/mysqlbug 
-/usr/bin/mysqld_multi 
-/usr/bin/mysqld_safe 
-/usr/bin/mysqldumpslow 
-/usr/bin/mysqlhotcopy 
-/usr/bin/mysqltest 
-/usr/bin/perror 
-/usr/bin/replace 
-/usr/bin/resolve_stack_dump 
-/usr/bin/resolveip 
-/usr/lib64/mysql/plugin 
-/usr/lib64/mysql/plugin/ha_archive.so 
-/usr/lib64/mysql/plugin/ha_archive.so.0 
-/usr/lib64/mysql/plugin/ha_archive.so.0.0.0 
-/usr/lib64/mysql/plugin/ha_blackhole.so 
-/usr/lib64/mysql/plugin/ha_blackhole.so.0 
-/usr/lib64/mysql/plugin/ha_blackhole.so.0.0.0 
-/usr/lib64/mysql/plugin/ha_example.so 
-/usr/lib64/mysql/plugin/ha_example.so.0 
-/usr/lib64/mysql/plugin/ha_example.so.0.0.0 
-/usr/lib64/mysql/plugin/ha_federated.so 
-/usr/lib64/mysql/plugin/ha_federated.so.0 
-/usr/lib64/mysql/plugin/ha_federated.so.0.0.0 
-/usr/libexec/mysqld 
-/usr/libexec/mysqlmanager 
-/usr/share/doc/mysql-server-5.1.52 
-/usr/share/doc/mysql-server-5.1.52/my-huge.cnf 
-/usr/share/doc/mysql-server-5.1.52/my-innodb-heavy-4G.cnf 
-/usr/share/doc/mysql-server-5.1.52/my-large.cnf 
-/usr/share/doc/mysql-server-5.1.52/my-medium.cnf 
-/usr/share/doc/mysql-server-5.1.52/my-small.cnf 
-/usr/share/man/man1/innochecksum.1.gz 
-/usr/share/man/man1/msql2mysql.1.gz 
-/usr/share/man/man1/myisam_ftdump.1.gz 
-/usr/share/man/man1/myisamchk.1.gz 
-/usr/share/man/man1/myisamlog.1.gz 
-/usr/share/man/man1/myisampack.1.gz 
-/usr/share/man/man1/mysql.server.1.gz 
-/usr/share/man/man1/mysql_convert_table_format.1.gz 
-/usr/share/man/man1/mysql_fix_extensions.1.gz 
-/usr/share/man/man1/mysql_fix_privilege_tables.1.gz 
-/usr/share/man/man1/mysql_install_db.1.gz 
-/usr/share/man/man1/mysql_secure_installation.1.gz 
-/usr/share/man/man1/mysql_setpermission.1.gz 
-/usr/share/man/man1/mysql_tzinfo_to_sql.1.gz 
-/usr/share/man/man1/mysql_upgrade.1.gz 
-/usr/share/man/man1/mysql_zap.1.gz 
-/usr/share/man/man1/mysqlbinlog.1.gz 
-/usr/share/man/man1/mysqlbug.1.gz 
-/usr/share/man/man1/mysqlcheck.1.gz 
-/usr/share/man/man1/mysqld_multi.1.gz 
-/usr/share/man/man1/mysqld_safe.1.gz 
-/usr/share/man/man1/mysqldumpslow.1.gz 
-/usr/share/man/man1/mysqlhotcopy.1.gz 
-/usr/share/man/man1/mysqlimport.1.gz 
-/usr/share/man/man1/mysqlman.1.gz 
-/usr/share/man/man1/mysqltest.1.gz 
-/usr/share/man/man1/perror.1.gz 
-/usr/share/man/man1/replace.1.gz 
-/usr/share/man/man1/resolve_stack_dump.1.gz 
-/usr/share/man/man1/resolveip.1.gz 
-/usr/share/man/man8/mysqld.8.gz 
-/usr/share/man/man8/mysqlmanager.8.gz 
-/usr/share/mysql/config.huge.ini 
-/usr/share/mysql/config.medium.ini 
-/usr/share/mysql/config.small.ini 
-/usr/share/mysql/errmsg.txt 
-/usr/share/mysql/fill_help_tables.sql 
-/usr/share/mysql/my-huge.cnf 
-/usr/share/mysql/my-innodb-heavy-4G.cnf 
-/usr/share/mysql/my-large.cnf 
-/usr/share/mysql/my-medium.cnf 
-/usr/share/mysql/my-small.cnf 
-/usr/share/mysql/mysql_fix_privilege_tables.sql 
-/usr/share/mysql/mysql_system_tables.sql 
-/usr/share/mysql/mysql_system_tables_data.sql 
-/usr/share/mysql/mysql_test_data_timezone.sql 
-/var/lib/mysql 
-/var/log/mysqld.log 
-/var/run/mysqld 
-</code> 
- 
-===== Dienst/Deamon-Start einrichten ===== 
- 
-Um einen [[http://www.mysql.de/|MySQL]]-Datenbank-Server, welcher als Dienst/Deamon als Hintergrundprozess läuft, auch nach einem Neustart des Servers zur Verfügung zu haben, soll der Dienst/Daemon mit dem Server mit gestartet werden, was mit nachfolgendem Befehl realisiert werden kann: 
-<code> 
-# chkconfig mysqld on 
-</code> 
- 
-Eine Überprüfung, ob beim Neustart des Server der ''mysqld''-Dienst/Deamon wirklich mit gestartet wird, kann mit nachfolgendem Befehl erfolgen und sollte eine Anzeige, wie ebenfalls nachfolgend dargestellt ausgeben: 
-<code> 
-# chkconfig --list | grep mysqld 
-mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off 
-</code> 
- 
-===== iptables Regel ====== 
- 
-Damit der [[http://www.mysql.de/|MySQL]]-Datenbank-Server auch erreichbar ist und nicht die Ergebnisse der Datenbank-Abfragen vom Paketfilter ''iptables'' blockiert werden, muss nachfolgende Regel zum ''iptables''-Regelwerk hinzugefügt werden. 
- 
-Um die aktuellen ''iptables''-Regeln erweitern zu können, sollten diese erst einmal aufgelistet werden, was mit nachfolgendem Befehl durchgeführt werden kann: 
-<code> 
-# iptables -L -nv --line-numbers 
-Chain INPUT (policy ACCEPT 0 packets, 0 bytes) 
-num   pkts bytes target     prot opt in     out     source               destination          
-1      141 15811 ACCEPT     all  --  *      *       0.0.0.0/           0.0.0.0/          state RELATED,ESTABLISHED  
-2        0     0 ACCEPT     icmp --  *      *       0.0.0.0/           0.0.0.0/           
-3        0     0 ACCEPT     all  --  lo           0.0.0.0/           0.0.0.0/           
-4        1    60 ACCEPT     tcp  --  *      *       0.0.0.0/           0.0.0.0/          state NEW tcp dpt:22   
-5        2    64 REJECT     all  --  *      *       0.0.0.0/           0.0.0.0/          reject-with icmp-host-prohibited  
- 
-Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) 
-num   pkts bytes target     prot opt in     out     source               destination           
-1        0     0 REJECT     all  --  *      *       0.0.0.0/           0.0.0.0/          reject-with icmp-host-prohibited  
- 
-Chain OUTPUT (policy ACCEPT 91 packets, 13277 bytes) 
-num   pkts bytes target     prot opt in     out     source               destination 
-</code> 
- 
-Nachfolgender Befehl, fügt folgende ''iptables''-Regeln dem ''iptables''-Regelwerk nach der **Position 4** hinzu, ohne das der Paketfilter angehalten werden muss: 
-  * <code>-A INPUT -p tcp --dport 3306 -j ACCEPT</code> 
-und hier die Befehle: 
-<code> 
-# iptables -I INPUT 5 -p tcp --dport 3306 -j ACCEPT 
-</code> 
- 
-Ein erneute Abfrage des ''iptables''-Regelwerts, sollte dann nachfolgend dargestellte Ausgabe ergeben, was mit folgendem Befehl durchgeführt werden kann: 
-<code> 
-# iptables -L -nv --line-numbers 
-Chain INPUT (policy ACCEPT 0 packets, 0 bytes) 
-num   pkts bytes target     prot opt in     out     source               destination          
-1      192 19567 ACCEPT     all  --  *      *       0.0.0.0/           0.0.0.0/          state RELATED,ESTABLISHED  
-2        0     0 ACCEPT     icmp --  *      *       0.0.0.0/           0.0.0.0/           
-3        0     0 ACCEPT     all  --  lo           0.0.0.0/           0.0.0.0/           
-4        1    60 ACCEPT     tcp  --  *      *       0.0.0.0/           0.0.0.0/          state NEW tcp dpt:22  
-5        0     0 ACCEPT     tcp  --  *      *       0.0.0.0/           0.0.0.0/          tcp dpt:3306   
-6        3    96 REJECT     all  --  *      *       0.0.0.0/           0.0.0.0/          reject-with icmp-host-prohibited  
- 
-Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) 
-num   pkts bytes target     prot opt in     out     source               destination          
-1        0     0 REJECT     all  --  *      *       0.0.0.0/           0.0.0.0/          reject-with icmp-host-prohibited  
- 
-Chain OUTPUT (policy ACCEPT 6 packets, 840 bytes) 
-num   pkts bytes target     prot opt in     out     source               destination 
-</code> 
- 
-Die neue Zeile ist an **Position 5 (INPUT)**  zu sehen, hier nachfolgend zur Verdeutlichung noch einmal dargestellt (**nur relevanter Ausschnitt**): 
-<code> 
-... 
-5        0     0 ACCEPT     tcp  --  *      *       0.0.0.0/           0.0.0.0/          tcp dpt:3306 
-... 
-</code> 
- 
-Um diese ''iptables''-Regel dauerhaft, auch nach einem Neustart des Server, weiterhin im ''iptables''-Regelwerk zu speichern, muss nachfolgend dargestellter Befehl abschließend noch ausgeführt werden: 
-<code> 
-# service iptables save 
-iptables: Saving firewall rules to /etc/sysconfig/iptables: OK  ] 
-</code> 
- 
-===== Basis-Konfiguration ==== 
- 
-Bevor der erste Start des [[http://www.mysql.de/|MySQL]]-Server durchgeführt wird, **können** noch Anpassungen in der Konfigurationsdatei 
-  * **''/etc/my.cnf''** 
-durchgeführt werden. 
- 
-Nach der Installation des [[http://www.mysql.de/|MySQL]]-Server, sieht der Inhalt der Konfigurationsdatei **''/etc/my.cnf''** wie nachfolgend dargestellt aus (**Standardeinstellungen - komplette Konfigurationsdatei**): 
-<code ini> 
-[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 
- 
-[mysqld_safe] 
-log-error=/var/log/mysqld.log 
-pid-file=/var/run/mysqld/mysqld.pid 
-</code> 
- 
-:!: **HINWEIS** - **Ein Liste der Möglichen Optionen ist unter nachfolgendem externen Link zu finden:** 
-  * [[http://dev.mysql.com/doc/refman/5.1/de/server-options.html|http://dev.mysql.com/doc/refman/5.1/de/server-options.html]] 
- 
-==== lost+found Konfiguration ==== 
- 
-Eins **Beispiel** für eine Anpassung wäre, dass das Dateisystem in dem der [[http://www.mysql.de/|MySQL]]-Server die Verzeichnisse und Dateien beim ersten Start anlegt, auf einer eigenen Festplatte oder einem eignen **Volume** in einer **VolumeGroup** liegen und hier ein Verzeichnis des Dateisystem vom Dateisystem angelegt wird, dass den Namen 
-  * **''lost+found''** 
-trägt. 
- 
-Dies kann zu **unerwünschten** Eintragungen im LOG des [[http://www.mysql.de/|MySQL]]-Server führen, wie nachfolgen dargestellt: 
-<code> 
-... 
-110825 13:32:20 [ERROR] Invalid (old?) table or database name 'lost+found' 
-... 
-</code> 
- 
-Um dies zu vermeiden, kann der Speicherort im Dateisystem, in dem der [[http://www.mysql.de/|MySQL]]-Server die Verzeichnisse und Dateien für die Datenbanken ablegt wie nachfolgend gezeigt verändert werden. 
- 
-Die Anpassungen sind in der Konfigurationsdatei **''/etc/my.cnf''** vorzunehmen und in diesem Beispiel, durch voranstellen eines Kommentars im Format: 
-<code> 
-# Tachtler 
-</code> 
-gekennzeichnet. 
- 
-Hier eine mögliche Anpassung (**komplette Konfigurationsdatei**): 
-<code ini> 
-[mysqld] 
-# Tachtler 
-# default: datadir=/var/lib/mysql 
-datadir=/var/lib/mysql/data 
-socket=/var/lib/mysql/mysql.sock 
-user=mysql 
-# Disabling symbolic-links is recommended to prevent assorted security risks 
-symbolic-links=0 
- 
-[mysqld_safe] 
-log-error=/var/log/mysqld.log 
-pid-file=/var/run/mysqld/mysqld.pid 
-</code> 
- 
-===== Erster Start ===== 
- 
-Bevor **__weitere__** **Konfigurationsschritte** erfolgen, sollte dem **ersten Start** nichts im Wege stehen, da bereits **hier Konfigurationseinstellungen** durchgeführt werden, was mit nachfolgendem Befehl durchgeführt werden kann: 
-<code> 
-# service mysqld start 
-Initializing MySQL database:  Installing MySQL system tables... 
-OK 
-Filling help tables... 
-OK 
- 
-To start mysqld at boot time you have to copy 
-support-files/mysql.server to the right place for your system 
- 
-PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! 
-To do so, start the server, then issue the following commands: 
- 
-/usr/bin/mysqladmin -u root password 'new-password' 
-/usr/bin/mysqladmin -u root -h rechner30.dmz.tachtler.net password 'new-password' 
- 
-Alternatively you can run: 
-/usr/bin/mysql_secure_installation 
- 
-which will also give you the option of removing the test 
-databases and anonymous user created by default.  This is 
-strongly recommended for production servers. 
- 
-See the manual for more instructions. 
- 
-You can start the MySQL daemon with: 
-cd /usr ; /usr/bin/mysqld_safe & 
- 
-You can test the MySQL daemon with mysql-test-run.pl 
-cd /usr/mysql-test ; perl mysql-test-run.pl 
- 
-Please report any problems with the /usr/bin/mysqlbug script! 
- 
-                                                            OK  ] 
-Starting mysqld:                                            OK  ] 
-</code> 
- 
-==== MySQL-Server Überprüfung ==== 
- 
-Ob der [[http://www.mysql.de/|MySQL]]-Server, sprich der ''mysqld''-Dienst/Deamon auch tatsächlich als Hintergrundprozess läuft, kann mit nachfolgendem Befehl überprüft werden (Es sollte eine Ausgabe wie nachfolgend dargestellt erfolgen - es kommt auf die **zweite** und **dritte** Zeile an!): 
-<code> 
-# ps auxwwwf | grep mysqld 
-root      2571  0.0  0.0 103148   828 pts/0    S+   16:34   0:00                      \_ grep mysqld 
-root      2455  0.0  0.1 108076  1516 pts/0    S    16:33   0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql/data  
---socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql 
-mysql     2544  0.2  2.7 367240 28496 pts/0    Sl   16:33   0:00  \_ /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql/data  
---user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock 
-</code> 
- 
-Eine weitere Überprüfung, ob der **erste Start** erfolgreich war, kann durch Einsicht der LOG-Dateien 
-  * **''/var/log/mysqld.log''** 
-durchgeführt werden. 
- 
-Ausgabe der LOG-Datei **''/var/log/mysqld.log''** mit nachfolgendem Befehl, die Ausgabe sollte wie nachfolgend dargestellt aussehen: 
-<code> 
-# cat /var/log/mysqld.log 
-110825 16:33:13 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql/data 
-InnoDB: The first specified data file ./ibdata1 did not exist: 
-InnoDB: a new database to be created! 
-110825 16:33:13  InnoDB: Setting file ./ibdata1 size to 10 MB 
-InnoDB: Database physically writes the file full: wait... 
-110825 16:33:14  InnoDB: Log file ./ib_logfile0 did not exist: new to be created 
-InnoDB: Setting log file ./ib_logfile0 size to 5 MB 
-InnoDB: Database physically writes the file full: wait... 
-110825 16:33:14  InnoDB: Log file ./ib_logfile1 did not exist: new to be created 
-InnoDB: Setting log file ./ib_logfile1 size to 5 MB 
-InnoDB: Database physically writes the file full: wait... 
-InnoDB: Doublewrite buffer not found: creating new 
-InnoDB: Doublewrite buffer created 
-InnoDB: Creating foreign key constraint system tables 
-InnoDB: Foreign key constraint system tables created 
-110825 16:33:14  InnoDB: Started; log sequence number 0 0 
-110825 16:33:14 [Note] Event Scheduler: Loaded 0 events 
-110825 16:33:14 [Note] /usr/libexec/mysqld: ready for connections. 
-Version: '5.1.52'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution 
-</code> 
- 
-Durch nachfolgenden Befehl, kann das Verzeichnis in dem die [[http://www.mysql.de/|MySQL]]-Datenbank standardmäßig die Dateien der einzelnen Datenbanken ablegt, angezeigt werden. Die Ausgabe sollte in etwa wie nachfolgend gezeigt aussehen: 
-<code> 
-# ll /var/lib/mysql/data/ 
-total 20488 
--rw-rw----. 1 mysql mysql 10485760 Aug 25 16:33 ibdata1 
--rw-rw----. 1 mysql mysql  5242880 Aug 25 16:33 ib_logfile0 
--rw-rw----. 1 mysql mysql  5242880 Aug 25 16:33 ib_logfile1 
-drwx------. 2 mysql mysql     4096 Aug 25 16:33 mysql 
-drwx------. 2 mysql mysql     4096 Aug 25 16:33 test 
-</code> 
- 
-==== MySQL-Server Zugriff ==== 
- 
-Direkt nach der Installation und dem ersten Start des [[http://www.mysql.de/|MySQL]]-Datenbank-Servers, kann durch nachfolgenden Befehl, die korrekt Funktionsweise überprüft werden: 
-<code> 
-# mysqladmin version 
-mysqladmin  Ver 8.42 Distrib 5.1.52, for unknown-linux-gnu on x86_64 
-Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. 
-This software comes with ABSOLUTELY NO WARRANTY. This is free software, 
-and you are welcome to modify and redistribute it under the GPL license 
- 
-Server version          5.1.52 
-Protocol version        10 
-Connection              Localhost via UNIX socket 
-UNIX socket             /var/lib/mysql/mysql.sock 
-Uptime:                 10 min 6 sec 
- 
-Threads: 1  Questions: 2  Slow queries: 0  Opens: 15  Flush tables: 1  Open tables: 8  Queries per second avg: 0.3 
-</code> 
- 
-Ein **erstes Zugriff** kann mit nachfolgendem Befehl durchgeführt werden, welche eine Ausgabe in etwa wie nachfolgend dargestellt, erzeugen sollte: 
-<code> 
-# mysql -e "SELECT Host,Db,User FROM db" mysql 
-+------+---------+------+ 
-| Host | Db      | User | 
-+------+---------+------+ 
-| %    | test    |      | 
-| %    | test\_% |      | 
-+------+---------+------+ 
-</code> 
- 
-==== MySQL-Monitor ==== 
- 
-Der [[http://www.mysql.de/|MySQL]]-Monitor ist eine Art ''shell'', welche Befehle gegen den [[http://www.mysql.de/|MySQL]]-Datenbank-Server ausführen  kann.  
- 
-Der [[http://www.mysql.de/|MySQL]]-Monitor erfordert eine Anmeldung, welche als z.B. Benutzer ''root'' **und noch ohne Passwort-Abfrage** wie folgt aussehen kann: 
-<code> 
-# mysql -h localhost -u root 
-Welcome to the MySQL monitor.  Commands end with ; or \g. 
-Your MySQL connection id is 8 
-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> 
-</code> 
- 
-Beendet wird diese Art von ''shell'' durch nachfolgenden Befehl: 
-<code> 
-mysql> quit 
-Bye 
-</code> 
- 
-===== Sicherheits-Konfiguration ==== 
- 
-Wie bereits beim **ersten Start** in den **Start-Meldungen** zu lesen war, werden gewisse **sicherheitsrelevanten** Einstellungen nach erfolgreicher Installation **empfohlen**, gerade in **produktiven** [[http://www.mysql.de/|MySQL]]-Datenbank-Server Installationen. 
- 
-Um nachfolgende **sicherheitsrelevanten** Einstellungen zu realisieren, 
-  * Benutzer **''root''** durch setzen eines **Passwortes** schützen 
-  * **Anonyme Benutzerkonten** entfernen 
-  * Deaktivieren des Zugriffs des Benutzers **''root''** vie **Remote/Entfernten**-Zugriff  
-  * **Nicht benötigte Datenbanken**, wie z.B. die Datenbank **''test''** entfernen 
-kann das Script, 
-  * **''/usr/bin/mysql_secure_installation''** 
-genutzt, bzw. ausgeführt werden, was mit nachfolgendem Befehl durchgeführt werden kann: 
-<code> 
-# /usr/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. 
- 
-Set 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... 
- ... 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! 
- 
- 
-</code> 
- 
-===== LOG-Rotate Konfiguration===== 
- 
-Um das Anwachsen von LOG-Dateien unter Linux, nicht ins unermessliche hinnehmen zu müssen, kann die LOG-Datei des [[http://www.mysql.de/|MySQL]]-Datenbank-Server durch die Definition einer einfachen Konfigurationsdatei im Verzeichnis  
-  * **''/etc/logrotate.d/''** 
-wie nachfolgend dargestellt, verhindert werden. 
- 
-Dazu wird eine Datei mit dem Namen, hier z.B.  
-  * **''mysql''** 
-mit dem Editor ''vi'' oder ''vim'' wie folgt erstellt (Kenntnisse des ''vi''-Editors, werden vorausgesetzt): 
- 
-Der Befehl zum erstellen der Konfiguratiosndatei **''/etc/logrotate.d/mysql''** lautet: 
-<code> 
-# vim /etc/logrotate.d/mysql 
-</code> 
-und **könnte** nachfolgend dargestellten Inhalt aufweisen: 
-<code ini> 
-/var/log/mysqld.log { 
-    rotate 4 
-    weekly 
-    compress 
-    notifempty 
-    size 5M 
-    missingok 
-    create 0640 mysql mysql 
-    sharedscripts 
-    postrotate 
-        /bin/kill -HUP `cat /var/run/mysqld/mysqld.pid 2> /dev/null` 2> /dev/null || true 
-    endscript 
-} 
-</code> 
- 
-**__Erklärung:__** 
- 
-Es wird die LOG-Datei - **''/var/log/mysqld.log''** 
-  * es werden nur 4 historische LOG-Dateien aufgehoben, bevor die älteste überschrieben wird 
-  * und es wird wöchentlich rotiert und dabei 
-  * wird die rotierte LOG-Datei komprimiert (gzip) aber 
-  * nur wenn diese **nicht leer** ist 
-  * oder eine Größe von 5MB hat 
-  * mit den Dateirechten 0640 
-  * und den Besitzrechten mysql:mysql 
-  * durch Anhalten und Neustart der des [[http://www.mysql.de/|MySQL]]-Datenbank-Servers 
-rotiert! 
  
tachtler/mysql.1336510536.txt.gz · Zuletzt geändert: 2012/05/08 22:55 von klaus