mysql

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
mysql [2019/03/09 10:26] – [Get environmet] adminmysql [2019/03/28 13:50] (current) – [Manually create a backup] dani
Line 10: Line 10:
   - Check for the database data directory:<code bash>mysql -e "show variables;" | grep '^datadir'</code>   - Check for the database data directory:<code bash>mysql -e "show variables;" | grep '^datadir'</code>
   - Check, if the binlog option is enabled:<code bash>ls $(mysql -e "show variables;"|awk '/^datadir/ {print $NF}')/|grep 'bin.index'</code>If this command does not result with a filename, the ''binlog'' option is not activated!   - Check, if the binlog option is enabled:<code bash>ls $(mysql -e "show variables;"|awk '/^datadir/ {print $NF}')/|grep 'bin.index'</code>If this command does not result with a filename, the ''binlog'' option is not activated!
-  - Amount of data:<code bash>du -sh $(mysql -e "show variables;" | awk '/datadir/ {print $NF}' | grep '^\/')</code>+  - Amount of data:<code bash>du -sh $(mysql -e "show variables;" | awk '/^datadir/ {print $NF}')</code>
   - Socket:<code bash>mysql -e "show variables;"|grep '^socket'</code>   - Socket:<code bash>mysql -e "show variables;"|grep '^socket'</code>
   - Network port:<code bash>mysql -e "show variables;"|grep '^port'</code>   - Network port:<code bash>mysql -e "show variables;"|grep '^port'</code>
Line 42: Line 42:
 gzip -cd daily_<dbname>_2019-03-09_05h00m_Saturday.sql.gz | mysql <dbname> gzip -cd daily_<dbname>_2019-03-09_05h00m_Saturday.sql.gz | mysql <dbname>
 </code> </code>
 +
 +===== Manually create a backup =====
 +In case, you have to create a backup manually (without automysqlbackup script), you can do it like this:
 +
 +  * Using ''gzip'' and backup all databases:<code bash>
 +mysqldump --all-databases -q | gzip -c > mysql-20100212.sql.gz
 +</code>
 +  * Using ''bzip2'' and backup all databases:<code bash>
 +mysqldump --all-databases -q | bzip2 -c > mysql-20100212.sql.bz2
 +</code>
 +
 +
 ===== Update a user password ===== ===== Update a user password =====
 In this example, the password for the MySQL user root will be updated for following hosts: ''::1'', ''127.0.0.1'' and ''localhost''. In this example, the password for the MySQL user root will be updated for following hosts: ''::1'', ''127.0.0.1'' and ''localhost''.
  • mysql.1552123564.txt.gz
  • Last modified: 2019/03/09 10:26
  • by admin