Menu Close

Category: mysqldump

How to rename a database in MySQL?

Today we will talk how do you can easily rename a database in MySQL. At the MySQL version 5.1.7 was added a command to do this job named RENAME DATABASE RENAME {DATABASE | SCHEMA} db_name TO new_db_name; But it was removed on the MySQL version 5.1.23 because maybe it would result in data lost’s. Then, let’s see some ways in which we can do this: 1. Using the RENAME TABLE command As long as two databases are on the same file system, you can use RENAME TABLE to move a table from one database to another: RENAME TABLE current_db.tbl_name TO other_db.tbl_name; RENAME TABLE Syntax na Documentacao do MySQL mysql> show tables; +———————+ | Tables_in_oldSchema | +———————+ | tb1 | | tb10 | | tb2 | | tb3 | | tb4 . . .

Liked? Help and Share!

MySQL compress backup – mysqldump – gzip – bzip2

Today let’s talk about a very important issue for database administrators, BACKUP. There are several strategies for backup, snapshot, dump, dump binlog, it all depends on your need and the size of your database. I’ll explain a little about the tool provides by MySQL, which is the mysqldump , I indicate this tool for databases that have 15gb/20gb even more than that, the probability that you have problems to restore a backup and long delay, make it unfeasible. How mysqldump works? He does nothing but create sql commands to our structure and data and put them in the file specified. First, I will explain some of the most important options mysqldump then, for those who have MySQL installed on a Linux server, I will teach how to compress the dump . . .

Liked? Help and Share!