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:21] – [Setup automysqlbackup configuration file] adminmysql [2019/03/28 13:50] (current) – [Manually create a backup] dani
Line 8: Line 8:
  
   - Get the user and password to access the MySQL database. This is usually the user ''root''!   - Get the user and password to access the MySQL database. This is usually the user ''root''!
-  - Check for the database data directory:<code bash> +  - Check for the database data directory:<code bash>mysql -e "show variables;" | grep '^datadir'</code> 
-mysql -e "show variables;" | grep '^datadir' +  - 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! 
-</code> +  - Amount of data:<code bash>du -sh $(mysql -e "show variables;" | awk '/^datadir/ {print $NF}')</code> 
-  - Check, if the binlog option is enabled: ''ls $(mysql -e "show variables;"|grep datadir|awk '{print $NF}')/|grep bin.index''If this command does not result with a filename, the binlog is not activated! +  - Socket:<code bash>mysql -e "show variables;"|grep '^socket'</code> 
-  - Amount of data: ''du -sh $(mysql -e "show variables;" | awk '/datadir/ {print $NF}' | grep '^\/')'' +  - Network port:<code bash>mysql -e "show variables;"|grep '^port'</code>
-  - Socket: ''mysql -e "show variables;"|grep '^socket''' +
-  - Network port: ''mysql -e "show variables;"|grep '^port'''+
  
 ==== Setup automysqlbackup configuration file ==== ==== Setup automysqlbackup configuration file ====
Line 44: 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.1552123274.txt.gz
  • Last modified: 2019/03/09 10:21
  • by admin