• MySQL and MariaDB


    Hej Everyone

    i run into a problem. I (tried to) install mysql, but everytime i try to start it i end up with the following:

    $ mysql -u root-p                 
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2 "No such file or directory")
    

    i went into the directory and there is no such file. I then tried to run a search :

    $ sudo find / -type s                
    

    and it seems that I’m missing the file its not in any directory as far as i can tell.

    i then tried to re-install mysql (version 5.5 ; 5.6 and 5.7) and mariaDBbut no difference as far as i can tell.

    hope anybody can help me 🙂

  • Hi,

    this is because of:

    Note: For security reasons, the systemd service file contains ProtectHome=true, which prevents MariaDB from accessing files under the /home, /root and /run/user hierarchies. The datadir has to be in an accessible location and owned by the mysql user and group. You can modify this behavior by creating a supplementary service file as described here: https://mariadb.com/kb/en/mariadb/systemd/

    So just do following:

    sudo pacman -S mariadb
    
    sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
    
    sudo systemctl enable mariadb.service
    
    sudo systemctl start mariadb.service
    

    and then

    mysql -u root -p
    

    will work

    🙂

    Linux ist das beste Betriebssystem (Albert Einstein)

  • @pseudonym

    Hi Thank you for your fast response, i tried the Commands you wrote and end up with:

    $ sudo systemctl start mariadb.service
    Job for mariadb.service failed because the control process exited with error code.
    See "systemctl status mariadb.service" and "journalctl -xe" for details.
    

    I tried:

    $ systemctl status mariadb.service  
    ● mariadb.service - MariaDB 10.1.30 database server
       Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
       Active: failed (Result: exit-code) since Tue 2018-01-30 14:53:44 CET; 2min 27s ago
         Docs: man:mysqld(8)
               https://mariadb.com/kb/en/library/systemd/
      Process: 1672 ExecStart=/usr/bin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSI
      Process: 1620 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/
      Process: 1619 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (co
     Main PID: 1672 (code=exited, status=1/FAILURE)
       Status: "MariaDB server is down"
    
    Jan 30 14:53:43 ThinkPad systemd[1]: Starting MariaDB 10.1.30 database server...
    Jan 30 14:53:44 ThinkPad mysqld[1672]: 2018-01-30 14:53:44 140624647430080 [Note] /usr/bin/my
    Jan 30 14:53:44 ThinkPad mysqld[1672]: 2018-01-30 14:53:44 140624647430080 [ERROR] mysqld: Fi
    Jan 30 14:53:44 ThinkPad mysqld[1672]: 2018-01-30 14:53:44 140624647430080 [ERROR] Aborting
    Jan 30 14:53:44 ThinkPad systemd[1]: mariadb.service: Main process exited, code=exited, statu
    Jan 30 14:53:44 ThinkPad systemd[1]: mariadb.service: Failed with result 'exit-code'.
    Jan 30 14:53:44 ThinkPad systemd[1]: Failed to start MariaDB 10.1.30 database server.
    

    Then i tried running:

    $ mysql -u root -p
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2 "No such file or directory")
    

    i dont get whats wrong 😞

  • Hi

    this one worked?

    sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
    

    Without it is not possible to start the service

    Linux ist das beste Betriebssystem (Albert Einstein)

  • oh no it didn’t, i got:

    Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...
    2018-01-30 15:03:55 140493537816512 [Note] /usr/bin/mysqld (mysqld 10.1.30-MariaDB) starting as process 2297 ...
    2018-01-30 15:03:55 140493537816512 [ERROR] mysqld: File './mysql-bin.index' not found (Errcode: 13 "Permission denied")
    2018-01-30 15:03:55 140493537816512 [ERROR] Aborting
    
    
    Installation of system tables failed!  Examine the logs in
    /var/lib/mysql for more information.
    
    The problem could be conflicting information in an external
    my.cnf files. You can ignore these by doing:
    
        shell> /usr/bin/mysql_install_db --defaults-file=~/.my.cnf
    
    You can also try to start the mysqld daemon with:
    
        shell> /usr/bin/mysqld --skip-grant --general-log &
    
    and use the command line tool /usr/bin/mysql
    to connect to the mysql database and look at the grant tables:
    
        shell> /usr/bin/mysql -u root mysql
        mysql> show tables;
    
    Try 'mysqld --help' if you have problems with paths.  Using
    --general-log gives you a log in /var/lib/mysql that may be helpful.
    
    The latest information about mysql_install_db is available at
    https://mariadb.com/kb/en/installing-system-tables-mysql_install_db
    MariaDB is hosted on launchpad; You can find the latest source and
    email lists at http://launchpad.net/maria
    
    Please check all of the above before submitting a bug report
    at http://mariadb.org/jira
    

    sorry totally overlooked that 😕

  • ok, lets try

    sudo systemctl stop mariadb.service
    
    sudo systemctl disable mariadb.service
    
    sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
    

    if it is woriking then you can start and enabled it.

    If its not working we should start all over.

    Linux ist das beste Betriebssystem (Albert Einstein)

  • I now tried

    $ /usr/bin/mysqld --skip-grant --general-log & [1] 2841
    
    2018-01-30 15:12:46 140400040034240 [Note] Using unique option prefix 'skip-grant' is error-prone and can break in the future. Please use the full name 'skip-grant-tables' instead.
    2018-01-30 15:12:46 140400040034240 [Note] /usr/bin/mysqld (mysqld 10.1.30-MariaDB) starting as process 2841 ...
    2018-01-30 15:12:46 140400040034240 [Warning] Can't create test file /var/lib/mysql/ThinkPad.lower-test
    /usr/bin/mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13 "Permission denied")
    2018-01-30 15:12:46 140400040034240 [ERROR] Aborting
    
    
    [1]  + 2841 exit 1     /usr/bin/mysqld --skip-grant --general-log
    
  • @pseudonym said in MySQL and MariaDB:

    [email protected]:~|⇒  sudo systemctl disable mariadb.service
    
    Removed /etc/systemd/system/multi-user.target.wants/mariadb.service.
    
    [email protected]:~|⇒  sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
    Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...
    2018-01-30 15:24:30 139675200880576 [Note] /usr/bin/mysqld (mysqld 10.1.30-MariaDB) starting as process 4112 ...
    2018-01-30 15:24:30 139675200880576 [ERROR] mysqld: File './mysql-bin.index' not found (Errcode: 13 "Permission denied")
    2018-01-30 15:24:30 139675200880576 [ERROR] Aborting
    
    
    Installation of system tables failed!  Examine the logs in
    /var/lib/mysql for more information.
    
    The problem could be conflicting information in an external
    my.cnf files. You can ignore these by doing:
    
        shell> /usr/bin/mysql_install_db --defaults-file=~/.my.cnf
    
    You can also try to start the mysqld daemon with:
    
        shell> /usr/bin/mysqld --skip-grant --general-log &
    
    and use the command line tool /usr/bin/mysql
    to connect to the mysql database and look at the grant tables:
    
        shell> /usr/bin/mysql -u root mysql
        mysql> show tables;
    
    Try 'mysqld --help' if you have problems with paths.  Using
    --general-log gives you a log in /var/lib/mysql that may be helpful.
    
    The latest information about mysql_install_db is available at
    https://mariadb.com/kb/en/installing-system-tables-mysql_install_db
    MariaDB is hosted on launchpad; You can find the latest source and
    email lists at http://launchpad.net/maria
    
    Please check all of the above before submitting a bug report
    at http://mariadb.org/jira
    

    so back to scratch 😞

  • you also stoped the service?

    If yes, lets start all over with:

    sudo systemctl stop mariadb.service
    
    sudo systemctl disable mariadb.service
    
    sudo pacman -Rsnc mariadb
    

    Search for mysql in usr and var and delete it.
    Then do it again in the following order as i wrote in my firts post.

    Linux ist das beste Betriebssystem (Albert Einstein)

  • Hi i Run the three commands, afterwards i removed all files related to mysql and Mariadb. I restarted my system and run the commands i the second post and got this

    [email protected]:~|⇒  mysql -u root -p                   
    zsh: command not found: mysql
    [email protected]:~|⇒  mysqld -u root -p
    2018-01-30 15:46:13 140248983281600 [Note] mysqld (mysqld 10.1.30-MariaDB) starting as process 6060 ...
    2018-01-30 15:46:13 140248983281600 [Warning] Can't create test file /var/lib/mysql/ThinkPad.lower-test
    mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13 "Permission denied")
    2018-01-30 15:46:13 140248983281600 [ERROR] Aborting
    
    
  • hm thats strange. Here it works out of the box. I also reinstalled it.

    The command is without “d”.

    sudo mysql -u root -p
    

    Would you post the output?

    sudo systemctl status mariadb.service
    

    Linux ist das beste Betriebssystem (Albert Einstein)

  • Hi sorry for my absents, I wanted to restart my system … but i won’t start anymore 😞 so I will reinstall Antergos and see if it’ll fix my problem… Anyhow thank you so much for your help!!

mariadb3 mysql2 Posts 12Views 390
Log in to reply
Bloom Email Optin Plugin

Looks like your connection to Antergos Community Forum was lost, please wait while we try to reconnect.