MySQL. Most popular OpenSource RelationalDatabase Management system
http://www.mysql.com http://sourceforge.net/projects/mysql/
Probleme beim Import
- der Eintrag in .my.conf kann durch den Eintrag
max_allowed_packet=16M mehr Speicher für den Import bereitstellen
einrichten und starten
shell> groupadd mysql shell> useradd -g mysql mysql shell> cd /usr/local shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf - shell> ln -s full-path-to-mysql-VERSION-OS mysql shell> cd mysql shell> scripts/mysql_install_db --user=mysql shell> chown -R root . shell> chown -R mysql data shell> chgrp -R mysql . shell> bin/mysqld_safe --user=mysql &
user konfigurieren
mysql> GRANT ALL PRIVILEGES on dbname.* to 'ID'@'localhost' identified by 'PASSWORD';
passowort vergeben
mysql> GRANT ALL PRIVILEGES on dbname.* to 'ID'@'%' identified by 'PASSWORD';
Tabelen Zugriff ermöglichen
- 1. als root mysql ausführen .
- 2. use mysql;
- 3. update user set host='%' where user = 'destine';
- 4. update db set host='%' where user = 'destine';
- 5. flush privileges;
Überblick verschaffen
- show databases
- show tables
- show index from [table name]
- describe tablename
Fehlerbehebung
# cd /var/lib/mysql/mysql # myisamchk -r xxxxxx.* # -r : recovery, -o : safe recovery, -f : force
Konfiguration
[client] default-character-set=utf8 [mysqld] default-character-set=utf8 character-set-server=utf8 collation-server=utf8_general_ci [mysql] default-character-set=utf8
@mysql_query('set names utf8', $connect_db);
For Python,
1 db = MySQLdb.connect(
2 host='...',
3 user='...',
4 passwd='...',
5 read_default_file='/etc/mysql/my.cnf',
6 read_default_group='mysql')
Root Passwort setzen
# /etc/init.d/mysqld stop
# safe_mysqld --skip-grant-tables
# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.8-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> UPDATE mysql.user SET Password=PASSWORD('xxxx') where User='root';
Query OK, 5 rows affected (0.09 sec)
Rows matched: 5 Changed: 5 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> Bye
# /etc/init.d/mysql restart
-- DetlevLengsfeld 2006-11-25 14:29:00
Linux/MySql/Hints (last modified 2008-11-04 07:00:08)