Difference between revisions of "MySQL"

From Dietrich Blog (Strato)
Jump to: navigation, search
(Datenbankadministration)
(Remote Access)
Line 119: Line 119:
  
 
== Remote Access ==
 
== Remote Access ==
Manchmal möchte man von einem anderen Computer auf den MySQL-Datenbank-Server zugreifen; z.B. schon im einegen [[LAN]] weil man etwas kopieren will oder zu einem Server bei einem [[WebHostingProvider]], wo man eine MySQL-Anwendung gehosted hat (z.B. ein [[MediaWiki]], [[Joomla]],  [[WordPress]], oder, oder...).
+
Manchmal möchte man von einem anderen Computer auf den MySQL-Datenbank-Server zugreifen; z.B. schon im eignen [[LAN]] weil man etwas kopieren will oder zu einem Server bei einem [[WebHostingProvider]], wo man eine MySQL-Anwendung gehosted hat (z.B. ein [[MediaWiki]], [[Joomla]],  [[WordPress]], oder, oder...).
  
 
== Installalation ODBC-Treiber ==
 
== Installalation ODBC-Treiber ==

Revision as of 12:04, 29 March 2008

MySQL das führende Open-Source-Datenbanksystem

MySQL ist in meiner Anwendungsarchitektur das Datenbank-System der ersten Wahl (siehe auch: OpenSourceSoftware).

Siehe auch: Unicode

Installation Server

  • Definitive Software Library ID: MySQL
  • Name: MySQL
  • Version: 5.0.41-community-nt (ComputerGraumann) und 5.0.41-community-nt (ComputerKragenbaer)
  • Hersteller/Bezugsquelle: http://www.mysql.com
  • Installationsordner: D:\bin\MySQL
  • Konfigurationsdateien: D:\bin\MySQL\my.ini ---> Datensicherung
  • Programmstart: Windows-Service MySQL
  • InnoDB tablespace: InstallDir......

Konfiguration

my.ini

Eine Konfigurationsdatei my.cnf wird nicht verwendet. Alles steht in my.ini.
Die wichtigsten Einträge in der Konfigurationsdatei my.ini sind:

# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]

port=3306

[mysql]

default-character-set=utf8

und

# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this 
# file.
#
[mysqld]

# The TCP/IP Port the MySQL Server will listen on
port=3306


#Path to installation directory. All paths are usually resolved relative to this.
basedir="D:/bin/MySQL/"

#Path to the database root
datadir="D:/var/MySQL/data/"

# The default character set that will be used when a new schema or table is
# created and no character set is defined
default-character-set=utf8

# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB

Show Variables

mysql> show variables like "%character%";

Variable_name Value
character_set_client utf8
character_set_connection utf8
character_set_database utf8
character_set_results utf8
character_set_server utf8
character_set_system utf8
character_sets_dir \xampp\mysql\share\charsets/


mysql> show variables like "%collation%";

Variable_name Value
collation_connection utf8_general_ci
collation_database utf8_general_ci
collation_server utf8_general_ci

Datenbankadministration

  • User-Id für Administrator (root) mit Passwort versehen
  • User-Id (ghost) gelöscht
  • Datenbank-Backup / Datensicherung : d:\bin\jobs\backupMySQL.bat

Remote Access

Manchmal möchte man von einem anderen Computer auf den MySQL-Datenbank-Server zugreifen; z.B. schon im eignen LAN weil man etwas kopieren will oder zu einem Server bei einem WebHostingProvider, wo man eine MySQL-Anwendung gehosted hat (z.B. ein MediaWiki, Joomla, WordPress, oder, oder...).

Installalation ODBC-Treiber

Der aktuelle ODBC-Treiber für MySQL kommt direkt von www.mysql.com und trägt die Bezeichnung MySQL Connector/ODBC 3.5.1.

Installation JDBC-Treiber

