mariadb service is not starting after boot, CentOS 7

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












4















I defined the service for mariadb on: /etc/systemd/system/mariadb.service



[Unit]
Description=start and stop MySQL(MariaDB) Server
After=syslog.target
After=network.target


[Service]
Type=simple
User=Umariadb
Group=Gmariadb
# Restart=always

# PermissionsStartOnly=true
ExecStart=/usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data
# ExecStop=/usr/bin/vgaoff stop

TimeoutSec=300
PrivateTmp=true


[Install]
WantedBy=multi-user.target


Later I activated it:



systemctl enable mariadb.service


Now, after reboot, the Service is not starting.



Then I need to disable the service again.



When trying to execute manually again it works perfectly...



sudo /usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data 


Is my script for service defined well?



I would like to know what is the problem is. How to solve it?



EDIT:



$ sudo /usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data
[sudo] password for joseluisbz:
170308 19:54:07 mysqld_safe Logging to '/usr/local/ServerWeb/mariadb/data/server.err'.


Inside the File



170308 19:54:07 mysqld_safe Starting mysqld daemon with databases from /usr/local/ServerWeb/mariadb/data
2017-03-08 19:54:07 140588539000704 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld (mysqld 10.1.20-MariaDB) starting as process 4411 ...
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: The InnoDB memory heap is disabled
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Using Linux native AIO
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Using SSE crc32 instructions
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Completed initialization of buffer pool
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Highest supported file format is Barracuda.
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: 128 rollback segment(s) are active.
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Waiting for purge to start
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.34-79.1 started; log sequence number 1622938
2017-03-08 19:54:07 140588539000704 [Note] Plugin 'FEEDBACK' is disabled.
2017-03-08 19:54:07 140587999135488 [Note] InnoDB: Dumping buffer pool(s) not yet started
2017-03-08 19:54:07 140588539000704 [Note] Server socket created on IP: '::'.
2017-03-08 19:54:08 140588539000704 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: ready for connections.
Version: '10.1.20-MariaDB' socket: '/tmp/mysql.sock' port: 3306 MariaDB Server


Testing Availability...



[joseluisbz@Vxbox-Lnx ~]$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 2
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]>


Shutdown the Linux...



2017-03-08 19:59:29 140588538443520 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: Normal shutdown

2017-03-08 19:59:29 140588538443520 [Note] Event Scheduler: Purging the queue. 0 events
2017-03-08 19:59:29 140587982350080 [Note] InnoDB: FTS optimize thread exiting.
2017-03-08 19:59:29 140588538443520 [Note] InnoDB: Starting shutdown...
2017-03-08 19:59:31 140588538443520 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2017-03-08 19:59:32 140588538443520 [Note] InnoDB: Shutdown completed; log sequence number 1622948
2017-03-08 19:59:32 140588538443520 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: Shutdown complete

170308 19:59:32 mysqld_safe mysqld from pid file /usr/local/ServerWeb/mariadb/data/Vxbox-Lnx.pid ended


Now with service...



$ sudo systemctl enable mariadb.service
[sudo] password for joseluisbz:
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /etc/systemd/system/mariadb.service.
[joseluisbz@Vxbox-Lnx ~]$


Checking...



[joseluisbz@Vxbox-Lnx ~]$ sudo service mariadb start
[sudo] password for joseluisbz:
Redirecting to /bin/systemctl start mariadb.service
[joseluisbz@Vxbox-Lnx ~]$ mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[joseluisbz@Vxbox-Lnx ~]$


STATUS



$ sudo systemctl status mariadb.service
[sudo] password for joseluisbz:
● mariadb.service - start and stop MySQL(MariaDB) Server
Loaded: loaded (/etc/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2017-03-08 20:09:47 COT; 5min ago
Process: 4556 ExecStart=/usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data (code=exited, status=1/FAILURE)
Main PID: 4556 (code=exited, status=1/FAILURE)

Mar 08 20:09:47 Vxbox-Lnx systemd[1]: Started start and stop MySQL(MariaDB) Server.
Mar 08 20:09:47 Vxbox-Lnx systemd[1]: Starting start and stop MySQL(MariaDB) Server...
Mar 08 20:09:47 Vxbox-Lnx mysqld_safe[4556]: 170308 20:09:47 mysqld_safe Logging to '/usr/local/ServerWeb/mariadb/data/server.err'.
Mar 08 20:09:47 Vxbox-Lnx systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
Mar 08 20:09:47 Vxbox-Lnx systemd[1]: Unit mariadb.service entered failed state.
Mar 08 20:09:47 Vxbox-Lnx systemd[1]: mariadb.service failed.
[joseluisbz@Vxbox-Lnx ~]$


Another Check



$ sudo systemctl --failed
[sudo] password for joseluisbz:
UNIT LOAD ACTIVE SUB DESCRIPTION
● kdump.service loaded failed failed Crash recovery kernel arming
● mariadb.service loaded failed failed start and stop MySQL(MariaDB) Server

LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.

2 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[joseluisbz@Vxbox-Lnx ~]$









share|improve this question



















  • 1





    When you try to start it by hand you do sudo mysqld_safe ..., so you are starting service as root user. In your service config file you have User=Umariadb Group=Gmariadb and you end with ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) . Do you have some permission problems?

    – Kalavan
    Mar 9 '17 at 9:36






  • 1





    Yes, yesterday I was reviewing this. I will edit my question for more information.

    – chepe lucho
    Mar 9 '17 at 12:10











  • Why are you writing your own MariaDB systemd file? Even if your OS didn't ship with one, surely there are ones available from other distributions that you could use as model.

    – Mark Stosberg
    Mar 9 '17 at 19:02











  • @Kalavan this my ownership discovering... (antes de ayer, I don' know translate to english, yesterday of yesterday) of log file, Now I checked if works...

    – chepe lucho
    Mar 10 '17 at 17:11
















4















I defined the service for mariadb on: /etc/systemd/system/mariadb.service



[Unit]
Description=start and stop MySQL(MariaDB) Server
After=syslog.target
After=network.target


[Service]
Type=simple
User=Umariadb
Group=Gmariadb
# Restart=always

# PermissionsStartOnly=true
ExecStart=/usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data
# ExecStop=/usr/bin/vgaoff stop

TimeoutSec=300
PrivateTmp=true


[Install]
WantedBy=multi-user.target


Later I activated it:



systemctl enable mariadb.service


Now, after reboot, the Service is not starting.



Then I need to disable the service again.



When trying to execute manually again it works perfectly...



sudo /usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data 


Is my script for service defined well?



I would like to know what is the problem is. How to solve it?



EDIT:



$ sudo /usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data
[sudo] password for joseluisbz:
170308 19:54:07 mysqld_safe Logging to '/usr/local/ServerWeb/mariadb/data/server.err'.


Inside the File



170308 19:54:07 mysqld_safe Starting mysqld daemon with databases from /usr/local/ServerWeb/mariadb/data
2017-03-08 19:54:07 140588539000704 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld (mysqld 10.1.20-MariaDB) starting as process 4411 ...
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: The InnoDB memory heap is disabled
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Using Linux native AIO
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Using SSE crc32 instructions
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Completed initialization of buffer pool
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Highest supported file format is Barracuda.
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: 128 rollback segment(s) are active.
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Waiting for purge to start
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.34-79.1 started; log sequence number 1622938
2017-03-08 19:54:07 140588539000704 [Note] Plugin 'FEEDBACK' is disabled.
2017-03-08 19:54:07 140587999135488 [Note] InnoDB: Dumping buffer pool(s) not yet started
2017-03-08 19:54:07 140588539000704 [Note] Server socket created on IP: '::'.
2017-03-08 19:54:08 140588539000704 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: ready for connections.
Version: '10.1.20-MariaDB' socket: '/tmp/mysql.sock' port: 3306 MariaDB Server


Testing Availability...



[joseluisbz@Vxbox-Lnx ~]$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 2
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]>


Shutdown the Linux...



2017-03-08 19:59:29 140588538443520 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: Normal shutdown

2017-03-08 19:59:29 140588538443520 [Note] Event Scheduler: Purging the queue. 0 events
2017-03-08 19:59:29 140587982350080 [Note] InnoDB: FTS optimize thread exiting.
2017-03-08 19:59:29 140588538443520 [Note] InnoDB: Starting shutdown...
2017-03-08 19:59:31 140588538443520 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2017-03-08 19:59:32 140588538443520 [Note] InnoDB: Shutdown completed; log sequence number 1622948
2017-03-08 19:59:32 140588538443520 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: Shutdown complete

170308 19:59:32 mysqld_safe mysqld from pid file /usr/local/ServerWeb/mariadb/data/Vxbox-Lnx.pid ended


Now with service...



$ sudo systemctl enable mariadb.service
[sudo] password for joseluisbz:
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /etc/systemd/system/mariadb.service.
[joseluisbz@Vxbox-Lnx ~]$


Checking...



[joseluisbz@Vxbox-Lnx ~]$ sudo service mariadb start
[sudo] password for joseluisbz:
Redirecting to /bin/systemctl start mariadb.service
[joseluisbz@Vxbox-Lnx ~]$ mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[joseluisbz@Vxbox-Lnx ~]$


STATUS



$ sudo systemctl status mariadb.service
[sudo] password for joseluisbz:
● mariadb.service - start and stop MySQL(MariaDB) Server
Loaded: loaded (/etc/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2017-03-08 20:09:47 COT; 5min ago
Process: 4556 ExecStart=/usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data (code=exited, status=1/FAILURE)
Main PID: 4556 (code=exited, status=1/FAILURE)

Mar 08 20:09:47 Vxbox-Lnx systemd[1]: Started start and stop MySQL(MariaDB) Server.
Mar 08 20:09:47 Vxbox-Lnx systemd[1]: Starting start and stop MySQL(MariaDB) Server...
Mar 08 20:09:47 Vxbox-Lnx mysqld_safe[4556]: 170308 20:09:47 mysqld_safe Logging to '/usr/local/ServerWeb/mariadb/data/server.err'.
Mar 08 20:09:47 Vxbox-Lnx systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
Mar 08 20:09:47 Vxbox-Lnx systemd[1]: Unit mariadb.service entered failed state.
Mar 08 20:09:47 Vxbox-Lnx systemd[1]: mariadb.service failed.
[joseluisbz@Vxbox-Lnx ~]$


Another Check



$ sudo systemctl --failed
[sudo] password for joseluisbz:
UNIT LOAD ACTIVE SUB DESCRIPTION
● kdump.service loaded failed failed Crash recovery kernel arming
● mariadb.service loaded failed failed start and stop MySQL(MariaDB) Server

LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.

2 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[joseluisbz@Vxbox-Lnx ~]$









share|improve this question



















  • 1





    When you try to start it by hand you do sudo mysqld_safe ..., so you are starting service as root user. In your service config file you have User=Umariadb Group=Gmariadb and you end with ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) . Do you have some permission problems?

    – Kalavan
    Mar 9 '17 at 9:36






  • 1





    Yes, yesterday I was reviewing this. I will edit my question for more information.

    – chepe lucho
    Mar 9 '17 at 12:10











  • Why are you writing your own MariaDB systemd file? Even if your OS didn't ship with one, surely there are ones available from other distributions that you could use as model.

    – Mark Stosberg
    Mar 9 '17 at 19:02











  • @Kalavan this my ownership discovering... (antes de ayer, I don' know translate to english, yesterday of yesterday) of log file, Now I checked if works...

    – chepe lucho
    Mar 10 '17 at 17:11














4












4








4








I defined the service for mariadb on: /etc/systemd/system/mariadb.service



[Unit]
Description=start and stop MySQL(MariaDB) Server
After=syslog.target
After=network.target


[Service]
Type=simple
User=Umariadb
Group=Gmariadb
# Restart=always

# PermissionsStartOnly=true
ExecStart=/usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data
# ExecStop=/usr/bin/vgaoff stop

TimeoutSec=300
PrivateTmp=true


[Install]
WantedBy=multi-user.target


Later I activated it:



systemctl enable mariadb.service


Now, after reboot, the Service is not starting.



Then I need to disable the service again.



When trying to execute manually again it works perfectly...



sudo /usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data 


Is my script for service defined well?



I would like to know what is the problem is. How to solve it?



EDIT:



$ sudo /usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data
[sudo] password for joseluisbz:
170308 19:54:07 mysqld_safe Logging to '/usr/local/ServerWeb/mariadb/data/server.err'.


Inside the File



170308 19:54:07 mysqld_safe Starting mysqld daemon with databases from /usr/local/ServerWeb/mariadb/data
2017-03-08 19:54:07 140588539000704 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld (mysqld 10.1.20-MariaDB) starting as process 4411 ...
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: The InnoDB memory heap is disabled
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Using Linux native AIO
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Using SSE crc32 instructions
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Completed initialization of buffer pool
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Highest supported file format is Barracuda.
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: 128 rollback segment(s) are active.
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Waiting for purge to start
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.34-79.1 started; log sequence number 1622938
2017-03-08 19:54:07 140588539000704 [Note] Plugin 'FEEDBACK' is disabled.
2017-03-08 19:54:07 140587999135488 [Note] InnoDB: Dumping buffer pool(s) not yet started
2017-03-08 19:54:07 140588539000704 [Note] Server socket created on IP: '::'.
2017-03-08 19:54:08 140588539000704 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: ready for connections.
Version: '10.1.20-MariaDB' socket: '/tmp/mysql.sock' port: 3306 MariaDB Server


Testing Availability...



[joseluisbz@Vxbox-Lnx ~]$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 2
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]>


