# MariaDB install problem: multiple errors



## waem (Aug 5, 2015)

Hello,

I am trying to set up a server on FreeBSD for the first time on an old IBM thinkpad(T43). The installation went smoothly until I tried to install MariaDB. After various attempts at solving the issue on my own I deinstalled the mariadb55-server and -client packages and reinstalled it from a different port.  Here are the steps I made:

I installed mariaDB from /usr/ports/databases/mariadb-server. (And the -client)

No issue during the installation, so I copied the medium config file to /usr/local/etc/my.cnf 
In this step I tried to install the database and first errors started to pop out
`# mysql_install_db  --user=mysql --basedir=/usr/local --datadir=/var/db/mysql` 

```
Installing MariaDB/MySQL system tables in '/var/db/mysql' ...
150805 22:24:08 [Warning] Can't create test file /var/db/mysql/soleil123.lower-test
150805 22:24:08 [ERROR] mysqld: File './mysql-bin.index' not found (Errcode: 13)
150805 22:24:08 [ERROR] Aborting
150805 22:24:08 [Note] /usr/local/libexec/mysqld: Shutdown complete

Installation of system tables failed!  Examine the logs in
/var/db/mysql for more information.
The problem could be conflicting information in an external
my.cnf files. You can ignore these by doing:
[...]
# I looked for a conflicting my.cnf and there wasn't any. Still did what was suggested and didn't solve much.
```
4 - I checked that /var/db/mysql belonged to user mysql

5 - /var/db/mysql/mys.err contains (among many but I don't want to clutter the post)

```
150805 15:23:08 [ERROR] Plugin 'InnoDB' init function returned error.
150805 15:23:08 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
150805 15:23:08 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
150805 15:23:08 [ERROR] Unknown/unsupported storage engine: InnoDB
150805 15:23:08 [ERROR] Aborting

150805 15:23:08 [Note] /usr/local/libexec/mysqld: Shutdown complete

150805 15:23:08 mysqld_safe mysqld from pid file /var/db/mysql/mys.pid ended
```
6 - `# mysql_upgrade` returned:

```
Phase 1/3: Fixing table and database names
mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) when trying to connect
FATAL ERROR: Upgrade failed
```
7 - Just in case I tried: `#service mysql-server start
Starting mysql.`
On /var/db/mysql/mys.err the following lines seem to have been concatenated: 

```
150805 22:43:34 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
150805 22:43:34 mysqld_safe mysqld from pid file /var/db/mysql/mys.pid ended
```
I tried many solutions (and should have kept a log :/ )and now I find myself a bit lost. Has anyone encountered the same problem or has any suggestions on where to go from here? 

Thank you,


----------



## SirDice (Aug 6, 2015)

Remove the my.cnf file and try again. Most users don't need one as the default values are usually good enough. Only create and/or edit my.cnf if you actually have performance issues and need to tweak the default values.


----------



## waem (Aug 7, 2015)

Hello,

Thank you for your answer,
You suggestion changed the situation a bit!
`# mysql_install_db`

```
Installing MariaDB/MySQL system tables in '/var' ...
OK
Filling help tables...
OK
#etc... everything seems fine, I get suggestions to finish the db install
```
As told I executed
`'/usr/local/bin/mysqladmin' -u root password 'new-password'`

```
/usr/local/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
```
So I tried to start MySQL with `#service mysql-server start` which failed.
As suggested by MariaDB I also tried the following:
`# cd '/usr/local' ; /usr/local/bin/mysqld_safe --datadir='/var'`

```
150807 14:56:53 mysqld_safe Logging to '/var/mys.err'.
150807 14:56:54 mysqld_safe Starting mysqld daemon with databases from /var
150807 14:56:54 mysqld_safe mysqld from pid file /var/mys.pid ended
```
The logs in /var/db/mysql/mys.err only had the following added:

```
150807 14:49:01 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
150807 14:49:01 mysqld_safe mysqld from pid file /var/db/mysql/mys.pid ended
```


----------



## SirDice (Aug 7, 2015)

Things may have been hosed right now. As this is a new install anyway, `rm -rf /var/db/mysql/*` then `service mysql-server start`. The start scripts will check if it's a "fresh" install and will run the initialization automatically. Once it's up and running you can change the root password and remove the test database and accounts.


----------



## waem (Aug 7, 2015)

Hello again 
Did as you said, here are the outputs:

`# service mysql-server start`

```
Installing MariaDB/MySQL system tables in '/var/db/mysql' ...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
[...]
Support MariaDB development by buying support/new features from
Monty Program Ab. You can contact us about this at sales@askmonty.org.
Alternatively consider joining our community based development effort:
http://askmonty.org/wiki/index.php/MariaDB#How_can_I_participate_in_the_development_of_MariaDB

Starting mysql.
```
`root@mys:/home/waem # cat /var/db/mysql/mys.err`

```
150807 16:34:39 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
150807 16:34:39 mysqld_safe mysqld from pid file /var/db/mysql/mys.pid ended
```


----------

