I setup openSUSE 13.1 and wanted to install mysql as I need it for my development. Then I saw that mardiadb is in use and realizing that some application applications like amarok use it I decided to give it a try (it’s supposed to be binary compatible right?).
I would like to know how to start, stop and manage the server in general. I see only these commands:
**But I cannot find **mysqld **or **mysql.server **among mysql commands.
When I tried mysqld start It failed and this is what the err log contains:
140713 14:24:21 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140713 14:24:22 InnoDB: The InnoDB memory heap is disabled
140713 14:24:22 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140713 14:24:22 InnoDB: Compressed tables use zlib 1.2.8
140713 14:24:22 InnoDB: Using Linux native AIO
140713 14:24:22 InnoDB: Initializing buffer pool, size = 128.0M
140713 14:24:22 InnoDB: Completed initialization of buffer pool
140713 14:24:22 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: ‘create’.
InnoDB: Cannot continue operation.
140713 14:24:22 mysqld_safe mysqld from pid file /var/lib/mysql/mothership.pid ended
Remember to run these commands as root or with root / sudo privileges.
To start MariaDB:
systemctl start mysql
To set MariaDB to startup automatically:
systemctl enable mysql
To show current status for MariaDB:
systemctl status mysql
Remember that the root password for MySQL/MariaDB is not the same as the root user password, to set the root password for MariaDB, use: mysqladmin -u root password somecoolnewpassword
systemctl manages all services, for example systemctl start apache2 would start Apache, stop would stop it and so forth.
The same as mysql.
Use “systemctl start mysql” to start it, “systemctl stop mysql” to stop it, and “systemctl enable mysql” to automatically start it at boot. (all as root of course)
Your error messages come from the fact that you started the daemon as normal user, so it cannot access its files.
I forgot to mention that I of course tried it run also with sudo and also logged as superuser but with same effect.
Now I tried sudosystemctl start mysql and it failed with:
Job for mysql.service failed. See ‘systemctl status mysql.service’ and ‘journalctl -xn’ for details.
**systemctl status mysql.service
**
shows this:
mysql.service - LSB: Start the MySQL database server
Loaded: loaded (/etc/init.d/mysql)
Active: failed (Result: exit-code) since Sun 2014-07-13 15:42:01 CEST; 50s ago
Process: 32122 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
While googling about this problem I also heard something about apparmor. Could this be a problem?
I would reckon that when you ran the mysql manually, you created files owned by root and group root in the mysql database directory and since MySQL runs with its own user, it cannot access these files (mysql.mysql)
You should delete all files in /var/lib/mysql/* (not the directory itself, all files inside it) and then run systemctl start mysql.
Look at the permissions for /var/lib/mysql directory and make sure it’s owned by the user mysql and group mysql, it should look like this:
drwxrwx— 8 mysql mysql 4096 Jul 12 21:04 mysql
This did it! I forgot that I crated even the directory manually as mysql complained it could not create it, so I chown-ed it to mysql and now systemctl start mysql works. Thank you both for help.