Shutdown the Linux...



2017-03-08 19:59:29 140588538443520 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: Normal shutdown

2017-03-08 19:59:29 140588538443520 [Note] Event Scheduler: Purging the queue. 0 events
2017-03-08 19:59:29 140587982350080 [Note] InnoDB: FTS optimize thread exiting.
2017-03-08 19:59:29 140588538443520 [Note] InnoDB: Starting shutdown...
2017-03-08 19:59:31 140588538443520 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2017-03-08 19:59:32 140588538443520 [Note] InnoDB: Shutdown completed; log sequence number 1622948
2017-03-08 19:59:32 140588538443520 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: Shutdown complete

170308 19:59:32 mysqld_safe mysqld from pid file /usr/local/ServerWeb/mariadb/data/Vxbox-Lnx.pid ended


Now with service...



$ sudo systemctl enable mariadb.service
[sudo] password for joseluisbz:
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /etc/systemd/system/mariadb.service.
[joseluisbz@Vxbox-Lnx ~]$


Checking...



[joseluisbz@Vxbox-Lnx ~]$ sudo service mariadb start
[sudo] password for joseluisbz:
Redirecting to /bin/systemctl start mariadb.service
[joseluisbz@Vxbox-Lnx ~]$ mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[joseluisbz@Vxbox-Lnx ~]$


STATUS



$ sudo systemctl status mariadb.service
[sudo] password for joseluisbz:
● mariadb.service - start and stop MySQL(MariaDB) Server
Loaded: loaded (/etc/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2017-03-08 20:09:47 COT; 5min ago
Process: 4556 ExecStart=/usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data (code=exited, status=1/FAILURE)
Main PID: 4556 (code=exited, status=1/FAILURE)

Mar 08 20:09:47 Vxbox-Lnx systemd[1]: Started start and stop MySQL(MariaDB) Server.
Mar 08 20:09:47 Vxbox-Lnx systemd[1]: Starting start and stop MySQL(MariaDB) Server...
Mar 08 20:09:47 Vxbox-Lnx mysqld_safe[4556]: 170308 20:09:47 mysqld_safe Logging to '/usr/local/ServerWeb/mariadb/data/server.err'.
Mar 08 20:09:47 Vxbox-Lnx systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
Mar 08 20:09:47 Vxbox-Lnx systemd[1]: Unit mariadb.service entered failed state.
Mar 08 20:09:47 Vxbox-Lnx systemd[1]: mariadb.service failed.
[joseluisbz@Vxbox-Lnx ~]$


Another Check



$ sudo systemctl --failed
[sudo] password for joseluisbz:
UNIT LOAD ACTIVE SUB DESCRIPTION
● kdump.service loaded failed failed Crash recovery kernel arming
● mariadb.service loaded failed failed start and stop MySQL(MariaDB) Server

LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.

2 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[joseluisbz@Vxbox-Lnx ~]$









share|improve this question
















I defined the service for mariadb on: /etc/systemd/system/mariadb.service



[Unit]
Description=start and stop MySQL(MariaDB) Server
After=syslog.target
After=network.target


[Service]
Type=simple
User=Umariadb
Group=Gmariadb
# Restart=always

# PermissionsStartOnly=true
ExecStart=/usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data
# ExecStop=/usr/bin/vgaoff stop

TimeoutSec=300
PrivateTmp=true


[Install]
WantedBy=multi-user.target


Later I activated it:



systemctl enable mariadb.service


Now, after reboot, the Service is not starting.



Then I need to disable the service again.



When trying to execute manually again it works perfectly...



sudo /usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data 


Is my script for service defined well?



I would like to know what is the problem is. How to solve it?



EDIT:



$ sudo /usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data
[sudo] password for joseluisbz:
170308 19:54:07 mysqld_safe Logging to '/usr/local/ServerWeb/mariadb/data/server.err'.


Inside the File



170308 19:54:07 mysqld_safe Starting mysqld daemon with databases from /usr/local/ServerWeb/mariadb/data
2017-03-08 19:54:07 140588539000704 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld (mysqld 10.1.20-MariaDB) starting as process 4411 ...
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: The InnoDB memory heap is disabled
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Using Linux native AIO
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Using SSE crc32 instructions
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Completed initialization of buffer pool
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Highest supported file format is Barracuda.
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: 128 rollback segment(s) are active.
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Waiting for purge to start
2017-03-08 19:54:07 140588539000704 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.34-79.1 started; log sequence number 1622938
2017-03-08 19:54:07 140588539000704 [Note] Plugin 'FEEDBACK' is disabled.
2017-03-08 19:54:07 140587999135488 [Note] InnoDB: Dumping buffer pool(s) not yet started
2017-03-08 19:54:07 140588539000704 [Note] Server socket created on IP: '::'.
2017-03-08 19:54:08 140588539000704 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: ready for connections.
Version: '10.1.20-MariaDB' socket: '/tmp/mysql.sock' port: 3306 MariaDB Server


Testing Availability...



[joseluisbz@Vxbox-Lnx ~]$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 2
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]>


Shutdown the Linux...



2017-03-08 19:59:29 140588538443520 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: Normal shutdown

2017-03-08 19:59:29 140588538443520 [Note] Event Scheduler: Purging the queue. 0 events
2017-03-08 19:59:29 140587982350080 [Note] InnoDB: FTS optimize thread exiting.
2017-03-08 19:59:29 140588538443520 [Note] InnoDB: Starting shutdown...
2017-03-08 19:59:31 140588538443520 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2017-03-08 19:59:32 140588538443520 [Note] InnoDB: Shutdown completed; log sequence number 1622948
2017-03-08 19:59:32 140588538443520 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: Shutdown complete

170308 19:59:32 mysqld_safe mysqld from pid file /usr/local/ServerWeb/mariadb/data/Vxbox-Lnx.pid ended


Now with service...



$ sudo systemctl enable mariadb.service
[sudo] password for joseluisbz:
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /etc/systemd/system/mariadb.service.
[joseluisbz@Vxbox-Lnx ~]$


Checking...



[joseluisbz@Vxbox-Lnx ~]$ sudo service mariadb start
[sudo] password for joseluisbz:
Redirecting to /bin/systemctl start mariadb.service
[joseluisbz@Vxbox-Lnx ~]$ mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[joseluisbz@Vxbox-Lnx ~]$


STATUS



$ sudo systemctl status mariadb.service
[sudo] password for joseluisbz:
● mariadb.service - start and stop MySQL(MariaDB) Server
Loaded: loaded (/etc/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2017-03-08 20:09:47 COT; 5min ago
Process: 4556 ExecStart=/usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data (code=exited, status=1/FAILURE)
Main PID: 4556 (code=exited, status=1/FAILURE)

Mar 08 20:09:47 Vxbox-Lnx systemd[1]: Started start and stop MySQL(MariaDB) Server.
Mar 08 20:09:47 Vxbox-Lnx systemd[1]: Starting start and stop MySQL(MariaDB) Server...
Mar 08 20:09:47 Vxbox-Lnx mysqld_safe[4556]: 170308 20:09:47 mysqld_safe Logging to '/usr/local/ServerWeb/mariadb/data/server.err'.
Mar 08 20:09:47 Vxbox-Lnx systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
Mar 08 20:09:47 Vxbox-Lnx systemd[1]: Unit mariadb.service entered failed state.
Mar 08 20:09:47 Vxbox-Lnx systemd[1]: mariadb.service failed.
[joseluisbz@Vxbox-Lnx ~]$


Another Check



$ sudo systemctl --failed
[sudo] password for joseluisbz:
UNIT LOAD ACTIVE SUB DESCRIPTION
● kdump.service loaded failed failed Crash recovery kernel arming
● mariadb.service loaded failed failed start and stop MySQL(MariaDB) Server

LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.

2 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[joseluisbz@Vxbox-Lnx ~]$






centos boot systemd services mariadb






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 9 '17 at 14:33









Jeff Schaller

42.1k1156133




42.1k1156133










asked Mar 9 '17 at 0:19









chepe luchochepe lucho

178114




178114







  • 1





    When you try to start it by hand you do sudo mysqld_safe ..., so you are starting service as root user. In your service config file you have User=Umariadb Group=Gmariadb and you end with ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) . Do you have some permission problems?

    – Kalavan
    Mar 9 '17 at 9:36






  • 1





    Yes, yesterday I was reviewing this. I will edit my question for more information.

    – chepe lucho
    Mar 9 '17 at 12:10











  • Why are you writing your own MariaDB systemd file? Even if your OS didn't ship with one, surely there are ones available from other distributions that you could use as model.

    – Mark Stosberg
    Mar 9 '17 at 19:02











  • @Kalavan this my ownership discovering... (antes de ayer, I don' know translate to english, yesterday of yesterday) of log file, Now I checked if works...

    – chepe lucho
    Mar 10 '17 at 17:11













  • 1





    When you try to start it by hand you do sudo mysqld_safe ..., so you are starting service as root user. In your service config file you have User=Umariadb Group=Gmariadb and you end with ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) . Do you have some permission problems?

    – Kalavan
    Mar 9 '17 at 9:36






  • 1





    Yes, yesterday I was reviewing this. I will edit my question for more information.

    – chepe lucho
    Mar 9 '17 at 12:10











  • Why are you writing your own MariaDB systemd file? Even if your OS didn't ship with one, surely there are ones available from other distributions that you could use as model.

    – Mark Stosberg
    Mar 9 '17 at 19:02











  • @Kalavan this my ownership discovering... (antes de ayer, I don' know translate to english, yesterday of yesterday) of log file, Now I checked if works...

    – chepe lucho
    Mar 10 '17 at 17:11








1




1





When you try to start it by hand you do sudo mysqld_safe ..., so you are starting service as root user. In your service config file you have User=Umariadb Group=Gmariadb and you end with ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) . Do you have some permission problems?

– Kalavan
Mar 9 '17 at 9:36





When you try to start it by hand you do sudo mysqld_safe ..., so you are starting service as root user. In your service config file you have User=Umariadb Group=Gmariadb and you end with ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) . Do you have some permission problems?

– Kalavan
Mar 9 '17 at 9:36




1




1





Yes, yesterday I was reviewing this. I will edit my question for more information.

– chepe lucho
Mar 9 '17 at 12:10





Yes, yesterday I was reviewing this. I will edit my question for more information.

– chepe lucho
Mar 9 '17 at 12:10













Why are you writing your own MariaDB systemd file? Even if your OS didn't ship with one, surely there are ones available from other distributions that you could use as model.

– Mark Stosberg
Mar 9 '17 at 19:02





Why are you writing your own MariaDB systemd file? Even if your OS didn't ship with one, surely there are ones available from other distributions that you could use as model.

– Mark Stosberg
Mar 9 '17 at 19:02













