If you want to migrate the data without having to shut down the database and/or you need to migrate between different versions of mysql or different architectures then you can either use mysqldump or mysqlhotcopy. If moving between database versions, then you'll also want to read about mysql_upgrade which can work with the above rsync method. The file copy method is convenient because you don't need to do a dump/restore, however keep in mind that it will cause problems if you are moving between different architectures or database versions. Also note that with rsync those trailing slashes on the directories are important. Using -a with rsync will preserve the ownership and permissions on the files which is important. If you shutdown the database, then it is perfectly reasonable to copy the files with: rsync -av /var/lib/mysql/ remotehost:/var/lib/mysql/ If /root/.my.cnf exists then it wont ask for root password 4. If you are going to migrate the files by copying directly then keep in mind that you'll want to shutdown the database with /etc/init.d/mysql stop first, otherwise the files can end up in an inconsistent state that will need repair and/or may contain inconsistent or corrupted data. Create MySQL database and user in the bash script 1. The following command creates a new user named exampleuser, using mysqlnativepassword as default authentication. You'll want all of these files, so copy the entire directory. sudo mysql To create a new database, run the following command from your MySQL console: CREATE DATABASE exampledatabase Now you can create a new user and grant them full privileges on the custom database you’ve just created. In part it depends on what kind of engine (MyISAM, InnoDB, etc), but you'll see files that end in. To install MariaDB on Ubuntu 12. To install MySQL on Ubuntu, use the following command: sudo apt-get install mysql-server. MySQL and MariaDB have the same command syntax, so either database system will work for this guide. Note that the database files do not end in. How to Install MySQL and MariaDB on Ubuntu. By default MySQL stores its files in /var/lib/mysql but if the default location has been changed then a more reliable way to find out where the files are kept is to check the config file: grep datadir /etc/mysql/my.cnf
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |