AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / ubuntu / Perguntas / 1292362
Accepted
Nicholas Saunders
Nicholas Saunders
Asked: 2020-11-15 10:56:54 +0800 CST2020-11-15 10:56:54 +0800 CST 2020-11-15 10:56:54 +0800 CST

Por que o MariaDB ou MySQL não inicia?

  • 772

Aparentemente , purgar e/ou reinstalar mysqle mariadbpode causar conflitos, então tentei:

root@mordor:~# 
root@mordor:~# sudo apt purge mariadb-server mariadb-client mysql-client mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'mysql-client' is not installed, so not removed
Package 'mysql-server' is not installed, so not removed
The following packages will be REMOVED:
  mariadb-client* mariadb-server*
0 upgraded, 0 newly installed, 2 to remove and 1 not upgraded.
After this operation, 20.5 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 181581 files and directories currently installed.)
Removing mariadb-client (1:10.4.17+maria~focal) ...
Removing mariadb-server (1:10.4.17+maria~focal) ...
root@mordor:~# 
root@mordor:~# 
root@mordor:~# rm -rf  /var/lib/mysql
root@mordor:~# 
root@mordor:~# sudo apt install mariadb-client mariadb-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  mariadb-client mariadb-server
0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/6252 B of archives.
After this operation, 20.5 kB of additional disk space will be used.
Selecting previously unselected package mariadb-client.
(Reading database ... 181576 files and directories currently installed.)
Preparing to unpack .../mariadb-client_1%3a10.4.17+maria~focal_all.deb ...
Unpacking mariadb-client (1:10.4.17+maria~focal) ...
Selecting previously unselected package mariadb-server.
Preparing to unpack .../mariadb-server_1%3a10.4.17+maria~focal_all.deb ...
Unpacking mariadb-server (1:10.4.17+maria~focal) ...
Setting up mariadb-client (1:10.4.17+maria~focal) ...
Setting up mariadb-server (1:10.4.17+maria~focal) ...
root@mordor:~# 
root@mordor:~# mariadb
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
root@mordor:~# 
root@mordor:~# systemctl status mariadb.service
● mariadb.service - MariaDB 10.4.17 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/mariadb.service.d
             └─migrated-from-my.cnf-settings.conf
     Active: failed (Result: exit-code) since Sat 2020-11-14 10:43:31 PST; 1h 23min ago
       Docs: man:mysqld(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 90075 (code=exited, status=1/FAILURE)
     Status: "MariaDB server is down"

Nov 14 10:43:29 mordor systemd[1]: Starting MariaDB 10.4.17 database server...
Nov 14 10:43:29 mordor mysqld[90075]: 2020-11-14 10:43:29 0 [Note] /usr/sbin/mysqld (mysqld 10.4.17-MariaDB-1:10.4.17+maria~focal-l>
Nov 14 10:43:29 mordor mysqld[90075]: 2020-11-14 10:43:29 0 [Warning] Could not increase number of max_open_files to more than 1638>
Nov 14 10:43:29 mordor mysqld[90075]: 2020-11-14 10:43:29 0 [Warning] Changed limits: max_open_files: 16384  max_connections: 500 (>
Nov 14 10:43:31 mordor systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Nov 14 10:43:31 mordor systemd[1]: mariadb.service: Failed with result 'exit-code'.
Nov 14 10:43:31 mordor systemd[1]: Failed to start MariaDB 10.4.17 database server.
root@mordor:~# 

Como eu começo mariadb? Eu posso limpá-lo novamente, mas isso é apenas um loop.

password apt database mariadb sockets
  • 2 2 respostas
  • 353 Views

2 respostas

  • Voted
  1. Best Answer
    Rinzwind
    2020-11-15T11:01:03+08:002020-11-15T11:01:03+08:00

    1º verifique se o mariadb está rodando. Você não pode se conectar a ele se não for.

    Você esqueceu de fazer

    sudo mysql_secure_installation
    

    para configurar um usuário e senha.

    Em relação a este comando, por favor, também ...

    • remover o usuário anônimo
    • remova o banco de dados de teste
    • não permitir login root remotamente

    Geralmente você pode fazer assim também:

    sudo -i
    {admin password}
    mariadb
    

    e, em seguida, configure um usuário e uma senha. Tente evitar usar nomes comuns como usuário (ou seja, não root, admin, seu nome de usuário etc.) e use um nome de usuário pessoal. Isso faz com que seja mais uma coisa que alguém precisa adivinhar.

    • 1
  2. Nicholas Saunders
    2020-11-15T12:17:32+08:002020-11-15T12:17:32+08:00

    pode pelo menos entrar no db:

    root@mordor:~# 
    root@mordor:~# sudo apt purge mariadb-server-core-10.4 mariadb-server-10.4 mariadb-client-core-10.4  mariadb-client-10.4 
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Package 'mariadb-client-10.4' is not installed, so not removed
    Package 'mariadb-client-core-10.4' is not installed, so not removed
    Package 'mariadb-server-10.4' is not installed, so not removed
    Package 'mariadb-server-core-10.4' is not installed, so not removed
    The following packages were automatically installed and are no longer required:
      galera-4 libdbd-mysql-perl libdbi-perl libterm-readkey-perl socat
    Use 'sudo apt autoremove' to remove them.
    0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
    root@mordor:~# 
    root@mordor:~# sudo apt purge mysql-server-core-8.0 mysql-server-8.0 mysql-client-core-8.0 mysql-client-8.0
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Package 'mysql-client-8.0' is not installed, so not removed
    Package 'mysql-client-core-8.0' is not installed, so not removed
    Package 'mysql-server-8.0' is not installed, so not removed
    Package 'mysql-server-core-8.0' is not installed, so not removed
    The following packages were automatically installed and are no longer required:
      galera-4 libdbd-mysql-perl libdbi-perl libterm-readkey-perl socat
    Use 'sudo apt autoremove' to remove them.
    0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
    root@mordor:~# 
    root@mordor:~# rm -rf  /var/lib/mysql
    root@mordor:~# 
    root@mordor:~# sudo apt install mariadb-client mariadb-server
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following additional packages will be installed:
      mariadb-client-10.4 mariadb-client-core-10.4 mariadb-server-10.4 mariadb-server-core-10.4
    Suggested packages:
      mailx mariadb-test tinyca
    The following NEW packages will be installed:
      mariadb-client mariadb-client-10.4 mariadb-client-core-10.4 mariadb-server mariadb-server-10.4 mariadb-server-core-10.4
    0 upgraded, 6 newly installed, 0 to remove and 1 not upgraded.
    Need to get 0 B/12.9 MB of archives.
    After this operation, 142 MB of additional disk space will be used.
    Do you want to continue? [Y/n] 
    Preconfiguring packages ...
    Selecting previously unselected package mariadb-client-core-10.4.
    (Reading database ... 181260 files and directories currently installed.)
    Preparing to unpack .../0-mariadb-client-core-10.4_1%3a10.4.17+maria~focal_amd64.deb ...
    Unpacking mariadb-client-core-10.4 (1:10.4.17+maria~focal) ...
    Selecting previously unselected package mariadb-client-10.4.
    Preparing to unpack .../1-mariadb-client-10.4_1%3a10.4.17+maria~focal_amd64.deb ...
    Unpacking mariadb-client-10.4 (1:10.4.17+maria~focal) ...
    Selecting previously unselected package mariadb-server-core-10.4.
    Preparing to unpack .../2-mariadb-server-core-10.4_1%3a10.4.17+maria~focal_amd64.deb ...
    Unpacking mariadb-server-core-10.4 (1:10.4.17+maria~focal) ...
    Selecting previously unselected package mariadb-server-10.4.
    Preparing to unpack .../3-mariadb-server-10.4_1%3a10.4.17+maria~focal_amd64.deb ...
    Unpacking mariadb-server-10.4 (1:10.4.17+maria~focal) ...
    Selecting previously unselected package mariadb-client.
    Preparing to unpack .../4-mariadb-client_1%3a10.4.17+maria~focal_all.deb ...
    Unpacking mariadb-client (1:10.4.17+maria~focal) ...
    Selecting previously unselected package mariadb-server.
    Preparing to unpack .../5-mariadb-server_1%3a10.4.17+maria~focal_all.deb ...
    Unpacking mariadb-server (1:10.4.17+maria~focal) ...
    Setting up mariadb-server-core-10.4 (1:10.4.17+maria~focal) ...
    Setting up mariadb-client-core-10.4 (1:10.4.17+maria~focal) ...
    Setting up mariadb-client-10.4 (1:10.4.17+maria~focal) ...
    Setting up mariadb-client (1:10.4.17+maria~focal) ...
    Setting up mariadb-server-10.4 (1:10.4.17+maria~focal) ...
    Failed to stop mysql.service: Unit mysql.service not loaded.
    Created symlink /etc/systemd/system/mysql.service → /lib/systemd/system/mariadb.service.
    Created symlink /etc/systemd/system/mysqld.service → /lib/systemd/system/mariadb.service.
    Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /lib/systemd/system/mariadb.service.
    Setting up mariadb-server (1:10.4.17+maria~focal) ...
    Processing triggers for man-db (2.9.1-1) ...
    root@mordor:~# 
    root@mordor:~# sudo mysql_secure_installation
    
    NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
          SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
    
    In order to log into MariaDB to secure it, we'll need the current
    password for the root user. If you've just installed MariaDB, and
    haven't set the root password yet, you should just press enter here.
    
    Enter current password for root (enter for none): 
    OK, successfully used password, moving on...
    
    Setting the root password or using the unix_socket ensures that nobody
    can log into the MariaDB root user without the proper authorisation.
    
    You already have your root account protected, so you can safely answer 'n'.
    
    Switch to unix_socket authentication [Y/n] n
     ... skipping.
    
    You already have your root account protected, so you can safely answer 'n'.
    
    Change the root password? [Y/n] y
    New password: 
    Re-enter new password: 
    Password updated successfully!
    Reloading privilege tables..
     ... Success!
    
    
    By default, a MariaDB installation has an anonymous user, allowing anyone
    to log into MariaDB without having to have a user account created for
    them.  This is intended only for testing, and to make the installation
    go a bit smoother.  You should remove them before moving into a
    production environment.
    
    Remove anonymous users? [Y/n]  
     ... Success!
    
    Normally, root should only be allowed to connect from 'localhost'.  This
    ensures that someone cannot guess at the root password from the network.
    
    Disallow root login remotely? [Y/n] 
     ... Success!
    
    By default, MariaDB comes with a database named 'test' that anyone can
    access.  This is also intended only for testing, and should be removed
    before moving into a production environment.
    
    Remove test database and access to it? [Y/n] 
     - Dropping test database...
     ... Success!
     - Removing privileges on test database...
     ... Success!
    
    Reloading the privilege tables will ensure that all changes made so far
    will take effect immediately.
    
    Reload privilege tables now? [Y/n] 
     ... Success!
    
    Cleaning up...
    
    All done!  If you've completed all of the above steps, your MariaDB
    installation should now be secure.
    
    Thanks for using MariaDB!
    root@mordor:~# 
    root@mordor:~# mariadb -u root
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 57
    Server version: 10.4.17-MariaDB-1:10.4.17+maria~focal-log mariadb.org binary distribution
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]> exit
    Bye
    root@mordor:~# 
    

    ou como usuário comum:

    nicholas@mordor:~$ 
    nicholas@mordor:~$ mariadb -u root -p
    Enter password: 
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 60
    Server version: 10.4.17-MariaDB-1:10.4.17+maria~focal-log mariadb.org binary distribution
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]> 
    MariaDB [(none)]> exit
    Bye
    nicholas@mordor:~$ 
    
    • 0

relate perguntas

  • Como posso ver todas as versões de um pacote que estão disponíveis no arquivo?

  • Como os PPAs podem ser removidos?

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Existe um comando para listar todos os usuários? Também para adicionar, excluir, modificar usuários, no terminal?

    • 9 respostas
  • Marko Smith

    Como excluir um diretório não vazio no Terminal?

    • 4 respostas
  • Marko Smith

    Como descompactar um arquivo zip do Terminal?

    • 9 respostas
  • Marko Smith

    Como instalo um arquivo .deb por meio da linha de comando?

    • 11 respostas
  • Marko Smith

    Como instalo um arquivo .tar.gz (ou .tar.bz2)?

    • 14 respostas
  • Marko Smith

    Como listar todos os pacotes instalados

    • 24 respostas
  • Martin Hope
    Flimm Como posso usar o docker sem sudo? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    led-Zepp Como faço para salvar a saída do terminal em um arquivo? 2014-02-15 11:49:07 +0800 CST
  • Martin Hope
    ubuntu-nerd Como descompactar um arquivo zip do Terminal? 2011-12-11 20:37:54 +0800 CST
  • Martin Hope
    TheXed Como instalo um arquivo .deb por meio da linha de comando? 2011-05-07 09:40:28 +0800 CST
  • Martin Hope
    Ivan Como listar todos os pacotes instalados 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    David Barry Como determino o tamanho total de um diretório (pasta) na linha de comando? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher "Os seguintes pacotes foram retidos:" Por que e como resolvo isso? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford Como os PPAs podem ser removidos? 2010-07-30 01:09:42 +0800 CST

Hot tag

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve