Category: MySQL

  • MySQL MariaDB export and import database

    # Export mysqldump -u [username] -p[password] [database_name] > [dumpfilename.sql] # Import mysql -u [username] -p[password] [database_name] < [dumpfilename.sql]

  • Problem starting MySQL MariaDB: InnoDB: Set innodb_force_recovery to ignore this error.

    After trying to import a database I had problem starting mysql. # service mysql start Job for mariadb.service failed because the control process exited with error code. See “systemctl status mariadb.service” and “journalctl -xe” for details. # systemctl status mariadb.service InnoDB: Set innodb_force_recovery to ignore this error. To be able to delete tables in the […]

  • Import a mysql database from terminal

    mysql -u username -ppassword databasename < filename.sql Example Username: daniel Password: 123Headadmin Database name: my_new_db Database file name: my_old_db.sql mysql -u daniel -p123Headadmin my_new_db < my_old_db.sql

  • Rename a database in phpMyAdmin

    I wanted to change a MySQL database name via phpMyAdmin. This is how I did it: 1. Login to phpMyAdmin. 2. Select the database you want to rename. 3. Click on operations tab. 4. In the “rename database to” section, specifiy the new name of the database. 5. You will get a question saying “CREATE […]

  • MySQL backup script

    1. Create a script folder. # sudo mkdir /script 2. Create a backup folder and a destnation folder for the MySQL files. # sudo mkdir /backup /backup/mysql 3. Create a script file. # sudo nano /script/mysqlbackup.sh At the start of the file add: #!/bin/bash On the next row write your script. Here are a few […]