Re: OFF TOPIC - Problemas com mysql

Gustavo Villela Goulart <[email protected]>
Newsgroups gmane.linux.debian.user.portuguese
Message-ID <CAHg17qEs_UVLjZoo9X02SpimdNTcww-u-YQ-T6hM7K4vn8337w@mail.gmail.com>
Opá Mauricio, boa noite!

Vc mexeu na conf do mysql?

Por default o path do datadir é: /var/lib/mysql
Seu datadir esta assim: /dbase/mysql

Se vc alterou essa configuração na mão, ou as aplicações que vc esta usando
fizeram essa alteração, é o que esta causando o problema.
Para vc alterar o datadir do mysql, faça assim:
   - Pare o mysql
   - Copie todos os arquivos de /var/lib/mysql para o novo diretório
   - Altere o path  datadir        = /dbase/mysql
  - Inicie o mysql

Se vc não fez assim e só copiou os datafiles do bacula e da outra
aplicação, não vai funcionar. Se copiou com o banco funcionando(mysql
startado), provavelmente corrompeu os arquivos.

Espero ter ajudado.

Em sex., 22 de abr. de 2022 às 19:25, Mauricio Neto <[email protected]>
escreveu:

> Amigo boa tarde.
>
> Desculpe o off topic já que se trata de um problema de mysql e não Debian
> mas como nesta comunidade temos conhecedores de tudo relato uma situação
> muito estranha na esperança que algum dos amigos já tenham visto algo
> parecido, ou posam indicar um forum mais apropriado...
>
> Instalei o mysql 8.0, Apache2, PHP7.4, o Moodle (EAD) e o Bacula backup.
> tudo funcionando perfeitamente durante alguns dias e sem que ocorresse
> qualquer evento estranho tenho o seguinte cenário:
>
> As aplicações não encontram os databases.
>
> O  mysql -u root passa a conectar sem senha ou usando a opção -p aceita
> qualquer besteira que eu digite como senha. Originalmente criado com senha
> como sempre o faço e situação verificada quando esquecia ou errava  a
> digitação da senha :-)
>
> No repositório do mysql   (/dbase/mysql) existi os banco de dados moodle e
> bacula como pode ser visto com o ls mas o comando mysql show databases não
> mostra os bancos.
>
> O comando select user ....  não mostra os usuários moodle e bacula criados
> anteriormente para as respectivas bases de dados e o não aparece mais
> nenhum hash de senha para o root.
> Efetuei um teste definindo uma nova senha para o root com o comando ALTER
> conforme pode ser visto abaixo mas a senha não foi criada...
>
> O repositório do banco de dados (/dbase/mysql) esta usando o filesystem
> XFS.
>
> Qualquer ajuda sera bem vinda, inclusive a indicação de um forum sobre
> mysql.
>
> Agradecendo a todos,
> Mauricio Neto
>
> =====================================================
> ************** EVIDENCIAS *************
>
> +++++++++Teste do bacula
>
> bconsole
> Connecting to Director Enterprise:9101
> 1000 OK: 10002 Enterprise-dir Version: 11.0.5 (03 June 2021)
> Enter a period to cancel a command.
> *list volumes
> Automatically selected Catalog: EnterpriseCatalog
> Could not open catalog database "bacula".
> mysql.c:290 Unable to connect to MySQL server.
> Database=bacula User=bacula
> MySQL connect failed either server not running or your authorization is
> incorrect.
> You have messages.
> *mess
> 22-abr 01:25 Enterprise-dir JobId 4: No Jobs found to prune.
> 22-abr 01:25 Enterprise-dir JobId 4: Begin pruning Files.
> 22-abr 01:25 Enterprise-dir JobId 4: No Files found to prune.
> 22-abr 01:25 Enterprise-dir JobId 4: End auto prune.
>
> *list jobs
> Could not open catalog database "bacula".
> mysql.c:290 Unable to connect to MySQL server.
> Database=bacula User=bacula
> MySQL connect failed either server not running or your authorization is
> incorrect.
> ==================================================
> +++++++++ Configuração mysql
>
> /etc/mysql/mysql.conf.d# more mysqld.cnf
>
> [mysqld]
> pid-file    = /var/run/mysqld/mysqld.pid
> socket        = /var/run/mysqld/mysqld.sock
> datadir        = /dbase/mysql
> log-error    = /var/log/mysql/error.log
>
> innodb_file_per_table    = 1
> character-set-server    = utf8mb4
> collation-server     = utf8mb4_unicode_ci
> skip-character-set-client-handshake
>
> [mysql]
> default-character-set = utf8mb4
> =======================================
> ++++++ Usando o mysql
>
> mysql -u root
> Welcome to the MySQL monitor.  Commands end with ; or \g.
>
> mysql> show databases;
> +--------------------+
> | Database           |
> +--------------------+
> | information_schema |
> | mysql              |
> | performance_schema |
> | sys                |
> +--------------------+
> 4 rows in set (0,01 sec)
> ==============================================
> ls /dbase/mysql
>  auto.cnf     binlog.000004     binlog.000009     client-cert.pem
> ibdata1          mysql           server-cert.pem
>  *bacula*         binlog.000005     binlog.000010
>  client-key.pem       ib_logfile0     mysql.ibd           server-key.pem
>  binlog.000001     binlog.000006     binlog.index    '#ib_16384_0.dblwr'
> ib_logfile1     performance_schema   sys
>  binlog.000002     binlog.000007     ca-key.pem    '#ib_16384_1.dblwr'
> '#innodb_temp'   private_key.pem       undo_001
>  binlog.000003     binlog.000008     ca.pem         ib_buffer_pool
> *moodle*          public_key.pem       undo_002
> ========================================================================
> mysql> select user, host, authentication_string from mysql.user;
>
> +------------------+-----------+------------------------------------------------------------------------+
> | user             | host      |
> authentication_string                                                  |
>
> +------------------+-----------+------------------------------------------------------------------------+
> | mysql.infoschema | localhost |
> $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
> | mysql.session    | localhost |
> $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
> | mysql.sys        | localhost |
> $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
> | root             | localhost
> |                                                                        |
>
> +------------------+-----------+------------------------------------------------------------------------+
> 4 rows in set (0,00 sec)
>
> ===========================================================================
> ****************** TESTE TESTE TESTE ****************************
> Defino uma senha para root mas ela não é criada ....
>
> mysql> select user, host, authentication_string from mysql.user;
>
> +------------------+-----------+------------------------------------------------------------------------+
> | user             | host      |
> authentication_string                                                  |
>
> +------------------+-----------+------------------------------------------------------------------------+
> | mysql.infoschema | localhost |
> $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
> | mysql.session    | localhost |
> $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
> | mysql.sys        | localhost |
> $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
> | root             | localhost
> |                                                                        |
>
> +------------------+-----------+------------------------------------------------------------------------+
> 4 rows in set (0,00 sec)
>
> mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'criandosenha';
> Query OK, 0 rows affected (0,00 sec)
>
> mysql> FLUSH PRIVILEGES;
> Query OK, 0 rows affected (0,01 sec)
>
> mysql> select user, host, authentication_string from mysql.user;
>
> +------------------+-----------+------------------------------------------------------------------------+
> | user             | host      |
> authentication_string                                                  |
>
> +------------------+-----------+------------------------------------------------------------------------+
> | mysql.infoschema | localhost |
> $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
> | mysql.session    | localhost |
> $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
> | mysql.sys        | localhost |
> $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
> | root             | localhost
> |                                                                        |
>
> +------------------+-----------+------------------------------------------------------------------------+
> 4 rows in set (0,00 sec)
>
> ===============================================
> ================================================
> ================ FIM ==============================
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.