Der berühmte Treiber von Mark Matthews (1998) (OpenSourceSoftware "MM.MySQL") wird seit August 2002 von MySQL unter der Bezeichnung MySQL Connector/J 3.0 offiziell unterstützt (Java). Mark Matthews verstärkt jetzt das MySQL-Team.

  • Definitive Software Library ID: MySQL_JDBC
  • Name: MySQL Connector/J
  • Version: 3.0.15
  • Hersteller/Bezugsquelle: http://www.mysql.com/downloads
  • Installations-Ordner: {$JAVA_HOME}\jre\lib\ext Beispielsweise d:\Programme\Java\jdk1.5.0_04\jre\lib\ext
  • Installation: Kopieren der Datei mysql-connector-java-3.0.15-ga-bin.jar in den Installationsordner
  • Informationen zur Benutzung
    • Klasse: com.mysql.jdbc.Driver
    • URL: jdbc:mysql://localhost/datenbankname

Problems and Solutions

My SQL 4.1 verwendet zum Passwort-Hashing SHA1 (160 Bit = 40 Zeichen) Infos: http://pajhome.org.uk/crypt/md5/

Workaround

Angeblich soll das Problem mit der PHP MySQL client library (libmysql.dll) auch durch ein Upgrade von PHP nicht gelöst werden können. Daher habe ich das von MySql veröffentlichte Workaraound [[1]] benutzt:

  • Reset the password to pre-4.1 style for each user that needs to use a pre-4.1 client program. This can be done using the SET PASSWORD statement and the OLD_PASSWORD() function:
    • mysql> SET PASSWORD FOR wikiuser@localhost = OLD_PASSWORD('newpwd');
  • Tell the server to use the older password hashing algorithm:
    • Start mysqld with the --old-passwords option. (Eingetragen in: my.ini  ???)
User Password Hash Application
root lotusnotes SHA1 ...
knowhowuser ... old Know...
mediauser ... old MediaWiki
linkuser ... old PhpLinks
owluser ... old Owl
pmauser ... old PhpMyAdmin
wikiuser ... old Wiki

MySql Clients

Siehe: DatenbankFrontends

Datenbanken

Datenbankname Nutzung
asom Application Sizing Modell
fruits Für SQL-Workshop im PhpWorkshop
gmo Migrierte GMO-Access-Datenbanken
joomla für WebsiteJoomla
knowhow Mein KnowlegeManagement: phpKnowhow
medien MediaLibrary mit Videos etc.
mysql Die Standard-Datenbank von MySQL
owl Owl DokumentenManagement
phplinks Anwendung PhpLinks (Link-Management)
phpwiki Mein altes phpwiki (migriert nach TWiki)
telefonbuch Telefonnummern zur Inverssuche (u.a.)
test Die Standard-Test-Datenbank von MySQL
wikicons MediaWiki WebsiteWikiConsulting
wikifaulkner MediaWiki WebsiteMonikaFaulkner
wikikracht MediaWiki WebsiteWiki
wikilexikon MediaWiki WebsiteLexikon
wordpress WordPress
xanadu Meine Archiv-Datenbank (Anwendung Archivierung)

Notizen zu MySQL

Volltext-Index

Anlegen einer Tabelle mit Volltext-Index:

	 CREATE TABLE articles  (
		 id  INT UNSIGGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
		 title VARCHAR(200),
		 body	TEXT,
		 FULLTEXT(title,body)
	 );

Beispielhafte Such-Anfragen über den Volltext-Index:

	 SELECT * FROM articles WHERE MATCH(title,body) AGAINST('nadel');
	 SELECT *,MATCH(title,body) AGAINST('nadel') as Score  FROM articles WHERE MATCH(title,body) AGAINST('nadel');
	 SELECT * FROM articles WHERE MATCH(title,body) AGAINST('+nadel -streifen' IN BOOLEAN MODE);


-- Main.DietrichKracht - 17 May 2004