Differences between revisions 1 and 8 (spanning 7 versions)
Revision 1 as of 2015-11-05 14:59:45
Size: 547
Editor: localhost
Comment:
Revision 8 as of 2019-06-26 15:09:59
Size: 1503
Editor: localhost
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

== MySQL max_connections ==
{{{
show variables like 'max_connections';

SET GLOBAL max_connections = 250;
}}}

== How to Reset the Root Password ==
{{{
# /etc/init.d/mysql stop
# mysqld --skip-grant-tables
$ mysql
mysql> FLUSH PRIVILEGES;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
}}}
Line 15: Line 31:

== Full backup ==
=== Edit the root users mysql home environment configuration ===

在执行备份的用户home目录下面创建my.cnf文件
{{{
cat ~/.my.cnf

# Insert the following into the my.cnf file

[mysqldump]
user = mysqldbusername
password = mysqldbpassword
}}}

  * chmod 600 ~/.my.cnf

=== Cron ===
{{{
30 12 * * * mysqldump -u mysqlusernamehere -h localhost --all-databases > /home/backups/mydatabasename/$(date +"%F-%H%M")_mydatabasename_mysql_db.sql
}}}

== Upgrade MySQL 5.6 to 5.7 ==
{{{
# mysql --user root --password --execute="set global innodb_fast_shutdown=0"
# service mysql stop

MySQL max_connections

show variables like 'max_connections';

SET GLOBAL max_connections = 250;

How to Reset the Root Password

# /etc/init.d/mysql stop
# mysqld --skip-grant-tables
$ mysql
mysql> FLUSH PRIVILEGES;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';

howto-copy-mysql-database-remote-server

mysqldump -u user -p'password' db-name foo | ssh user@remote.box.com mysql -u user -p'password' db-name foo
mysqldump -u username -p'password' db-name | ssh user@remote.box.com mysql -u username -p'password db-name

http://www.cyberciti.biz/tips/howto-copy-mysql-database-remote-server.html

http://www.hackhowtofaq.com/blog/how-to-backup-mysql-db-remotely/

http://www.thegeekstuff.com/2008/09/backup-and-restore-mysql-database-using-mysqldump/

Full backup

Edit the root users mysql home environment configuration

在执行备份的用户home目录下面创建my.cnf文件

cat ~/.my.cnf

# Insert the following into the my.cnf file

[mysqldump]
user = mysqldbusername
password = mysqldbpassword
  • chmod 600 ~/.my.cnf

Cron

30 12  * * * mysqldump -u mysqlusernamehere -h localhost --all-databases > /home/backups/mydatabasename/$(date +"%F-%H%M")_mydatabasename_mysql_db.sql

Upgrade MySQL 5.6 to 5.7

désert/MySQL (last edited 2019-06-26 15:09:59 by localhost)