m (→Change password) |
m |
||
Line 61: | Line 61: | ||
then turn to [https://stackoverflow.com/questions/37879448/mysql-fails-on-mysql-error-1524-hy000-plugin-auth-socket-is-not-loaded] | then turn to [https://stackoverflow.com/questions/37879448/mysql-fails-on-mysql-error-1524-hy000-plugin-auth-socket-is-not-loaded] | ||
+ | |||
+ | === Recover from files === | ||
+ | |||
+ | Normally you dump the database from the server itself. If, however, you only have access to the hard drive (bad things having happened to the system), you can [https://stackoverflow.com/questions/484750/restoring-mysql-database-from-physical-files restore the SQL database from files]. | ||
== Links == | == Links == | ||
* [http://blog.urfix.com/linux-command-line-mysql-awesome/ Linux command line and MySQL]. | * [http://blog.urfix.com/linux-command-line-mysql-awesome/ Linux command line and MySQL]. |
Contents |
MySQL is the best database management we know. That's what we use.
SHOW databases;
is may be the most important command. It shows you what's in store.
CREATE USER 'laussy' IDENTIFIED BY 'mypass'; GRANT ALL PRIVILEGES ON *.* TO 'laussy';
From the command line:
mysqldump -u laussy -p wikilaussy > wikilaussy-24-jan-10.sql
to export the database data (wikilaussy-24-jan-10.sql, a readable file with very long lines) from the database structure (named wikilaussy) above.
From the command line:
mysql -u laussy -p wikilaussy < wikilaussy-24-jan-10.sql
to import the database data (wikilaussy-24-jan-10.sql, a readable file with very long lines) into the database structure (named wikilaussy) above.
See [1]:
Stop the MySQL Server.
sudo /etc/init.d/mysql stop
If this does not work, try "mysql stop/waiting" instead~[2]
Start the mysqld configuration.
sudo mysqld --skip-grant-tables &
Login to MySQL as root.
mysql -u root mysql
Replace YOURNEWPASSWORD with your new password!
UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit;
Would you encounter with a
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
then turn to [3]
Normally you dump the database from the server itself. If, however, you only have access to the hard drive (bad things having happened to the system), you can restore the SQL database from files.