Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED]set up mysql/mariadb (Read 548 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[SOLVED]set up mysql/mariadb

hello, I installed mariadb but I can not make it go.

Quote
mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.conf' (2 "No such file or directory")
so i delete mysqld.conf from my.conf ; It remained like this:
socket          = /run/mysqld/

Quote
mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/' (13 "Permission denied")

sudo mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/' (111 "Connection refused")

 mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/' (13 "Permission denied")

i leave the blank password and tried with 'root' or 'new-password'

then made this
Quote
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
sudo ls /run/mysqld/
give nothing

sudo ls -la /etc/mysql/
total 24
drwxr-xr-x  2 root root 4096 oct 25 20:00 .
drwxr-xr-x 80 root root 4096 oct 29 13:27 ..
-rw-r--r--  1 root root 4893 oct 29 14:19 my.cnf
-rw-r--r--  1 root root 3479 oct 29 14:14 wsrep.cnf

Quote
ls -la /var/lib/mysql/
total 110680
drwxr-xr-x  5 mysql mysql     4096 oct 26 14:35 .
drwxr-xr-x 27 root  root      4096 oct 29 12:30 ..
-rw-rw----  1 mysql mysql    16384 oct 26 14:35 aria_log.00000001
-rw-rw----  1 mysql mysql       52 oct 26 14:35 aria_log_control
-rw-rw----  1 mysql mysql 12582912 oct 26 14:35 ibdata1
-rw-rw----  1 mysql mysql 50331648 oct 26 14:35 ib_logfile0
-rw-rw----  1 mysql mysql 50331648 oct 26 14:34 ib_logfile1
drwx------  2 mysql mysql     4096 oct 26 14:35 mysql
-rw-rw----  1 mysql mysql    27996 oct 26 14:35 mysql-bin.000001
-rw-rw----  1 mysql mysql      346 oct 26 14:35 mysql-bin.000002
-rw-rw----  1 mysql mysql     1510 oct 26 14:35 mysql-bin.000003
-rw-rw----  1 mysql mysql       57 oct 26 14:35 mysql-bin.index
-rw-rw----  1 mysql mysql        7 oct 26 14:35 mysql-bin.state
drwx------  2 mysql mysql     4096 oct 26 14:35 performance_schema
drwx------  2 mysql mysql     4096 oct 26 14:34 test

ls -l /usr/lib/tmpfiles.d/ | grep maria
-rw-r--r-- 1 root root  69 oct 29 13:02 mariadb.conf

inside that mariadb.conf
d /run/mysqld 0755 mysql mysql -
d /var/lib/mysql 0755 mysql mysql -

inside my.conf:
Quote
# The following options will be passed to all MariaDB clients
[client]
#password       = ''
port            = 3306
socket          = /run/mysqld/

# The MariaDB server
[mysqld]
port            = 3306
socket          = /run/mysqld
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M

# Point the following paths to different dedicated disks
#tmpdir         = /tmp/

Re: set up mysql/mariadb

Reply #1
Code: [Select]
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

That doesn't start mariadb. It just installs the local user database. You need to do that first before attempting to start mariadb. I'm not totally sure from your OP, but did you try logging into mariadb after you first set up the database? That is, running "mysql -u root -p" after you did "sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql".

Re: set up mysql/mariadb

Reply #2
hello, I installed mariadb but I can not make it go.
 so i delete mysqld.conf from my.conf ; It remained like this:
socket          = /run/mysqld/
i leave the blank password and tried with 'root' or 'new-password'

then made thissudo ls /run/mysqld/
give nothing

sudo ls -la /etc/mysql/
total 24
drwxr-xr-x  2 root root 4096 oct 25 20:00 .
drwxr-xr-x 80 root root 4096 oct 29 13:27 ..
-rw-r--r--  1 root root 4893 oct 29 14:19 my.cnf
-rw-r--r--  1 root root 3479 oct 29 14:14 wsrep.cnf

ls -l /usr/lib/tmpfiles.d/ | grep maria
-rw-r--r-- 1 root root  69 oct 29 13:02 mariadb.conf

inside that mariadb.conf
d /run/mysqld 0755 mysql mysql -
d /var/lib/mysql 0755 mysql mysql -

inside my.conf:


umm - you are not starting the server, FWIW

Re: set up mysql/mariadb

Reply #3
Basically what @Dudemanguy said. To autorun it as a service you'll also need to:
Code: [Select]
pacman -S mysql-openrc
or
Code: [Select]
pacman -S mysql-runit
depending on the init system used and if you haven't done so already. Also you'll need to activate the service. Consult the wiki on how to do that for particular init system.

Re: set up mysql/mariadb

Reply #4
thanks, now i got this error

sudo rc-service mysql start
 * Checking mysqld configuration for mysql ...                            [ ok ]
 * Starting mysql ...
 * MySQL datadir `' is empty or invalid
 * Please check your config file `/etc/mysql/my.cnf'
 * ERROR: mysql failed to start

i tried
sudo rm -rf /var/lib/mysql/*
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
sudo chown mysql:mysql  /var/lib/mysql/*

still giving that error
 cd /var/lib/mysql ; sudo mysqld --initialize --user=mysql
error dont recognize initialize

my host name is juan-pc so i look for log file:
sudo find / -name 'juan-pc.err'
nothing
/var/log/mysql dont exist

Re: set up mysql/mariadb

Reply #5
I can reproduce it and confirm that on normal installation this is the case. To fix it, check file /etc/mysql/my.cnf for these entries under [mysqld] label and write them if they are not present:
Code: [Select]
basedir = /usr
datadir = /var/lib/mysql
user = mysql
pid-file = /run/mysqld/mysqld.pid
After those entries are added to my.cnf, the service starts fine.

Re: set up mysql/mariadb

Reply #6
I can reproduce it and confirm that on normal installation this is the case. To fix it, check file /etc/mysql/my.cnf for these entries under [mysqld] label and write them if they are not present:
Code: [Select]
basedir = /usr
datadir = /var/lib/mysql
user = mysql
pid-file = /run/mysqld/mysqld.pid
After those entries are added to my.cnf, the service starts fine.


I wrote an init stript for openrc

 

Re: set up mysql/mariadb

Reply #7
i made the changes on my.conf and its working, also i needed to specify the socket under  [mysqld]. the install was with
sudo pacman -S mysql
i saw the init script but not sure if if it would work in my case.
SOLVED
thank you