Albert Einstein:
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.
(zum Sprucharchiv)
MySQL
Vor dem ersten Start des Servers
Bevor man den Mysql-Server das erste mal startet, sollte man das Verzeichnis /var/lib/mysql/mysql löschen. Danach dann (als User root):
mysql_install_db --user=mysql
Hierdurch wird die "mysql"-Datenbank neu erstellt.
Setzen des "root"-Passwortes
Als nächstes sollte man das "root"-Passwort setzten:Wie man das Root-Passwort bei mysql setzt
Ablauf von SQL-Scripten
Die drupal-Datenbank, die man bei 1und1 entladen hat (liegt unter /data/data1/israel-network/db40.puretec.de.sql), kann man als User "cw" mit dem Befehl
mysql < db40.puretec.de.sql
der mysql-Instanz hinzufügen.
Rechtevergabe an den Drupal-Datenbankuser
In diesem Falle der User 'cw', root ruft mysql auf und vergibt dann das Recht:
grant all on db181829985.* to 'cw'@'localhost' identified by 'blablabla';
Erst nach diesem Statement kann der User cw mittels mysql auf die Datenbank zugreifen. Zuvor bekam 'cw' immer eine Fehlermeldung:
cw@gisevius:~> mysql -p db181829985 Enter password: ERROR 1045 (28000): Access denied for user 'cw'@'localhost' (using password: YES)
Die Ausgabe des show grants Statements ist irreführend:
mysql> show grants for cw; +---------------------------------------------------------------------------------------------------+ | Grants for cw@% | +---------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'cw'@'%' IDENTIFIED BY PASSWORD '*A1E2A5ED8A153592D333B5AECA9783EA238D6AD6' | | GRANT ALL PRIVILEGES ON `db181829985`.* TO 'cw'@'%' WITH GRANT OPTION | +---------------------------------------------------------------------------------------------------+ 2 rows in set (0.00 sec)
GUI zum Administrieren
Eine gute GUI zum Administrieren bekommt man mit /usr/bin/mysql-administrator.
Mysql Fehler
Starting service MySQL warning: /var/lib/mysql/mysql.sock didn't appear within 30 seconds
Wenn diese Meldung nach dem "rcmysql start" kommt, dann zuerst das Logfile prüfen: /var/log/mysql.log.
Hier könnte zum Beispiel folgendes stehen:
090401 08:33:13 mysqld started InnoDB: The log sequence number in ibdata files does not match InnoDB: the log sequence number in the ib_logfiles! 090401 8:33:13 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... InnoDB: Page directory corruption: supremum not pointed to 090401 8:33:13 InnoDB: Page dump in ascii and hex (16384 bytes):
In diesem Falle einfach die Dateien /var/lib/mysql/ibdata_1 und /var/lib/mysql/ib_logfile1 (oder "0" am Ende)
löschen:
rm ibdata* ib_logfile*
und danach neu starten.
Wie man das Root-Passwort bei mysql setzt
http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
In a Unix environment, the procedure for resetting the MySQL
root password is as follows:
-
Log on to your system as either the Unix
rootuser or as the same user that
the mysqld server runs as. -
Locate the
.pidfile that containsthe server's process ID. The exact location and name of
this file depend on your distribution, hostname, and
configuration. Common locations are
/var/lib/mysql/,
/var/run/mysqld/, and
/usr/local/mysql/data/. Generally,
the filename has the extension of
.pidand begins with either
mysqldor your system's hostname.You can stop the MySQL server by sending a normal
kill(notkill -9)
to the mysqld process, using the
pathname of the.pidfile in the
following command:shell>
kill `cat /mysql-data-directory/host_name.pid`Note the use of backticks rather than forward quotes
with thecatcommand; these cause the
output ofcatto be substituted into
thekillcommand. -
Create a text file and place the following command
within it on a single line:SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPassword');Save the file with any name. For this example the file
will be~/mysql-init. -
Restart the MySQL server with the special
--init-file=~/mysql-initoption:shell>
mysqld_safe --init-file=~/mysql-init &The contents of the init-file are executed at server
startup, changing the root password. After the server
has started successfully you should delete
~/mysql-init. -
You should be able to connect using the new password.
Alternatively, on any platform, you can set the new password
using the mysql client(but this approach
is less secure):
-
Stop mysqld and restart it with the
--skip-grant-tables --user=rootoptions
(Windows users omit the--user=rootportion).
-
Connect to the mysqld server with
this command:shell>
mysql -u root -
Issue the following statements in the
mysql client:mysql>
UPDATE mysql.user SET Password=PASSWORD('->newpwd')WHERE User='root';mysql>FLUSH PRIVILEGES;Replace “
newpwd”
with the actualrootpassword thatyou want to use.
-
You should be able to connect using the new password.








Kommentar hinzufügen