MySQL/mysqld: Unterschied zwischen den Versionen
Aus SchnallIchNet
< MySQL
Cbs (Diskussion | Beiträge) |
Cbs (Diskussion | Beiträge) |
||
Zeile 1: | Zeile 1: | ||
+ | __FORCETOC__ | ||
==Performance Tuning== | ==Performance Tuning== | ||
<pre> | <pre> | ||
Zeile 41: | Zeile 42: | ||
/etc/init.d/mysql start | /etc/init.d/mysql start | ||
+ | </pre> | ||
+ | |||
+ | ==Recover a MySQL root password.== | ||
+ | Stop the MySQL server process. <br/> | ||
+ | Start again with no grant tables. <br/> | ||
+ | Login to MySQL as root. <br/> | ||
+ | Set new password. <br/> | ||
+ | Exit MySQL and restart MySQL server. | ||
+ | <pre> | ||
+ | # /etc/init.d/mysql stop | ||
+ | # mysqld_safe --skip-grant-tables & | ||
+ | # mysql -u root | ||
+ | mysql> use mysql; | ||
+ | mysql> update user set password=PASSWORD("newrootpassword") where User='root'; | ||
+ | mysql> flush privileges; | ||
+ | mysql> quit | ||
+ | # /etc/init.d/mysql stop | ||
+ | # /etc/init.d/mysql start | ||
</pre> | </pre> | ||
Version vom 12. Januar 2010, 11:07 Uhr
Inhaltsverzeichnis
Performance Tuning
[mysqld] delay-key-write-for-all-tables skip-locking skip-innodb skip-networking set-variable = key_buffer=128M set-variable = max_allowed_packet=1M set-variable = table_cache=384 set-variable = sort_buffer=4M set-variable = record_buffer=1M set-variable = myisam_sort_buffer_size=16M set-variable = thread_cache=8 ####log = /var/log/mysql/mysql.log ####log-long-format ####log-slow-queries = /tmp/mysql.slow.queries.log ####set-variable = long_query_time = 5 ###log-bin ###server-id = 1
und alle halbe stunde ein cronJob wegen der Stabilitaet:
/usr/bin/mysql -u mysqlAdminUser --password=geheim --exec='FLUSH TABLES;'
Und dann einmal die woche wegen der Dicken Datenbank folgende 'hardlife' optimierung:
#!/bin/sh /etc/init.d/mysql stop cd /var/lib/mysql/$1 myisamchk --verbose --force --recover *.MYI myisamchk --verbose --sort-index *.MYI myisamchk --verbose --sort-records=1 *.MYI myisamchk --verbose --force --recover *.MYI myisamchk --verbose *.MYI /etc/init.d/mysql start
Recover a MySQL root password.
Stop the MySQL server process.
Start again with no grant tables.
Login to MySQL as root.
Set new password.
Exit MySQL and restart MySQL server.
# /etc/init.d/mysql stop # mysqld_safe --skip-grant-tables & # mysql -u root mysql> use mysql; mysql> update user set password=PASSWORD("newrootpassword") where User='root'; mysql> flush privileges; mysql> quit # /etc/init.d/mysql stop # /etc/init.d/mysql start
hotcopy backups
/usr/bin/mysqlhotcopy -u root -p My2Secure$Password sugarcrm /home/backup/database --allowold --keepold
Siehe auch
- Syntax --> MySQL Syntax beispiele
- Programming --> Functions, Trigger & Co.