tuoggy Posted September 24, 2018 Posted September 24, 2018 I have been going over forum after forum trying to figure out how do this, and nothing seems to match up. I just downloaded MySQL on my new Rock64. The OS is installed on a 32GB eMMC, and I have a 1.5GB USB 3 HDD installed for my home folder and all the user data. I bought this to be set up as a LAMP server, and have installed Apache and PHP, which are working well. I haven't had any luck with MySQL though. It seems that nothing matches the documentation. All the documentation and forums say that the configuration file is located at /etc/mysql/my.cnf In that configuration file, there's supposed to be DB location settings, but it's not there. This is all I have in the my.cnf file: The MariaDB configuration file # # The MariaDB/MySQL tools read configuration files in the following order: # 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults, # 2. "/etc/mysql/conf.d/*.cnf" to set global options. # 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options. # 4. "~/.my.cnf" to set user-specific options. # # If the same option is defined multiple times, the last one will apply. # # One can use all long options that the program supports. # Run program with --help to get a list of available options and with # --print-defaults to see which it would actually understand and use. # # This group is read both both by the client and the server # use it for options that affect everything # [client-server] # Import all .cnf files from configuration directory !includedir /etc/mysql/conf.d/ !includedir /etc/mysql/mariadb.conf.d/ Could anyone please help me figure out how to change the main database directory? Thank you!
martinayotte Posted September 24, 2018 Posted September 24, 2018 In the config file /etc/mysql/mariadb.conf.d/50-server.cnf, you should see around line 22 the entry "datadir = /var/lib/mysql" , this is where the DBs are located ...
tuoggy Posted September 26, 2018 Author Posted September 26, 2018 Thank you for pointing that out. I finally found it. Now I'm having a new problem. When I was using an older version of MySQL, I was able to change the datadir to a new location, reset the server, and it would load the databases in the new location. Now when I change the location of the datadir, I'm getting a bunch of errors: For example, I change this: user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql/ tmpdir = /tmp lc-messages-dir = /usr/share/mysql skip-external-locking To this: user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /New_Directory/mysql/ tmpdir = /tmp lc-messages-dir = /usr/share/mysql skip-external-locking and I get this error: Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details. Running "systemctl status mariadb.service" returns this: ● mariadb.service - MariaDB database server Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: Active: failed (Result: exit-code) since Wed 2018-09-26 13:17:36 UTC; 1min 6s Process: 3642 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_STAR Process: 3638 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUC Process: 5747 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WS Process: 5655 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR Process: 5649 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START Process: 5643 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/ru Main PID: 5747 (code=exited, status=1/FAILURE) Status: "MariaDB server is down" Sep 26 13:17:35 rock64 systemd[1]: Starting MariaDB database server... Sep 26 13:17:36 rock64 mysqld[5747]: 2018-09-26 13:17:36 548003549184 [Note] /us Sep 26 13:17:36 rock64 mysqld[5747]: 2018-09-26 13:17:36 548003549184 [Warning] Sep 26 13:17:36 rock64 systemd[1]: mariadb.service: Main process exited, code=ex Sep 26 13:17:36 rock64 systemd[1]: Failed to start MariaDB database server. Sep 26 13:17:36 rock64 systemd[1]: mariadb.service: Unit entered failed state. Sep 26 13:17:36 rock64 systemd[1]: mariadb.service: Failed with result 'exit-cod lines 1-19/19 (END) I'm seriously at a loss here, so I would really appreciate if someone could point me in the right direction. Or even send me to a tutorial that would actually work. Things I've done so far: copied the contents of the original database director to the new one using rsync tried reinstalling and starting over from scratch tried changing the location of the .pid and .sock files done a chown mysql on all files and directories concerned created new .pid and .sock files
Recommended Posts