@Kalavan this my ownership discovering... (antes de ayer, I don' know translate to english, yesterday of yesterday) of log file, Now I checked if works...

– chepe lucho
Mar 10 '17 at 17:11






@Kalavan this my ownership discovering... (antes de ayer, I don' know translate to english, yesterday of yesterday) of log file, Now I checked if works...

– chepe lucho
Mar 10 '17 at 17:11











3 Answers
3






active

oldest

votes


















2














Do not use mysqld_safe.



You have all sorts of problems, all down to building a contender for a place in the systemd House of Horror by running a Poor Man's Dæmon Supervisor (written badly in shell script) underneath service management. You could laboriously go through and tweak things so that they interoperate better, dealing with readiness protocol mismatches and with conflicts where you have ended up setting things two different ways in two different places, but that would really be pointless. Instead, learn from the daemontools world, which has wanted mysqld_safe gone since the turn of the century.



All these years later, you can get rid of it in the systemd world, too. The MariaDB world has the distinction, in stark contrast to Oracle and the MySQL world, of actually providing good doco on how to run MariaDB in the way that daemontools/runit/s6 users have wanted all of these years, without mysqld_safe and instead using the service management toolset for service management.



MariaDB comes with a mariadb.service service unit for systemd, and a mariadb-service-convert tool that migrates the settings from my.cnf into systemd service unit settings. It even comes with a mariadb@.service service unit template, that allows one to run multiple servers as distinct services. Use those.



Further reading



  • Jonathan de Boyne Pollard (2015). The systemd House of Horror. Frequently Given Answers.

  • Jonathan de Boyne Pollard (2016). MariaDB and MySQL with nosh. Softwares.


  • "systemd". Starting and Stopping MariaDB. KnowledgeBase. MariaDB. 2016.


  • "Starting and Stopping MariaDB Automatically". Starting and Stopping MariaDB. KnowledgeBase. MariaDB. 2016.





share|improve this answer

























  • Thank you... I was reading your article... have you a step by step?

    – chepe lucho
    Mar 10 '17 at 17:02



















0














My Installation process was (before to ask)



sudo tar zxvf /media/sf_Users/josebernal/Downloads/Php Tomcat Httpd MySQL/mariadb-10.1.20-linux-x86_64.tar.gz -C /usr/local/
sudo ln -s /usr/local/mariadb-10.1.20-linux-x86_64 /usr/local/ServerWeb/mariadb

sudo groupadd -r Gmariadb
sudo useradd -g Gmariadb -c "MariaDB User" -s /sbin/nologin -r Umariadb

sudo chown -R Umariadb:Gmariadb /usr/local/ServerWeb/mariadb/
sudo cp /usr/local/ServerWeb/mariadb/support-files/my-small.cnf /etc/my.cnf
... EDIT the config mariadb (mysql) file named my.cnf

sudo /usr/local/ServerWeb/mariadb/scripts/mysql_install_db --user=mysql --basedir=/usr/local/ServerWeb/mariadb --datadir=/usr/local/ServerWeb/mariadb/data --log-error=/usr/local/ServerWeb/mariadb/data/server.err &
....
... The next steps..


Even before I reported (asked) the problem I checked Ownership ...



[joseluisbz@Vxbox-Lnx ~]$ ls -al /usr/local/ServerWeb/mariadb/
total 224
drwxrwxr-x 13 Umariadb Gmariadb 4096 Dec 14 23:27 .
drwxr-xr-x. 18 root root 4096 Jan 5 12:00 ..
drwxrwxr-x 2 Umariadb Gmariadb 4096 Nov 18 15:03 bin
-rw-r--r-- 1 Umariadb Gmariadb 17987 Dec 14 14:25 COPYING
-rw-r--r-- 1 Umariadb Gmariadb 26545 Dec 14 14:25 COPYING.LESSER
-rw-r--r-- 1 Umariadb Gmariadb 86259 Dec 14 14:25 COPYING.thirdparty
-rw-r--r-- 1 Umariadb Gmariadb 2122 Dec 14 14:25 CREDITS
drwxrwxr-x 4 mysql Gmariadb 4096 Mar 8 20:25 data
drwxrwxr-x 2 Umariadb Gmariadb 30 Dec 14 23:26 DESTINATION
-rw-r--r-- 1 Umariadb Gmariadb 8245 Dec 14 14:25 EXCEPTIONS-CLIENT
drwxrwxr-x 3 Umariadb Gmariadb 18 Dec 14 23:26 include
-rw-r--r-- 1 Umariadb Gmariadb 8694 Dec 14 14:25 INSTALL-BINARY
drwxrwxr-x 4 Umariadb Gmariadb 4096 Nov 18 15:03 lib
drwxrwxr-x 4 Umariadb Gmariadb 28 Dec 14 23:27 man
drwxrwxr-x 11 Umariadb Gmariadb 4096 Dec 14 23:26 mysql-test
-rw-r--r-- 1 Umariadb Gmariadb 2105 Dec 14 14:25 README
-rw-r--r-- 1 Umariadb Gmariadb 19510 Dec 14 14:25 README-wsrep
drwxrwxr-x 2 Umariadb Gmariadb 29 Dec 14 23:27 scripts
drwxrwxr-x 29 Umariadb Gmariadb 4096 Dec 14 23:26 share
drwxrwxr-x 4 Umariadb Gmariadb 4096 Dec 14 23:27 sql-bench
drwxrwxr-x 3 Umariadb Gmariadb 4096 Jan 4 22:32 support-files


I noted on the data folder, the ownership is belong to (mysql:mysql) after of installation, but I thought it was that service script problem (mariadb.service)...



[joseluisbz@Vxbox-Lnx ~]$ ls -al /usr/local/ServerWeb/mariadb/data/
total 110624
drwxrwxr-x 4 mysql Gmariadb 4096 Mar 8 20:25 .
drwxrwxr-x 13 Umariadb Gmariadb 4096 Dec 14 23:27 ..
-rw-rw---- 1 mysql mysql 16384 Mar 8 19:59 aria_log.00000001
-rw-rw---- 1 mysql mysql 52 Mar 8 19:59 aria_log_control
-rw-rw---- 1 mysql mysql 12582912 Mar 8 19:59 ibdata1
-rw-rw---- 1 mysql mysql 50331648 Mar 8 19:59 ib_logfile0
-rw-rw---- 1 mysql mysql 50331648 Jan 4 22:01 ib_logfile1
-rw-rw---- 1 mysql mysql 0 Jan 4 22:05 multi-master.info
drwx------ 2 mysql root 4096 Jan 4 22:01 mysql
drwx------ 2 mysql mysql 19 Jan 4 22:01 performance_schema
-rw-rw---- 1 mysql mysql 0 Mar 8 20:04 server.err
[joseluisbz@Vxbox-Lnx ~]$


@Kalavan confirmed my suspicion of ownership, then I needed to change the ownership after installation process ...



sudo chown -R Umariadb:Gmariadb /usr/local/ServerWeb/mariadb/


I reboot my CentOS 7, and the service was WORKING!!!



I Checked the log file /usr/local/ServerWeb/mariadb/data/server.err..



170308 20:36:23 mysqld_safe Starting mysqld daemon with databases from /usr/local/ServerWeb/mariadb/data
2017-03-08 20:36:23 140485189175168 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld (mysqld 10.1.20-MariaDB) starting as process 2360 ...
2017-03-08 20:36:24 140485189175168 [Warning] One can only use the --user switch if running as root

2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2017-03-08 20:36:24 140485189175168 [Note] InnoDB: The InnoDB memory heap is disabled
2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-08 20:36:24 140485189175168 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Using Linux native AIO
2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Using SSE crc32 instructions
2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Completed initialization of buffer pool
2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Highest supported file format is Barracuda.
2017-03-08 20:36:24 140485189175168 [Note] InnoDB: 128 rollback segment(s) are active.
2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Waiting for purge to start
2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.34-79.1 started; log sequence number 1622948
2017-03-08 20:36:25 140485189175168 [Note] Plugin 'FEEDBACK' is disabled.
2017-03-08 20:36:25 140484651484928 [Note] InnoDB: Dumping buffer pool(s) not yet started
2017-03-08 20:36:25 140485189175168 [Note] Server socket created on IP: '::'.
2017-03-08 20:36:25 140485189175168 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: ready for connections.
Version: '10.1.20-MariaDB' socket: '/tmp/mysql.sock' port: 3306 MariaDB Server


Checking PID



[joseluisbz@Vxbox-Lnx ~]$ ps -aux | grep mariadb
mysql 1652 0.0 0.1 113264 1656 ? Ss 11:42 0:00 /bin/sh /usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data
mysql 2458 0.2 5.6 591028 87172 ? Sl 11:42 0:00 /usr/local/ServerWeb/mariadb/bin/mysqld --basedir=/usr/local/ServerWeb/mariadb --datadir=/usr/local/ServerWeb/mariadb/data --plugin-dir=/usr/local/ServerWeb/mariadb/lib/plugin --log-error=/usr/local/ServerWeb/mariadb/data/server.err --pid-file=Vxbox-Lnx.pid --socket=/tmp/mysql.sock --port=3306
joselui+ 4489 0.0 0.0 112652 964 pts/0 R+ 11:44 0:00 grep --color=auto mariadb
[joseluisbz@Vxbox-Lnx ~]$


Effectively mariadb is running!!!



I checked the Status



$ sudo systemctl status mariadb.service
[sudo] password for joseluisbz:
● mariadb.service - start and stop MySQL(MariaDB) Server
Loaded: loaded (/etc/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2017-03-10 11:42:07 COT; 17min ago
Main PID: 1652 (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─1652 /bin/sh /usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data...
└─2458 /usr/local/ServerWeb/mariadb/bin/mysqld --basedir=/usr/local/ServerWeb/mariadb --datadir=/usr/local/ServerWeb/mariadb/data --plugin-dir=/usr/local/Ser...

Mar 10 11:42:07 Vxbox-Lnx systemd[1]: Started start and stop MySQL(MariaDB) Server.
Mar 10 11:42:07 Vxbox-Lnx systemd[1]: Starting start and stop MySQL(MariaDB) Server...
Mar 10 11:42:09 Vxbox-Lnx mysqld_safe[1652]: 170310 11:42:09 mysqld_safe Logging to '/usr/local/ServerWeb/mariadb/data/server.err'.
[joseluisbz@Vxbox-Lnx ~]$


But I can't connect!!



$ sudo mysql -u root -p
[sudo] password for joseluisbz:
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[joseluisbz@Vxbox-Lnx ~]$


I check the existence of the mysql.sock file (but, there is not)...



# ls -al /tmp/
total 24
drwxrwxrwt. 22 root root 4096 Mar 10 12:28 .
dr-xr-xr-x. 19 root root 4096 Feb 18 21:21 ..
drwx------ 2 joseluisbz joseluisbz 52 Mar 10 11:42 akonadi-joseluisbz.Fim4n9
drwx------ 2 joseluisbz joseluisbz 50 Mar 10 09:20 .com.google.Chrome.I956Ja
drwx------ 2 joseluisbz joseluisbz 50 Mar 10 07:38 .com.google.Chrome.ibPaUS
drwx------ 2 joseluisbz joseluisbz 50 Mar 9 07:31 .com.google.Chrome.oIW6st
drwx------ 2 joseluisbz joseluisbz 50 Mar 8 19:22 .com.google.Chrome.pGYMUt
drwx------. 2 joseluisbz joseluisbz 19 Mar 10 11:42 .esd-1000
drwxrwxrwt. 2 root root 6 Oct 10 20:09 .font-unix
prw------- 1 root root 0 Mar 10 11:42 hogsuspend
drwxrwxrwt. 2 root root 4096 Mar 10 11:42 .ICE-unix
drwx------. 2 joseluisbz joseluisbz 50 Mar 10 12:25 kde-joseluisbz
drwx------ 2 root root 23 Mar 10 11:44 kde-root
drwx------ 2 root root 4096 Mar 10 11:44 ksocket-root
drwx------ 2 joseluisbz joseluisbz 23 Mar 10 11:42 ssh-aOJwbK0vltXX
drwx------ 3 root root 16 Mar 10 11:42 systemd-private-65b25dd58edd4711ad864dc007925904-colord.service-EVVMql
drwx------ 3 root root 16 Mar 10 11:42 systemd-private-65b25dd58edd4711ad864dc007925904-cups.service-jOD1sm
drwx------ 3 root root 16 Mar 10 11:42 systemd-private-65b25dd58edd4711ad864dc007925904-mariadb.service-eioofZ
drwx------ 3 root root 16 Mar 9 15:11 systemd-private-65b25dd58edd4711ad864dc007925904-rtkit-daemon.service-E5cH4Y
drwxrwxrwt. 2 root root 6 Oct 10 20:09 .Test-unix
drwx------. 2 joseluisbz joseluisbz 6 Oct 10 20:42 tracker-extract-files.1000
-r--r--r-- 1 root root 11 Mar 10 11:42 .X0-lock
drwxrwxrwt. 2 root root 24 Mar 10 11:42 .X11-unix
-rw------- 1 root root 54 Mar 10 08:35 xauth.XXXXTFUQeQ
drwxrwxrwt. 2 root root 6 Oct 10 20:09 .XIM-unix
[root@Vxbox-Lnx joseluisbz]#


Then I changed the config file /etc/my.cnf changing the socket location, and sure the ownership (to respective user:group) folder of its location...



[client]
...
socket = /usr/local/ServerWeb/mariadb/tmp/mysql.sock
...

[mysqld]
...
socket = /usr/local/ServerWeb/mariadb/tmp/mysql.sock
...


And created the folder tmp for socket and ensuring the ownership again!



sudo mkdir -pv /usr/local/ServerWeb/mariadb/tmp
sudo chown -R Umariadb:Gmariadb /usr/local/ServerWeb/mariadb/


LATER of this changes and rebooting CentOS 7



Verifing log file /usr/local/ServerWeb/mariadb/data/server.err..



170311 17:31:50 mysqld_safe Starting mysqld daemon with databases from /usr/local/ServerWeb/mariadb/data
2017-03-11 17:31:50 139805859948416 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld (mysqld 10.1.20-MariaDB) starting as process 2187 ...
2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2017-03-11 17:31:51 139805859948416 [Note] InnoDB: The InnoDB memory heap is disabled
2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-11 17:31:51 139805859948416 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Using Linux native AIO
2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Using SSE crc32 instructions
2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Completed initialization of buffer pool
2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Highest supported file format is Barracuda.
2017-03-11 17:31:51 139805859948416 [Note] InnoDB: 128 rollback segment(s) are active.
2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Waiting for purge to start
2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.34-79.1 started; log sequence number 1623144
2017-03-11 17:31:51 139805379786496 [Note] InnoDB: Dumping buffer pool(s) not yet started
2017-03-11 17:31:51 139805859948416 [Note] Plugin 'FEEDBACK' is disabled.
2017-03-11 17:31:51 139805859948416 [Note] Server socket created on IP: '::'.
2017-03-11 17:31:52 139805859948416 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: ready for connections.
Version: '10.1.20-MariaDB' socket: '/usr/local/ServerWeb/mariadb/tmp/mysql.sock' port: 3306 MariaDB Server


Starting the client...



[joseluisbz@Vxbox-Lnx ~]$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 2
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]>


Works perfectly...



Resume of solution



  • The order of changed Ownership to Umariadb:Gmariadb Only after of Installation.

  • Changing location of Socket where user:group can to write...

NOTE: The original file /etc/systemd/system/mariadb.service has not problem!






share|improve this answer
































    -1














    This worked for me:



    mv /var/lib/mysql/* /opt/





    share|improve this answer
























      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f350129%2fmariadb-service-is-not-starting-after-boot-centos-7%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      Do not use mysqld_safe.



      You have all sorts of problems, all down to building a contender for a place in the systemd House of Horror by running a Poor Man's Dæmon Supervisor (written badly in shell script) underneath service management. You could laboriously go through and tweak things so that they interoperate better, dealing with readiness protocol mismatches and with conflicts where you have ended up setting things two different ways in two different places, but that would really be pointless. Instead, learn from the daemontools world, which has wanted mysqld_safe gone since the turn of the century.



      All these years later, you can get rid of it in the systemd world, too. The MariaDB world has the distinction, in stark contrast to Oracle and the MySQL world, of actually providing good doco on how to run MariaDB in the way that daemontools/runit/s6 users have wanted all of these years, without mysqld_safe and instead using the service management toolset for service management.



      MariaDB comes with a mariadb.service service unit for systemd, and a mariadb-service-convert tool that migrates the settings from my.cnf into systemd service unit settings. It even comes with a mariadb@.service service unit template, that allows one to run multiple servers as distinct services. Use those.



      Further reading



      • Jonathan de Boyne Pollard (2015). The systemd House of Horror. Frequently Given Answers.

      • Jonathan de Boyne Pollard (2016). MariaDB and MySQL with nosh. Softwares.


      • "systemd". Starting and Stopping MariaDB. KnowledgeBase. MariaDB. 2016.


      • "Starting and Stopping MariaDB Automatically". Starting and Stopping MariaDB. KnowledgeBase. MariaDB. 2016.





      share|improve this answer

























      • Thank you... I was reading your article... have you a step by step?

        – chepe lucho
        Mar 10 '17 at 17:02
















      2














      Do not use mysqld_safe.



      You have all sorts of problems, all down to building a contender for a place in the systemd House of Horror by running a Poor Man's Dæmon Supervisor (written badly in shell script) underneath service management. You could laboriously go through and tweak things so that they interoperate better, dealing with readiness protocol mismatches and with conflicts where you have ended up setting things two different ways in two different places, but that would really be pointless. Instead, learn from the daemontools world, which has wanted mysqld_safe gone since the turn of the century.



      All these years later, you can get rid of it in the systemd world, too. The MariaDB world has the distinction, in stark contrast to Oracle and the MySQL world, of actually providing good doco on how to run MariaDB in the way that daemontools/runit/s6 users have wanted all of these years, without mysqld_safe and instead using the service management toolset for service management.



      MariaDB comes with a mariadb.service service unit for systemd, and a mariadb-service-convert tool that migrates the settings from my.cnf into systemd service unit settings. It even comes with a mariadb@.service service unit template, that allows one to run multiple servers as distinct services. Use those.



      Further reading



      • Jonathan de Boyne Pollard (2015). The systemd House of Horror. Frequently Given Answers.

      • Jonathan de Boyne Pollard (2016). MariaDB and MySQL with nosh. Softwares.


      • "systemd". Starting and Stopping MariaDB. KnowledgeBase. MariaDB. 2016.


      • "Starting and Stopping MariaDB Automatically". Starting and Stopping MariaDB. KnowledgeBase. MariaDB. 2016.





      share|improve this answer

























      • Thank you... I was reading your article... have you a step by step?

        – chepe lucho
        Mar 10 '17 at 17:02














      2












      2








      2







      Do not use mysqld_safe.



      You have all sorts of problems, all down to building a contender for a place in the systemd House of Horror by running a Poor Man's Dæmon Supervisor (written badly in shell script) underneath service management. You could laboriously go through and tweak things so that they interoperate better, dealing with readiness protocol mismatches and with conflicts where you have ended up setting things two different ways in two different places, but that would really be pointless. Instead, learn from the daemontools world, which has wanted mysqld_safe gone since the turn of the century.



      All these years later, you can get rid of it in the systemd world, too. The MariaDB world has the distinction, in stark contrast to Oracle and the MySQL world, of actually providing good doco on how to run MariaDB in the way that daemontools/runit/s6 users have wanted all of these years, without mysqld_safe and instead using the service management toolset for service management.



      MariaDB comes with a mariadb.service service unit for systemd, and a mariadb-service-convert tool that migrates the settings from my.cnf into systemd service unit settings. It even comes with a mariadb@.service service unit template, that allows one to run multiple servers as distinct services. Use those.



      Further reading



      • Jonathan de Boyne Pollard (2015). The systemd House of Horror. Frequently Given Answers.

      • Jonathan de Boyne Pollard (2016). MariaDB and MySQL with nosh. Softwares.


      • "systemd". Starting and Stopping MariaDB. KnowledgeBase. MariaDB. 2016.


      • "Starting and Stopping MariaDB Automatically". Starting and Stopping MariaDB. KnowledgeBase. MariaDB. 2016.





      share|improve this answer















      Do not use mysqld_safe.



      You have all sorts of problems, all down to building a contender for a place in the systemd House of Horror by running a Poor Man's Dæmon Supervisor (written badly in shell script) underneath service management. You could laboriously go through and tweak things so that they interoperate better, dealing with readiness protocol mismatches and with conflicts where you have ended up setting things two different ways in two different places, but that would really be pointless. Instead, learn from the daemontools world, which has wanted mysqld_safe gone since the turn of the century.



      All these years later, you can get rid of it in the systemd world, too. The MariaDB world has the distinction, in stark contrast to Oracle and the MySQL world, of actually providing good doco on how to run MariaDB in the way that daemontools/runit/s6 users have wanted all of these years, without mysqld_safe and instead using the service management toolset for service management.



      MariaDB comes with a mariadb.service service unit for systemd, and a mariadb-service-convert tool that migrates the settings from my.cnf into systemd service unit settings. It even comes with a mariadb@.service service unit template, that allows one to run multiple servers as distinct services. Use those.



      Further reading



      • Jonathan de Boyne Pollard (2015). The systemd House of Horror. Frequently Given Answers.

      • Jonathan de Boyne Pollard (2016). MariaDB and MySQL with nosh. Softwares.


      • "systemd". Starting and Stopping MariaDB. KnowledgeBase. MariaDB. 2016.


      • "Starting and Stopping MariaDB Automatically". Starting and Stopping MariaDB. KnowledgeBase. MariaDB. 2016.






      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Mar 11 '17 at 9:03

























      answered Mar 9 '17 at 23:24









      JdeBPJdeBP

      35.3k470165




      35.3k470165












      • Thank you... I was reading your article... have you a step by step?

        – chepe lucho
        Mar 10 '17 at 17:02


















      • Thank you... I was reading your article... have you a step by step?

        – chepe lucho
        Mar 10 '17 at 17:02

















      Thank you... I was reading your article... have you a step by step?

      – chepe lucho
      Mar 10 '17 at 17:02






      Thank you... I was reading your article... have you a step by step?

      – chepe lucho
      Mar 10 '17 at 17:02














      0














      My Installation process was (before to ask)



      sudo tar zxvf /media/sf_Users/josebernal/Downloads/Php Tomcat Httpd MySQL/mariadb-10.1.20-linux-x86_64.tar.gz -C /usr/local/
      sudo ln -s /usr/local/mariadb-10.1.20-linux-x86_64 /usr/local/ServerWeb/mariadb

      sudo groupadd -r Gmariadb
      sudo useradd -g Gmariadb -c "MariaDB User" -s /sbin/nologin -r Umariadb

      sudo chown -R Umariadb:Gmariadb /usr/local/ServerWeb/mariadb/
      sudo cp /usr/local/ServerWeb/mariadb/support-files/my-small.cnf /etc/my.cnf
      ... EDIT the config mariadb (mysql) file named my.cnf

      sudo /usr/local/ServerWeb/mariadb/scripts/mysql_install_db --user=mysql --basedir=/usr/local/ServerWeb/mariadb --datadir=/usr/local/ServerWeb/mariadb/data --log-error=/usr/local/ServerWeb/mariadb/data/server.err &
      ....
      ... The next steps..


      Even before I reported (asked) the problem I checked Ownership ...



      [joseluisbz@Vxbox-Lnx ~]$ ls -al /usr/local/ServerWeb/mariadb/
      total 224
      drwxrwxr-x 13 Umariadb Gmariadb 4096 Dec 14 23:27 .
      drwxr-xr-x. 18 root root 4096 Jan 5 12:00 ..
      drwxrwxr-x 2 Umariadb Gmariadb 4096 Nov 18 15:03 bin
      -rw-r--r-- 1 Umariadb Gmariadb 17987 Dec 14 14:25 COPYING
      -rw-r--r-- 1 Umariadb Gmariadb 26545 Dec 14 14:25 COPYING.LESSER
      -rw-r--r-- 1 Umariadb Gmariadb 86259 Dec 14 14:25 COPYING.thirdparty
      -rw-r--r-- 1 Umariadb Gmariadb 2122 Dec 14 14:25 CREDITS
      drwxrwxr-x 4 mysql Gmariadb 4096 Mar 8 20:25 data
      drwxrwxr-x 2 Umariadb Gmariadb 30 Dec 14 23:26 DESTINATION
      -rw-r--r-- 1 Umariadb Gmariadb 8245 Dec 14 14:25 EXCEPTIONS-CLIENT
      drwxrwxr-x 3 Umariadb Gmariadb 18 Dec 14 23:26 include
      -rw-r--r-- 1 Umariadb Gmariadb 8694 Dec 14 14:25 INSTALL-BINARY
      drwxrwxr-x 4 Umariadb Gmariadb 4096 Nov 18 15:03 lib
      drwxrwxr-x 4 Umariadb Gmariadb 28 Dec 14 23:27 man
      drwxrwxr-x 11 Umariadb Gmariadb 4096 Dec 14 23:26 mysql-test
      -rw-r--r-- 1 Umariadb Gmariadb 2105 Dec 14 14:25 README
      -rw-r--r-- 1 Umariadb Gmariadb 19510 Dec 14 14:25 README-wsrep
      drwxrwxr-x 2 Umariadb Gmariadb 29 Dec 14 23:27 scripts
      drwxrwxr-x 29 Umariadb Gmariadb 4096 Dec 14 23:26 share
      drwxrwxr-x 4 Umariadb Gmariadb 4096 Dec 14 23:27 sql-bench
      drwxrwxr-x 3 Umariadb Gmariadb 4096 Jan 4 22:32 support-files


      I noted on the data folder, the ownership is belong to (mysql:mysql) after of installation, but I thought it was that service script problem (mariadb.service)...



      [joseluisbz@Vxbox-Lnx ~]$ ls -al /usr/local/ServerWeb/mariadb/data/
      total 110624
      drwxrwxr-x 4 mysql Gmariadb 4096 Mar 8 20:25 .
      drwxrwxr-x 13 Umariadb Gmariadb 4096 Dec 14 23:27 ..
      -rw-rw---- 1 mysql mysql 16384 Mar 8 19:59 aria_log.00000001
      -rw-rw---- 1 mysql mysql 52 Mar 8 19:59 aria_log_control
      -rw-rw---- 1 mysql mysql 12582912 Mar 8 19:59 ibdata1
      -rw-rw---- 1 mysql mysql 50331648 Mar 8 19:59 ib_logfile0
      -rw-rw---- 1 mysql mysql 50331648 Jan 4 22:01 ib_logfile1
      -rw-rw---- 1 mysql mysql 0 Jan 4 22:05 multi-master.info
      drwx------ 2 mysql root 4096 Jan 4 22:01 mysql
      drwx------ 2 mysql mysql 19 Jan 4 22:01 performance_schema
      -rw-rw---- 1 mysql mysql 0 Mar 8 20:04 server.err
      [joseluisbz@Vxbox-Lnx ~]$


      @Kalavan confirmed my suspicion of ownership, then I needed to change the ownership after installation process ...



      sudo chown -R Umariadb:Gmariadb /usr/local/ServerWeb/mariadb/


      I reboot my CentOS 7, and the service was WORKING!!!



      I Checked the log file /usr/local/ServerWeb/mariadb/data/server.err..



      170308 20:36:23 mysqld_safe Starting mysqld daemon with databases from /usr/local/ServerWeb/mariadb/data
      2017-03-08 20:36:23 140485189175168 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld (mysqld 10.1.20-MariaDB) starting as process 2360 ...
      2017-03-08 20:36:24 140485189175168 [Warning] One can only use the --user switch if running as root

      2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Using mutexes to ref count buffer pool pages
      2017-03-08 20:36:24 140485189175168 [Note] InnoDB: The InnoDB memory heap is disabled
      2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
      2017-03-08 20:36:24 140485189175168 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
      2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Compressed tables use zlib 1.2.3
      2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Using Linux native AIO
      2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Using SSE crc32 instructions
      2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Initializing buffer pool, size = 128.0M
      2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Completed initialization of buffer pool
      2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Highest supported file format is Barracuda.
      2017-03-08 20:36:24 140485189175168 [Note] InnoDB: 128 rollback segment(s) are active.
      2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Waiting for purge to start
      2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.34-79.1 started; log sequence number 1622948
      2017-03-08 20:36:25 140485189175168 [Note] Plugin 'FEEDBACK' is disabled.
      2017-03-08 20:36:25 140484651484928 [Note] InnoDB: Dumping buffer pool(s) not yet started
      2017-03-08 20:36:25 140485189175168 [Note] Server socket created on IP: '::'.
      2017-03-08 20:36:25 140485189175168 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: ready for connections.
      Version: '10.1.20-MariaDB' socket: '/tmp/mysql.sock' port: 3306 MariaDB Server


      Checking PID



      [joseluisbz@Vxbox-Lnx ~]$ ps -aux | grep mariadb
      mysql 1652 0.0 0.1 113264 1656 ? Ss 11:42 0:00 /bin/sh /usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data
      mysql 2458 0.2 5.6 591028 87172 ? Sl 11:42 0:00 /usr/local/ServerWeb/mariadb/bin/mysqld --basedir=/usr/local/ServerWeb/mariadb --datadir=/usr/local/ServerWeb/mariadb/data --plugin-dir=/usr/local/ServerWeb/mariadb/lib/plugin --log-error=/usr/local/ServerWeb/mariadb/data/server.err --pid-file=Vxbox-Lnx.pid --socket=/tmp/mysql.sock --port=3306
      joselui+ 4489 0.0 0.0 112652 964 pts/0 R+ 11:44 0:00 grep --color=auto mariadb
      [joseluisbz@Vxbox-Lnx ~]$


      Effectively mariadb is running!!!



      I checked the Status



      $ sudo systemctl status mariadb.service
      [sudo] password for joseluisbz:
      ● mariadb.service - start and stop MySQL(MariaDB) Server
      Loaded: loaded (/etc/systemd/system/mariadb.service; enabled; vendor preset: disabled)
      Active: active (running) since Fri 2017-03-10 11:42:07 COT; 17min ago
      Main PID: 1652 (mysqld_safe)
      CGroup: /system.slice/mariadb.service
      ├─1652 /bin/sh /usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data...
      └─2458 /usr/local/ServerWeb/mariadb/bin/mysqld --basedir=/usr/local/ServerWeb/mariadb --datadir=/usr/local/ServerWeb/mariadb/data --plugin-dir=/usr/local/Ser...

      Mar 10 11:42:07 Vxbox-Lnx systemd[1]: Started start and stop MySQL(MariaDB) Server.
      Mar 10 11:42:07 Vxbox-Lnx systemd[1]: Starting start and stop MySQL(MariaDB) Server...
      Mar 10 11:42:09 Vxbox-Lnx mysqld_safe[1652]: 170310 11:42:09 mysqld_safe Logging to '/usr/local/ServerWeb/mariadb/data/server.err'.
      [joseluisbz@Vxbox-Lnx ~]$


      But I can't connect!!



      $ sudo mysql -u root -p
      [sudo] password for joseluisbz:
      Enter password:
      ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
      [joseluisbz@Vxbox-Lnx ~]$


      I check the existence of the mysql.sock file (but, there is not)...



      # ls -al /tmp/
      total 24
      drwxrwxrwt. 22 root root 4096 Mar 10 12:28 .
      dr-xr-xr-x. 19 root root 4096 Feb 18 21:21 ..
      drwx------ 2 joseluisbz joseluisbz 52 Mar 10 11:42 akonadi-joseluisbz.Fim4n9
      drwx------ 2 joseluisbz joseluisbz 50 Mar 10 09:20 .com.google.Chrome.I956Ja
      drwx------ 2 joseluisbz joseluisbz 50 Mar 10 07:38 .com.google.Chrome.ibPaUS
      drwx------ 2 joseluisbz joseluisbz 50 Mar 9 07:31 .com.google.Chrome.oIW6st
      drwx------ 2 joseluisbz joseluisbz 50 Mar 8 19:22 .com.google.Chrome.pGYMUt
      drwx------. 2 joseluisbz joseluisbz 19 Mar 10 11:42 .esd-1000
      drwxrwxrwt. 2 root root 6 Oct 10 20:09 .font-unix
      prw------- 1 root root 0 Mar 10 11:42 hogsuspend
      drwxrwxrwt. 2 root root 4096 Mar 10 11:42 .ICE-unix
      drwx------. 2 joseluisbz joseluisbz 50 Mar 10 12:25 kde-joseluisbz
      drwx------ 2 root root 23 Mar 10 11:44 kde-root
      drwx------ 2 root root 4096 Mar 10 11:44 ksocket-root
      drwx------ 2 joseluisbz joseluisbz 23 Mar 10 11:42 ssh-aOJwbK0vltXX
      drwx------ 3 root root 16 Mar 10 11:42 systemd-private-65b25dd58edd4711ad864dc007925904-colord.service-EVVMql
      drwx------ 3 root root 16 Mar 10 11:42 systemd-private-65b25dd58edd4711ad864dc007925904-cups.service-jOD1sm
      drwx------ 3 root root 16 Mar 10 11:42 systemd-private-65b25dd58edd4711ad864dc007925904-mariadb.service-eioofZ
      drwx------ 3 root root 16 Mar 9 15:11 systemd-private-65b25dd58edd4711ad864dc007925904-rtkit-daemon.service-E5cH4Y
      drwxrwxrwt. 2 root root 6 Oct 10 20:09 .Test-unix
      drwx------. 2 joseluisbz joseluisbz 6 Oct 10 20:42 tracker-extract-files.1000
      -r--r--r-- 1 root root 11 Mar 10 11:42 .X0-lock
      drwxrwxrwt. 2 root root 24 Mar 10 11:42 .X11-unix
      -rw------- 1 root root 54 Mar 10 08:35 xauth.XXXXTFUQeQ
      drwxrwxrwt. 2 root root 6 Oct 10 20:09 .XIM-unix
      [root@Vxbox-Lnx joseluisbz]#


      Then I changed the config file /etc/my.cnf changing the socket location, and sure the ownership (to respective user:group) folder of its location...



      [client]
      ...
      socket = /usr/local/ServerWeb/mariadb/tmp/mysql.sock
      ...

      [mysqld]
      ...
      socket = /usr/local/ServerWeb/mariadb/tmp/mysql.sock
      ...


      And created the folder tmp for socket and ensuring the ownership again!



      sudo mkdir -pv /usr/local/ServerWeb/mariadb/tmp
      sudo chown -R Umariadb:Gmariadb /usr/local/ServerWeb/mariadb/


      LATER of this changes and rebooting CentOS 7



      Verifing log file /usr/local/ServerWeb/mariadb/data/server.err..



      170311 17:31:50 mysqld_safe Starting mysqld daemon with databases from /usr/local/ServerWeb/mariadb/data
      2017-03-11 17:31:50 139805859948416 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld (mysqld 10.1.20-MariaDB) starting as process 2187 ...
      2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Using mutexes to ref count buffer pool pages
      2017-03-11 17:31:51 139805859948416 [Note] InnoDB: The InnoDB memory heap is disabled
      2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
      2017-03-11 17:31:51 139805859948416 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
      2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Compressed tables use zlib 1.2.3
      2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Using Linux native AIO
      2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Using SSE crc32 instructions
      2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Initializing buffer pool, size = 128.0M
      2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Completed initialization of buffer pool
      2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Highest supported file format is Barracuda.
      2017-03-11 17:31:51 139805859948416 [Note] InnoDB: 128 rollback segment(s) are active.
      2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Waiting for purge to start
      2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.34-79.1 started; log sequence number 1623144
      2017-03-11 17:31:51 139805379786496 [Note] InnoDB: Dumping buffer pool(s) not yet started
      2017-03-11 17:31:51 139805859948416 [Note] Plugin 'FEEDBACK' is disabled.
      2017-03-11 17:31:51 139805859948416 [Note] Server socket created on IP: '::'.
      2017-03-11 17:31:52 139805859948416 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: ready for connections.
      Version: '10.1.20-MariaDB' socket: '/usr/local/ServerWeb/mariadb/tmp/mysql.sock' port: 3306 MariaDB Server


      Starting the client...



      [joseluisbz@Vxbox-Lnx ~]$ mysql -u root -p
      Enter password:
      Welcome to the MariaDB monitor. Commands end with ; or g.
      Your MariaDB connection id is 2
      Server version: 10.1.20-MariaDB MariaDB Server

      Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

      Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

      MariaDB [(none)]>


      Works perfectly...



      Resume of solution



      • The order of changed Ownership to Umariadb:Gmariadb Only after of Installation.

      • Changing location of Socket where user:group can to write...

      NOTE: The original file /etc/systemd/system/mariadb.service has not problem!






      share|improve this answer





























        0














        My Installation process was (before to ask)



        sudo tar zxvf /media/sf_Users/josebernal/Downloads/Php Tomcat Httpd MySQL/mariadb-10.1.20-linux-x86_64.tar.gz -C /usr/local/
        sudo ln -s /usr/local/mariadb-10.1.20-linux-x86_64 /usr/local/ServerWeb/mariadb

        sudo groupadd -r Gmariadb
        sudo useradd -g Gmariadb -c "MariaDB User" -s /sbin/nologin -r Umariadb

        sudo chown -R Umariadb:Gmariadb /usr/local/ServerWeb/mariadb/
        sudo cp /usr/local/ServerWeb/mariadb/support-files/my-small.cnf /etc/my.cnf
        ... EDIT the config mariadb (mysql) file named my.cnf

        sudo /usr/local/ServerWeb/mariadb/scripts/mysql_install_db --user=mysql --basedir=/usr/local/ServerWeb/mariadb --datadir=/usr/local/ServerWeb/mariadb/data --log-error=/usr/local/ServerWeb/mariadb/data/server.err &
        ....
        ... The next steps..


        Even before I reported (asked) the problem I checked Ownership ...



        [joseluisbz@Vxbox-Lnx ~]$ ls -al /usr/local/ServerWeb/mariadb/
        total 224
        drwxrwxr-x 13 Umariadb Gmariadb 4096 Dec 14 23:27 .
        drwxr-xr-x. 18 root root 4096 Jan 5 12:00 ..
        drwxrwxr-x 2 Umariadb Gmariadb 4096 Nov 18 15:03 bin
        -rw-r--r-- 1 Umariadb Gmariadb 17987 Dec 14 14:25 COPYING
        -rw-r--r-- 1 Umariadb Gmariadb 26545 Dec 14 14:25 COPYING.LESSER
        -rw-r--r-- 1 Umariadb Gmariadb 86259 Dec 14 14:25 COPYING.thirdparty
        -rw-r--r-- 1 Umariadb Gmariadb 2122 Dec 14 14:25 CREDITS
        drwxrwxr-x 4 mysql Gmariadb 4096 Mar 8 20:25 data
        drwxrwxr-x 2 Umariadb Gmariadb 30 Dec 14 23:26 DESTINATION
        -rw-r--r-- 1 Umariadb Gmariadb 8245 Dec 14 14:25 EXCEPTIONS-CLIENT
        drwxrwxr-x 3 Umariadb Gmariadb 18 Dec 14 23:26 include
        -rw-r--r-- 1 Umariadb Gmariadb 8694 Dec 14 14:25 INSTALL-BINARY
        drwxrwxr-x 4 Umariadb Gmariadb 4096 Nov 18 15:03 lib
        drwxrwxr-x 4 Umariadb Gmariadb 28 Dec 14 23:27 man
        drwxrwxr-x 11 Umariadb Gmariadb 4096 Dec 14 23:26 mysql-test
        -rw-r--r-- 1 Umariadb Gmariadb 2105 Dec 14 14:25 README
        -rw-r--r-- 1 Umariadb Gmariadb 19510 Dec 14 14:25 README-wsrep
        drwxrwxr-x 2 Umariadb Gmariadb 29 Dec 14 23:27 scripts
        drwxrwxr-x 29 Umariadb Gmariadb 4096 Dec 14 23:26 share
        drwxrwxr-x 4 Umariadb Gmariadb 4096 Dec 14 23:27 sql-bench
        drwxrwxr-x 3 Umariadb Gmariadb 4096 Jan 4 22:32 support-files


        I noted on the data folder, the ownership is belong to (mysql:mysql) after of installation, but I thought it was that service script problem (mariadb.service)...



        [joseluisbz@Vxbox-Lnx ~]$ ls -al /usr/local/ServerWeb/mariadb/data/
        total 110624
        drwxrwxr-x 4 mysql Gmariadb 4096 Mar 8 20:25 .
        drwxrwxr-x 13 Umariadb Gmariadb 4096 Dec 14 23:27 ..
        -rw-rw---- 1 mysql mysql 16384 Mar 8 19:59 aria_log.00000001
        -rw-rw---- 1 mysql mysql 52 Mar 8 19:59 aria_log_control
        -rw-rw---- 1 mysql mysql 12582912 Mar 8 19:59 ibdata1
        -rw-rw---- 1 mysql mysql 50331648 Mar 8 19:59 ib_logfile0
        -rw-rw---- 1 mysql mysql 50331648 Jan 4 22:01 ib_logfile1
        -rw-rw---- 1 mysql mysql 0 Jan 4 22:05 multi-master.info
        drwx------ 2 mysql root 4096 Jan 4 22:01 mysql
        drwx------ 2 mysql mysql 19 Jan 4 22:01 performance_schema
        -rw-rw---- 1 mysql mysql 0 Mar 8 20:04 server.err
        [joseluisbz@Vxbox-Lnx ~]$


        @Kalavan confirmed my suspicion of ownership, then I needed to change the ownership after installation process ...



        sudo chown -R Umariadb:Gmariadb /usr/local/ServerWeb/mariadb/


        I reboot my CentOS 7, and the service was WORKING!!!



        I Checked the log file /usr/local/ServerWeb/mariadb/data/server.err..



        170308 20:36:23 mysqld_safe Starting mysqld daemon with databases from /usr/local/ServerWeb/mariadb/data
        2017-03-08 20:36:23 140485189175168 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld (mysqld 10.1.20-MariaDB) starting as process 2360 ...
        2017-03-08 20:36:24 140485189175168 [Warning] One can only use the --user switch if running as root

        2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Using mutexes to ref count buffer pool pages
        2017-03-08 20:36:24 140485189175168 [Note] InnoDB: The InnoDB memory heap is disabled
        2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
        2017-03-08 20:36:24 140485189175168 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
        2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Compressed tables use zlib 1.2.3
        2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Using Linux native AIO
        2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Using SSE crc32 instructions
        2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Initializing buffer pool, size = 128.0M
        2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Completed initialization of buffer pool
        2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Highest supported file format is Barracuda.
        2017-03-08 20:36:24 140485189175168 [Note] InnoDB: 128 rollback segment(s) are active.
        2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Waiting for purge to start
        2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.34-79.1 started; log sequence number 1622948
        2017-03-08 20:36:25 140485189175168 [Note] Plugin 'FEEDBACK' is disabled.
        2017-03-08 20:36:25 140484651484928 [Note] InnoDB: Dumping buffer pool(s) not yet started
        2017-03-08 20:36:25 140485189175168 [Note] Server socket created on IP: '::'.
        2017-03-08 20:36:25 140485189175168 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: ready for connections.
        Version: '10.1.20-MariaDB' socket: '/tmp/mysql.sock' port: 3306 MariaDB Server


        Checking PID



        [joseluisbz@Vxbox-Lnx ~]$ ps -aux | grep mariadb
        mysql 1652 0.0 0.1 113264 1656 ? Ss 11:42 0:00 /bin/sh /usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data
        mysql 2458 0.2 5.6 591028 87172 ? Sl 11:42 0:00 /usr/local/ServerWeb/mariadb/bin/mysqld --basedir=/usr/local/ServerWeb/mariadb --datadir=/usr/local/ServerWeb/mariadb/data --plugin-dir=/usr/local/ServerWeb/mariadb/lib/plugin --log-error=/usr/local/ServerWeb/mariadb/data/server.err --pid-file=Vxbox-Lnx.pid --socket=/tmp/mysql.sock --port=3306
        joselui+ 4489 0.0 0.0 112652 964 pts/0 R+ 11:44 0:00 grep --color=auto mariadb
        [joseluisbz@Vxbox-Lnx ~]$


        Effectively mariadb is running!!!



        I checked the Status



        $ sudo systemctl status mariadb.service
        [sudo] password for joseluisbz:
        ● mariadb.service - start and stop MySQL(MariaDB) Server
        Loaded: loaded (/etc/systemd/system/mariadb.service; enabled; vendor preset: disabled)
        Active: active (running) since Fri 2017-03-10 11:42:07 COT; 17min ago
        Main PID: 1652 (mysqld_safe)
        CGroup: /system.slice/mariadb.service
        ├─1652 /bin/sh /usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data...
        └─2458 /usr/local/ServerWeb/mariadb/bin/mysqld --basedir=/usr/local/ServerWeb/mariadb --datadir=/usr/local/ServerWeb/mariadb/data --plugin-dir=/usr/local/Ser...

        Mar 10 11:42:07 Vxbox-Lnx systemd[1]: Started start and stop MySQL(MariaDB) Server.
        Mar 10 11:42:07 Vxbox-Lnx systemd[1]: Starting start and stop MySQL(MariaDB) Server...
        Mar 10 11:42:09 Vxbox-Lnx mysqld_safe[1652]: 170310 11:42:09 mysqld_safe Logging to '/usr/local/ServerWeb/mariadb/data/server.err'.
        [joseluisbz@Vxbox-Lnx ~]$


        But I can't connect!!



        $ sudo mysql -u root -p
        [sudo] password for joseluisbz:
        Enter password:
        ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
        [joseluisbz@Vxbox-Lnx ~]$


        I check the existence of the mysql.sock file (but, there is not)...



        # ls -al /tmp/
        total 24
        drwxrwxrwt. 22 root root 4096 Mar 10 12:28 .
        dr-xr-xr-x. 19 root root 4096 Feb 18 21:21 ..
        drwx------ 2 joseluisbz joseluisbz 52 Mar 10 11:42 akonadi-joseluisbz.Fim4n9
        drwx------ 2 joseluisbz joseluisbz 50 Mar 10 09:20 .com.google.Chrome.I956Ja
        drwx------ 2 joseluisbz joseluisbz 50 Mar 10 07:38 .com.google.Chrome.ibPaUS
        drwx------ 2 joseluisbz joseluisbz 50 Mar 9 07:31 .com.google.Chrome.oIW6st
        drwx------ 2 joseluisbz joseluisbz 50 Mar 8 19:22 .com.google.Chrome.pGYMUt
        drwx------. 2 joseluisbz joseluisbz 19 Mar 10 11:42 .esd-1000
        drwxrwxrwt. 2 root root 6 Oct 10 20:09 .font-unix
        prw------- 1 root root 0 Mar 10 11:42 hogsuspend
        drwxrwxrwt. 2 root root 4096 Mar 10 11:42 .ICE-unix
        drwx------. 2 joseluisbz joseluisbz 50 Mar 10 12:25 kde-joseluisbz
        drwx------ 2 root root 23 Mar 10 11:44 kde-root
        drwx------ 2 root root 4096 Mar 10 11:44 ksocket-root
        drwx------ 2 joseluisbz joseluisbz 23 Mar 10 11:42 ssh-aOJwbK0vltXX
        drwx------ 3 root root 16 Mar 10 11:42 systemd-private-65b25dd58edd4711ad864dc007925904-colord.service-EVVMql
        drwx------ 3 root root 16 Mar 10 11:42 systemd-private-65b25dd58edd4711ad864dc007925904-cups.service-jOD1sm
        drwx------ 3 root root 16 Mar 10 11:42 systemd-private-65b25dd58edd4711ad864dc007925904-mariadb.service-eioofZ
        drwx------ 3 root root 16 Mar 9 15:11 systemd-private-65b25dd58edd4711ad864dc007925904-rtkit-daemon.service-E5cH4Y
        drwxrwxrwt. 2 root root 6 Oct 10 20:09 .Test-unix
        drwx------. 2 joseluisbz joseluisbz 6 Oct 10 20:42 tracker-extract-files.1000
        -r--r--r-- 1 root root 11 Mar 10 11:42 .X0-lock
        drwxrwxrwt. 2 root root 24 Mar 10 11:42 .X11-unix
        -rw------- 1 root root 54 Mar 10 08:35 xauth.XXXXTFUQeQ
        drwxrwxrwt. 2 root root 6 Oct 10 20:09 .XIM-unix
        [root@Vxbox-Lnx joseluisbz]#


        Then I changed the config file /etc/my.cnf changing the socket location, and sure the ownership (to respective user:group) folder of its location...



        [client]
        ...
        socket = /usr/local/ServerWeb/mariadb/tmp/mysql.sock
        ...

        [mysqld]
        ...
        socket = /usr/local/ServerWeb/mariadb/tmp/mysql.sock
        ...


        And created the folder tmp for socket and ensuring the ownership again!



        sudo mkdir -pv /usr/local/ServerWeb/mariadb/tmp
        sudo chown -R Umariadb:Gmariadb /usr/local/ServerWeb/mariadb/


        LATER of this changes and rebooting CentOS 7



        Verifing log file /usr/local/ServerWeb/mariadb/data/server.err..



        170311 17:31:50 mysqld_safe Starting mysqld daemon with databases from /usr/local/ServerWeb/mariadb/data
        2017-03-11 17:31:50 139805859948416 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld (mysqld 10.1.20-MariaDB) starting as process 2187 ...
        2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Using mutexes to ref count buffer pool pages
        2017-03-11 17:31:51 139805859948416 [Note] InnoDB: The InnoDB memory heap is disabled
        2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
        2017-03-11 17:31:51 139805859948416 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
        2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Compressed tables use zlib 1.2.3
        2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Using Linux native AIO
        2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Using SSE crc32 instructions
        2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Initializing buffer pool, size = 128.0M
        2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Completed initialization of buffer pool
        2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Highest supported file format is Barracuda.
        2017-03-11 17:31:51 139805859948416 [Note] InnoDB: 128 rollback segment(s) are active.
        2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Waiting for purge to start
        2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.34-79.1 started; log sequence number 1623144
        2017-03-11 17:31:51 139805379786496 [Note] InnoDB: Dumping buffer pool(s) not yet started
        2017-03-11 17:31:51 139805859948416 [Note] Plugin 'FEEDBACK' is disabled.
        2017-03-11 17:31:51 139805859948416 [Note] Server socket created on IP: '::'.
        2017-03-11 17:31:52 139805859948416 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: ready for connections.
        Version: '10.1.20-MariaDB' socket: '/usr/local/ServerWeb/mariadb/tmp/mysql.sock' port: 3306 MariaDB Server


        Starting the client...



        [joseluisbz@Vxbox-Lnx ~]$ mysql -u root -p
        Enter password:
        Welcome to the MariaDB monitor. Commands end with ; or g.
        Your MariaDB connection id is 2
        Server version: 10.1.20-MariaDB MariaDB Server

        Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

        Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

        MariaDB [(none)]>


        Works perfectly...



        Resume of solution



        • The order of changed Ownership to Umariadb:Gmariadb Only after of Installation.

        • Changing location of Socket where user:group can to write...

        NOTE: The original file /etc/systemd/system/mariadb.service has not problem!






        share|improve this answer



























          0












          0








          0







          My Installation process was (before to ask)



          sudo tar zxvf /media/sf_Users/josebernal/Downloads/Php Tomcat Httpd MySQL/mariadb-10.1.20-linux-x86_64.tar.gz -C /usr/local/
          sudo ln -s /usr/local/mariadb-10.1.20-linux-x86_64 /usr/local/ServerWeb/mariadb

          sudo groupadd -r Gmariadb
          sudo useradd -g Gmariadb -c "MariaDB User" -s /sbin/nologin -r Umariadb

          sudo chown -R Umariadb:Gmariadb /usr/local/ServerWeb/mariadb/
          sudo cp /usr/local/ServerWeb/mariadb/support-files/my-small.cnf /etc/my.cnf
          ... EDIT the config mariadb (mysql) file named my.cnf

          sudo /usr/local/ServerWeb/mariadb/scripts/mysql_install_db --user=mysql --basedir=/usr/local/ServerWeb/mariadb --datadir=/usr/local/ServerWeb/mariadb/data --log-error=/usr/local/ServerWeb/mariadb/data/server.err &
          ....
          ... The next steps..


          Even before I reported (asked) the problem I checked Ownership ...



          [joseluisbz@Vxbox-Lnx ~]$ ls -al /usr/local/ServerWeb/mariadb/
          total 224
          drwxrwxr-x 13 Umariadb Gmariadb 4096 Dec 14 23:27 .
          drwxr-xr-x. 18 root root 4096 Jan 5 12:00 ..
          drwxrwxr-x 2 Umariadb Gmariadb 4096 Nov 18 15:03 bin
          -rw-r--r-- 1 Umariadb Gmariadb 17987 Dec 14 14:25 COPYING
          -rw-r--r-- 1 Umariadb Gmariadb 26545 Dec 14 14:25 COPYING.LESSER
          -rw-r--r-- 1 Umariadb Gmariadb 86259 Dec 14 14:25 COPYING.thirdparty
          -rw-r--r-- 1 Umariadb Gmariadb 2122 Dec 14 14:25 CREDITS
          drwxrwxr-x 4 mysql Gmariadb 4096 Mar 8 20:25 data
          drwxrwxr-x 2 Umariadb Gmariadb 30 Dec 14 23:26 DESTINATION
          -rw-r--r-- 1 Umariadb Gmariadb 8245 Dec 14 14:25 EXCEPTIONS-CLIENT
          drwxrwxr-x 3 Umariadb Gmariadb 18 Dec 14 23:26 include
          -rw-r--r-- 1 Umariadb Gmariadb 8694 Dec 14 14:25 INSTALL-BINARY
          drwxrwxr-x 4 Umariadb Gmariadb 4096 Nov 18 15:03 lib
          drwxrwxr-x 4 Umariadb Gmariadb 28 Dec 14 23:27 man
          drwxrwxr-x 11 Umariadb Gmariadb 4096 Dec 14 23:26 mysql-test
          -rw-r--r-- 1 Umariadb Gmariadb 2105 Dec 14 14:25 README
          -rw-r--r-- 1 Umariadb Gmariadb 19510 Dec 14 14:25 README-wsrep
          drwxrwxr-x 2 Umariadb Gmariadb 29 Dec 14 23:27 scripts
          drwxrwxr-x 29 Umariadb Gmariadb 4096 Dec 14 23:26 share
          drwxrwxr-x 4 Umariadb Gmariadb 4096 Dec 14 23:27 sql-bench
          drwxrwxr-x 3 Umariadb Gmariadb 4096 Jan 4 22:32 support-files


          I noted on the data folder, the ownership is belong to (mysql:mysql) after of installation, but I thought it was that service script problem (mariadb.service)...



          [joseluisbz@Vxbox-Lnx ~]$ ls -al /usr/local/ServerWeb/mariadb/data/
          total 110624
          drwxrwxr-x 4 mysql Gmariadb 4096 Mar 8 20:25 .
          drwxrwxr-x 13 Umariadb Gmariadb 4096 Dec 14 23:27 ..
          -rw-rw---- 1 mysql mysql 16384 Mar 8 19:59 aria_log.00000001
          -rw-rw---- 1 mysql mysql 52 Mar 8 19:59 aria_log_control
          -rw-rw---- 1 mysql mysql 12582912 Mar 8 19:59 ibdata1
          -rw-rw---- 1 mysql mysql 50331648 Mar 8 19:59 ib_logfile0
          -rw-rw---- 1 mysql mysql 50331648 Jan 4 22:01 ib_logfile1
          -rw-rw---- 1 mysql mysql 0 Jan 4 22:05 multi-master.info
          drwx------ 2 mysql root 4096 Jan 4 22:01 mysql
          drwx------ 2 mysql mysql 19 Jan 4 22:01 performance_schema
          -rw-rw---- 1 mysql mysql 0 Mar 8 20:04 server.err
          [joseluisbz@Vxbox-Lnx ~]$


          @Kalavan confirmed my suspicion of ownership, then I needed to change the ownership after installation process ...



          sudo chown -R Umariadb:Gmariadb /usr/local/ServerWeb/mariadb/


          I reboot my CentOS 7, and the service was WORKING!!!



          I Checked the log file /usr/local/ServerWeb/mariadb/data/server.err..



          170308 20:36:23 mysqld_safe Starting mysqld daemon with databases from /usr/local/ServerWeb/mariadb/data
          2017-03-08 20:36:23 140485189175168 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld (mysqld 10.1.20-MariaDB) starting as process 2360 ...
          2017-03-08 20:36:24 140485189175168 [Warning] One can only use the --user switch if running as root

          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Using mutexes to ref count buffer pool pages
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: The InnoDB memory heap is disabled
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Compressed tables use zlib 1.2.3
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Using Linux native AIO
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Using SSE crc32 instructions
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Initializing buffer pool, size = 128.0M
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Completed initialization of buffer pool
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Highest supported file format is Barracuda.
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: 128 rollback segment(s) are active.
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Waiting for purge to start
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.34-79.1 started; log sequence number 1622948
          2017-03-08 20:36:25 140485189175168 [Note] Plugin 'FEEDBACK' is disabled.
          2017-03-08 20:36:25 140484651484928 [Note] InnoDB: Dumping buffer pool(s) not yet started
          2017-03-08 20:36:25 140485189175168 [Note] Server socket created on IP: '::'.
          2017-03-08 20:36:25 140485189175168 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: ready for connections.
          Version: '10.1.20-MariaDB' socket: '/tmp/mysql.sock' port: 3306 MariaDB Server


          Checking PID



          [joseluisbz@Vxbox-Lnx ~]$ ps -aux | grep mariadb
          mysql 1652 0.0 0.1 113264 1656 ? Ss 11:42 0:00 /bin/sh /usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data
          mysql 2458 0.2 5.6 591028 87172 ? Sl 11:42 0:00 /usr/local/ServerWeb/mariadb/bin/mysqld --basedir=/usr/local/ServerWeb/mariadb --datadir=/usr/local/ServerWeb/mariadb/data --plugin-dir=/usr/local/ServerWeb/mariadb/lib/plugin --log-error=/usr/local/ServerWeb/mariadb/data/server.err --pid-file=Vxbox-Lnx.pid --socket=/tmp/mysql.sock --port=3306
          joselui+ 4489 0.0 0.0 112652 964 pts/0 R+ 11:44 0:00 grep --color=auto mariadb
          [joseluisbz@Vxbox-Lnx ~]$


          Effectively mariadb is running!!!



          I checked the Status



          $ sudo systemctl status mariadb.service
          [sudo] password for joseluisbz:
          ● mariadb.service - start and stop MySQL(MariaDB) Server
          Loaded: loaded (/etc/systemd/system/mariadb.service; enabled; vendor preset: disabled)
          Active: active (running) since Fri 2017-03-10 11:42:07 COT; 17min ago
          Main PID: 1652 (mysqld_safe)
          CGroup: /system.slice/mariadb.service
          ├─1652 /bin/sh /usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data...
          └─2458 /usr/local/ServerWeb/mariadb/bin/mysqld --basedir=/usr/local/ServerWeb/mariadb --datadir=/usr/local/ServerWeb/mariadb/data --plugin-dir=/usr/local/Ser...

          Mar 10 11:42:07 Vxbox-Lnx systemd[1]: Started start and stop MySQL(MariaDB) Server.
          Mar 10 11:42:07 Vxbox-Lnx systemd[1]: Starting start and stop MySQL(MariaDB) Server...
          Mar 10 11:42:09 Vxbox-Lnx mysqld_safe[1652]: 170310 11:42:09 mysqld_safe Logging to '/usr/local/ServerWeb/mariadb/data/server.err'.
          [joseluisbz@Vxbox-Lnx ~]$


          But I can't connect!!



          $ sudo mysql -u root -p
          [sudo] password for joseluisbz:
          Enter password:
          ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
          [joseluisbz@Vxbox-Lnx ~]$


          I check the existence of the mysql.sock file (but, there is not)...



          # ls -al /tmp/
          total 24
          drwxrwxrwt. 22 root root 4096 Mar 10 12:28 .
          dr-xr-xr-x. 19 root root 4096 Feb 18 21:21 ..
          drwx------ 2 joseluisbz joseluisbz 52 Mar 10 11:42 akonadi-joseluisbz.Fim4n9
          drwx------ 2 joseluisbz joseluisbz 50 Mar 10 09:20 .com.google.Chrome.I956Ja
          drwx------ 2 joseluisbz joseluisbz 50 Mar 10 07:38 .com.google.Chrome.ibPaUS
          drwx------ 2 joseluisbz joseluisbz 50 Mar 9 07:31 .com.google.Chrome.oIW6st
          drwx------ 2 joseluisbz joseluisbz 50 Mar 8 19:22 .com.google.Chrome.pGYMUt
          drwx------. 2 joseluisbz joseluisbz 19 Mar 10 11:42 .esd-1000
          drwxrwxrwt. 2 root root 6 Oct 10 20:09 .font-unix
          prw------- 1 root root 0 Mar 10 11:42 hogsuspend
          drwxrwxrwt. 2 root root 4096 Mar 10 11:42 .ICE-unix
          drwx------. 2 joseluisbz joseluisbz 50 Mar 10 12:25 kde-joseluisbz
          drwx------ 2 root root 23 Mar 10 11:44 kde-root
          drwx------ 2 root root 4096 Mar 10 11:44 ksocket-root
          drwx------ 2 joseluisbz joseluisbz 23 Mar 10 11:42 ssh-aOJwbK0vltXX
          drwx------ 3 root root 16 Mar 10 11:42 systemd-private-65b25dd58edd4711ad864dc007925904-colord.service-EVVMql
          drwx------ 3 root root 16 Mar 10 11:42 systemd-private-65b25dd58edd4711ad864dc007925904-cups.service-jOD1sm
          drwx------ 3 root root 16 Mar 10 11:42 systemd-private-65b25dd58edd4711ad864dc007925904-mariadb.service-eioofZ
          drwx------ 3 root root 16 Mar 9 15:11 systemd-private-65b25dd58edd4711ad864dc007925904-rtkit-daemon.service-E5cH4Y
          drwxrwxrwt. 2 root root 6 Oct 10 20:09 .Test-unix
          drwx------. 2 joseluisbz joseluisbz 6 Oct 10 20:42 tracker-extract-files.1000
          -r--r--r-- 1 root root 11 Mar 10 11:42 .X0-lock
          drwxrwxrwt. 2 root root 24 Mar 10 11:42 .X11-unix
          -rw------- 1 root root 54 Mar 10 08:35 xauth.XXXXTFUQeQ
          drwxrwxrwt. 2 root root 6 Oct 10 20:09 .XIM-unix
          [root@Vxbox-Lnx joseluisbz]#


          Then I changed the config file /etc/my.cnf changing the socket location, and sure the ownership (to respective user:group) folder of its location...



          [client]
          ...
          socket = /usr/local/ServerWeb/mariadb/tmp/mysql.sock
          ...

          [mysqld]
          ...
          socket = /usr/local/ServerWeb/mariadb/tmp/mysql.sock
          ...


          And created the folder tmp for socket and ensuring the ownership again!



          sudo mkdir -pv /usr/local/ServerWeb/mariadb/tmp
          sudo chown -R Umariadb:Gmariadb /usr/local/ServerWeb/mariadb/


          LATER of this changes and rebooting CentOS 7



          Verifing log file /usr/local/ServerWeb/mariadb/data/server.err..



          170311 17:31:50 mysqld_safe Starting mysqld daemon with databases from /usr/local/ServerWeb/mariadb/data
          2017-03-11 17:31:50 139805859948416 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld (mysqld 10.1.20-MariaDB) starting as process 2187 ...
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Using mutexes to ref count buffer pool pages
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: The InnoDB memory heap is disabled
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Compressed tables use zlib 1.2.3
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Using Linux native AIO
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Using SSE crc32 instructions
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Initializing buffer pool, size = 128.0M
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Completed initialization of buffer pool
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Highest supported file format is Barracuda.
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: 128 rollback segment(s) are active.
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Waiting for purge to start
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.34-79.1 started; log sequence number 1623144
          2017-03-11 17:31:51 139805379786496 [Note] InnoDB: Dumping buffer pool(s) not yet started
          2017-03-11 17:31:51 139805859948416 [Note] Plugin 'FEEDBACK' is disabled.
          2017-03-11 17:31:51 139805859948416 [Note] Server socket created on IP: '::'.
          2017-03-11 17:31:52 139805859948416 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: ready for connections.
          Version: '10.1.20-MariaDB' socket: '/usr/local/ServerWeb/mariadb/tmp/mysql.sock' port: 3306 MariaDB Server


          Starting the client...



          [joseluisbz@Vxbox-Lnx ~]$ mysql -u root -p
          Enter password:
          Welcome to the MariaDB monitor. Commands end with ; or g.
          Your MariaDB connection id is 2
          Server version: 10.1.20-MariaDB MariaDB Server

          Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

          MariaDB [(none)]>


          Works perfectly...



          Resume of solution



          • The order of changed Ownership to Umariadb:Gmariadb Only after of Installation.

          • Changing location of Socket where user:group can to write...

          NOTE: The original file /etc/systemd/system/mariadb.service has not problem!






          share|improve this answer















          My Installation process was (before to ask)



          sudo tar zxvf /media/sf_Users/josebernal/Downloads/Php Tomcat Httpd MySQL/mariadb-10.1.20-linux-x86_64.tar.gz -C /usr/local/
          sudo ln -s /usr/local/mariadb-10.1.20-linux-x86_64 /usr/local/ServerWeb/mariadb

          sudo groupadd -r Gmariadb
          sudo useradd -g Gmariadb -c "MariaDB User" -s /sbin/nologin -r Umariadb

          sudo chown -R Umariadb:Gmariadb /usr/local/ServerWeb/mariadb/
          sudo cp /usr/local/ServerWeb/mariadb/support-files/my-small.cnf /etc/my.cnf
          ... EDIT the config mariadb (mysql) file named my.cnf

          sudo /usr/local/ServerWeb/mariadb/scripts/mysql_install_db --user=mysql --basedir=/usr/local/ServerWeb/mariadb --datadir=/usr/local/ServerWeb/mariadb/data --log-error=/usr/local/ServerWeb/mariadb/data/server.err &
          ....
          ... The next steps..


          Even before I reported (asked) the problem I checked Ownership ...



          [joseluisbz@Vxbox-Lnx ~]$ ls -al /usr/local/ServerWeb/mariadb/
          total 224
          drwxrwxr-x 13 Umariadb Gmariadb 4096 Dec 14 23:27 .
          drwxr-xr-x. 18 root root 4096 Jan 5 12:00 ..
          drwxrwxr-x 2 Umariadb Gmariadb 4096 Nov 18 15:03 bin
          -rw-r--r-- 1 Umariadb Gmariadb 17987 Dec 14 14:25 COPYING
          -rw-r--r-- 1 Umariadb Gmariadb 26545 Dec 14 14:25 COPYING.LESSER
          -rw-r--r-- 1 Umariadb Gmariadb 86259 Dec 14 14:25 COPYING.thirdparty
          -rw-r--r-- 1 Umariadb Gmariadb 2122 Dec 14 14:25 CREDITS
          drwxrwxr-x 4 mysql Gmariadb 4096 Mar 8 20:25 data
          drwxrwxr-x 2 Umariadb Gmariadb 30 Dec 14 23:26 DESTINATION
          -rw-r--r-- 1 Umariadb Gmariadb 8245 Dec 14 14:25 EXCEPTIONS-CLIENT
          drwxrwxr-x 3 Umariadb Gmariadb 18 Dec 14 23:26 include
          -rw-r--r-- 1 Umariadb Gmariadb 8694 Dec 14 14:25 INSTALL-BINARY
          drwxrwxr-x 4 Umariadb Gmariadb 4096 Nov 18 15:03 lib
          drwxrwxr-x 4 Umariadb Gmariadb 28 Dec 14 23:27 man
          drwxrwxr-x 11 Umariadb Gmariadb 4096 Dec 14 23:26 mysql-test
          -rw-r--r-- 1 Umariadb Gmariadb 2105 Dec 14 14:25 README
          -rw-r--r-- 1 Umariadb Gmariadb 19510 Dec 14 14:25 README-wsrep
          drwxrwxr-x 2 Umariadb Gmariadb 29 Dec 14 23:27 scripts
          drwxrwxr-x 29 Umariadb Gmariadb 4096 Dec 14 23:26 share
          drwxrwxr-x 4 Umariadb Gmariadb 4096 Dec 14 23:27 sql-bench
          drwxrwxr-x 3 Umariadb Gmariadb 4096 Jan 4 22:32 support-files


          I noted on the data folder, the ownership is belong to (mysql:mysql) after of installation, but I thought it was that service script problem (mariadb.service)...



          [joseluisbz@Vxbox-Lnx ~]$ ls -al /usr/local/ServerWeb/mariadb/data/
          total 110624
          drwxrwxr-x 4 mysql Gmariadb 4096 Mar 8 20:25 .
          drwxrwxr-x 13 Umariadb Gmariadb 4096 Dec 14 23:27 ..
          -rw-rw---- 1 mysql mysql 16384 Mar 8 19:59 aria_log.00000001
          -rw-rw---- 1 mysql mysql 52 Mar 8 19:59 aria_log_control
          -rw-rw---- 1 mysql mysql 12582912 Mar 8 19:59 ibdata1
          -rw-rw---- 1 mysql mysql 50331648 Mar 8 19:59 ib_logfile0
          -rw-rw---- 1 mysql mysql 50331648 Jan 4 22:01 ib_logfile1
          -rw-rw---- 1 mysql mysql 0 Jan 4 22:05 multi-master.info
          drwx------ 2 mysql root 4096 Jan 4 22:01 mysql
          drwx------ 2 mysql mysql 19 Jan 4 22:01 performance_schema
          -rw-rw---- 1 mysql mysql 0 Mar 8 20:04 server.err
          [joseluisbz@Vxbox-Lnx ~]$


          @Kalavan confirmed my suspicion of ownership, then I needed to change the ownership after installation process ...



          sudo chown -R Umariadb:Gmariadb /usr/local/ServerWeb/mariadb/


          I reboot my CentOS 7, and the service was WORKING!!!



          I Checked the log file /usr/local/ServerWeb/mariadb/data/server.err..



          170308 20:36:23 mysqld_safe Starting mysqld daemon with databases from /usr/local/ServerWeb/mariadb/data
          2017-03-08 20:36:23 140485189175168 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld (mysqld 10.1.20-MariaDB) starting as process 2360 ...
          2017-03-08 20:36:24 140485189175168 [Warning] One can only use the --user switch if running as root

          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Using mutexes to ref count buffer pool pages
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: The InnoDB memory heap is disabled
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Compressed tables use zlib 1.2.3
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Using Linux native AIO
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Using SSE crc32 instructions
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Initializing buffer pool, size = 128.0M
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Completed initialization of buffer pool
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Highest supported file format is Barracuda.
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: 128 rollback segment(s) are active.
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Waiting for purge to start
          2017-03-08 20:36:24 140485189175168 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.34-79.1 started; log sequence number 1622948
          2017-03-08 20:36:25 140485189175168 [Note] Plugin 'FEEDBACK' is disabled.
          2017-03-08 20:36:25 140484651484928 [Note] InnoDB: Dumping buffer pool(s) not yet started
          2017-03-08 20:36:25 140485189175168 [Note] Server socket created on IP: '::'.
          2017-03-08 20:36:25 140485189175168 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: ready for connections.
          Version: '10.1.20-MariaDB' socket: '/tmp/mysql.sock' port: 3306 MariaDB Server


          Checking PID



          [joseluisbz@Vxbox-Lnx ~]$ ps -aux | grep mariadb
          mysql 1652 0.0 0.1 113264 1656 ? Ss 11:42 0:00 /bin/sh /usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data
          mysql 2458 0.2 5.6 591028 87172 ? Sl 11:42 0:00 /usr/local/ServerWeb/mariadb/bin/mysqld --basedir=/usr/local/ServerWeb/mariadb --datadir=/usr/local/ServerWeb/mariadb/data --plugin-dir=/usr/local/ServerWeb/mariadb/lib/plugin --log-error=/usr/local/ServerWeb/mariadb/data/server.err --pid-file=Vxbox-Lnx.pid --socket=/tmp/mysql.sock --port=3306
          joselui+ 4489 0.0 0.0 112652 964 pts/0 R+ 11:44 0:00 grep --color=auto mariadb
          [joseluisbz@Vxbox-Lnx ~]$


          Effectively mariadb is running!!!



          I checked the Status



          $ sudo systemctl status mariadb.service
          [sudo] password for joseluisbz:
          ● mariadb.service - start and stop MySQL(MariaDB) Server
          Loaded: loaded (/etc/systemd/system/mariadb.service; enabled; vendor preset: disabled)
          Active: active (running) since Fri 2017-03-10 11:42:07 COT; 17min ago
          Main PID: 1652 (mysqld_safe)
          CGroup: /system.slice/mariadb.service
          ├─1652 /bin/sh /usr/local/ServerWeb/mariadb/bin/mysqld_safe --user=mysql --ledir=/usr/local/ServerWeb/mariadb/bin --datadir=/usr/local/ServerWeb/mariadb/data...
          └─2458 /usr/local/ServerWeb/mariadb/bin/mysqld --basedir=/usr/local/ServerWeb/mariadb --datadir=/usr/local/ServerWeb/mariadb/data --plugin-dir=/usr/local/Ser...

          Mar 10 11:42:07 Vxbox-Lnx systemd[1]: Started start and stop MySQL(MariaDB) Server.
          Mar 10 11:42:07 Vxbox-Lnx systemd[1]: Starting start and stop MySQL(MariaDB) Server...
          Mar 10 11:42:09 Vxbox-Lnx mysqld_safe[1652]: 170310 11:42:09 mysqld_safe Logging to '/usr/local/ServerWeb/mariadb/data/server.err'.
          [joseluisbz@Vxbox-Lnx ~]$


          But I can't connect!!



          $ sudo mysql -u root -p
          [sudo] password for joseluisbz:
          Enter password:
          ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
          [joseluisbz@Vxbox-Lnx ~]$


          I check the existence of the mysql.sock file (but, there is not)...



          # ls -al /tmp/
          total 24
          drwxrwxrwt. 22 root root 4096 Mar 10 12:28 .
          dr-xr-xr-x. 19 root root 4096 Feb 18 21:21 ..
          drwx------ 2 joseluisbz joseluisbz 52 Mar 10 11:42 akonadi-joseluisbz.Fim4n9
          drwx------ 2 joseluisbz joseluisbz 50 Mar 10 09:20 .com.google.Chrome.I956Ja
          drwx------ 2 joseluisbz joseluisbz 50 Mar 10 07:38 .com.google.Chrome.ibPaUS
          drwx------ 2 joseluisbz joseluisbz 50 Mar 9 07:31 .com.google.Chrome.oIW6st
          drwx------ 2 joseluisbz joseluisbz 50 Mar 8 19:22 .com.google.Chrome.pGYMUt
          drwx------. 2 joseluisbz joseluisbz 19 Mar 10 11:42 .esd-1000
          drwxrwxrwt. 2 root root 6 Oct 10 20:09 .font-unix
          prw------- 1 root root 0 Mar 10 11:42 hogsuspend
          drwxrwxrwt. 2 root root 4096 Mar 10 11:42 .ICE-unix
          drwx------. 2 joseluisbz joseluisbz 50 Mar 10 12:25 kde-joseluisbz
          drwx------ 2 root root 23 Mar 10 11:44 kde-root
          drwx------ 2 root root 4096 Mar 10 11:44 ksocket-root
          drwx------ 2 joseluisbz joseluisbz 23 Mar 10 11:42 ssh-aOJwbK0vltXX
          drwx------ 3 root root 16 Mar 10 11:42 systemd-private-65b25dd58edd4711ad864dc007925904-colord.service-EVVMql
          drwx------ 3 root root 16 Mar 10 11:42 systemd-private-65b25dd58edd4711ad864dc007925904-cups.service-jOD1sm
          drwx------ 3 root root 16 Mar 10 11:42 systemd-private-65b25dd58edd4711ad864dc007925904-mariadb.service-eioofZ
          drwx------ 3 root root 16 Mar 9 15:11 systemd-private-65b25dd58edd4711ad864dc007925904-rtkit-daemon.service-E5cH4Y
          drwxrwxrwt. 2 root root 6 Oct 10 20:09 .Test-unix
          drwx------. 2 joseluisbz joseluisbz 6 Oct 10 20:42 tracker-extract-files.1000
          -r--r--r-- 1 root root 11 Mar 10 11:42 .X0-lock
          drwxrwxrwt. 2 root root 24 Mar 10 11:42 .X11-unix
          -rw------- 1 root root 54 Mar 10 08:35 xauth.XXXXTFUQeQ
          drwxrwxrwt. 2 root root 6 Oct 10 20:09 .XIM-unix
          [root@Vxbox-Lnx joseluisbz]#


          Then I changed the config file /etc/my.cnf changing the socket location, and sure the ownership (to respective user:group) folder of its location...



          [client]
          ...
          socket = /usr/local/ServerWeb/mariadb/tmp/mysql.sock
          ...

          [mysqld]
          ...
          socket = /usr/local/ServerWeb/mariadb/tmp/mysql.sock
          ...


          And created the folder tmp for socket and ensuring the ownership again!



          sudo mkdir -pv /usr/local/ServerWeb/mariadb/tmp
          sudo chown -R Umariadb:Gmariadb /usr/local/ServerWeb/mariadb/


          LATER of this changes and rebooting CentOS 7



          Verifing log file /usr/local/ServerWeb/mariadb/data/server.err..



          170311 17:31:50 mysqld_safe Starting mysqld daemon with databases from /usr/local/ServerWeb/mariadb/data
          2017-03-11 17:31:50 139805859948416 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld (mysqld 10.1.20-MariaDB) starting as process 2187 ...
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Using mutexes to ref count buffer pool pages
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: The InnoDB memory heap is disabled
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Compressed tables use zlib 1.2.3
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Using Linux native AIO
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Using SSE crc32 instructions
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Initializing buffer pool, size = 128.0M
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Completed initialization of buffer pool
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Highest supported file format is Barracuda.
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: 128 rollback segment(s) are active.
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Waiting for purge to start
          2017-03-11 17:31:51 139805859948416 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.34-79.1 started; log sequence number 1623144
          2017-03-11 17:31:51 139805379786496 [Note] InnoDB: Dumping buffer pool(s) not yet started
          2017-03-11 17:31:51 139805859948416 [Note] Plugin 'FEEDBACK' is disabled.
          2017-03-11 17:31:51 139805859948416 [Note] Server socket created on IP: '::'.
          2017-03-11 17:31:52 139805859948416 [Note] /usr/local/ServerWeb/mariadb/bin/mysqld: ready for connections.
          Version: '10.1.20-MariaDB' socket: '/usr/local/ServerWeb/mariadb/tmp/mysql.sock' port: 3306 MariaDB Server


          Starting the client...



          [joseluisbz@Vxbox-Lnx ~]$ mysql -u root -p
          Enter password:
          Welcome to the MariaDB monitor. Commands end with ; or g.
          Your MariaDB connection id is 2
          Server version: 10.1.20-MariaDB MariaDB Server

          Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

          MariaDB [(none)]>


          Works perfectly...



          Resume of solution



          • The order of changed Ownership to Umariadb:Gmariadb Only after of Installation.

          • Changing location of Socket where user:group can to write...

          NOTE: The original file /etc/systemd/system/mariadb.service has not problem!







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 11 '17 at 23:06

























          answered Mar 11 '17 at 22:52









          chepe luchochepe lucho

          178114




          178114





















              -1














              This worked for me:



              mv /var/lib/mysql/* /opt/





              share|improve this answer





























                -1














                This worked for me:



                mv /var/lib/mysql/* /opt/





                share|improve this answer



























                  -1












                  -1








                  -1







                  This worked for me:



                  mv /var/lib/mysql/* /opt/





                  share|improve this answer















                  This worked for me:



                  mv /var/lib/mysql/* /opt/






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Feb 2 at 12:56









                  Jeff Schaller

                  42.1k1156133




                  42.1k1156133










                  answered Feb 2 at 11:19









                  TUSHARTUSHAR

                  1




                  1



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f350129%2fmariadb-service-is-not-starting-after-boot-centos-7%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown






                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Bahrain

                      Postfix configuration issue with fips on centos 7; mailgun relay