ERROR: Can't connect to MySQL

1. ERROR: Can't connect to MySQL

jorge luiz dos santos
jorge.ti10

(usa Outra)

Enviado em 09/07/2014 - 13:04h

Boa tarde a Todos,

Estou finalizando as configurações do OCS Inventory, só que na parte final do dashboard para inserir o usuário e senha no Browse para conectar no endereço http://172.25.1.50/ocsreports/

o sistema informar essa mensagem( ERROR: Can't connect to MySQL. Please enter a valid login/password. (host=10.1.2.226 login=ocs password=ocs)
ERROR: MySql connection problem
Can't connect to MySQL server on '10.1.2.226' (111) )

vejas as configurações do mysql

root@G4L:~# mysql -u ocs -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 58
Server version: 5.5.37-0ubuntu0.12.04.1 (Ubuntu)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| ocsweb |
+--------------------+
2 rows in set (0.03 sec)

Alguém sabe dizer como corrigir esse erro?


  


2. Re: ERROR: Can't connect to MySQL

Daniel Lara Souza
danniel-lara

(usa Fedora)

Enviado em 09/07/2014 - 13:50h

e o usuário ocs tem permissão na base de dados ocsweb ?


3. Re: ERROR: Can't connect to MySQL

jorge luiz dos santos
jorge.ti10

(usa Outra)

Enviado em 09/07/2014 - 13:59h

Boa tarde Daniel,

Sim o usuário ocs tem permissão de acesso.

veja o erro.

ERROR: Can't connect to MySQL. Please enter a valid login/password. (host=172.16.25.50 login=ocs password=ocs)
ERROR: MySql connection problem
Host 'g4l.adm.grupoforte.com.br' is not allowed to connect to this MySQL server


4. Re: ERROR: Can't connect to MySQL

Daniel Lara Souza
danniel-lara

(usa Fedora)

Enviado em 09/07/2014 - 14:02h

nas configurações do ocs tu ajustou a configuração de acesso ao banco ?


5. Re: ERROR: Can't connect to MySQL

jorge luiz dos santos
jorge.ti10

(usa Outra)

Enviado em 09/07/2014 - 14:04h

Senhores,

Lembrando que o endereço correto é esse host=172.16.25.50/ocsreports

Desculpa pela a misturada de ip.


6. Re: ERROR: Can't connect to MySQL

Daniel Lara Souza
danniel-lara

(usa Fedora)

Enviado em 09/07/2014 - 14:11h

o banco fica na mesmo maquina que a aplicação ?


7. Re: ERROR: Can't connect to MySQL

Daniel Lara Souza
danniel-lara

(usa Fedora)

Enviado em 09/07/2014 - 14:13h

chegou a verificar o arquivos dbconfig.inc.php se as configurações estão ok ?



8. Re: ERROR: Can't connect to MySQL

Fábio Berbert de Paula
fabio

(usa Debian)

Enviado em 09/07/2014 - 14:14h

O MySQL Server por padrão só responde à requisições de localhost (127.0.0.1). Edite seu /etc/mysql/my.cnf e altere a linha:

bind-address = 127.0.0.1

para:

bind-address = 0.0.0.0

Isso fará o mysql-server responder não só pela interface lo, mas pela eth0 e todas as demais.



9. Re: ERROR: Can't connect to MySQL

jorge luiz dos santos
jorge.ti10

(usa Outra)

Enviado em 09/07/2014 - 14:16h

Vejas as configurações desse arquivo ocsreports.conf

/etc/ocsinventory# cat ocsreports.conf
################################################################################
#
# OCS Inventory NG Administration Server
#
# Copyleft 2008 OCS Inventory NG Team
# Web: http://www.ocsinventory-ng.org
#
# This code is open source and may be copied and modified as long as the source
# code is always made freely available.
# Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
################################################################################

#
# ANY CHANGE ON THIS FILE REQUIRES APACHE RESTART TO TAKE EFFECT
#

################################################################################
# Administration console public pages
#
# Alias used to put Administration Server static page (typically PHP) outside
# Apache document root directory
#
Alias /ocsreports /usr/share/ocsinventory-reports/

<Directory /usr/share/ocsinventory-reports>
# By default, users can use console from everywhere
Order deny,allow
Allow from all
Options Indexes FollowSymLinks
DirectoryIndex index.php
AllowOverride Options

# Uncomment following to force use of HTTPS in Administration Server
#SSLRequireSSL

# PHP tuning (not working on all distribution, use php.ini instead)
AddType application/x-httpd-php .php
php_flag file_uploads on
# Some PHP tuning for deployement feature up to 8 MB
# post_max_size must be greater than upload_max_filesize
# because of HTTP headers
php_value post_max_size 9m
php_value upload_max_filesize 8m
# You may have to uncomment following on errors
#php_value max_execution_time -1
#php_value max_input_time -1

#!! Mandatory !! : set magic_quotes_gpc to off (to make ocsreports works correctly)
php_value magic_quotes_gpc off

# Uncomment following to allow HTTP body request up to 4 MB
# instead default 512 KB
#LimitRequestBody 4194304

# Uncomment following if you need to specify a mysql socket
#php_value mysql.default_socket "path/to/mysql/unix/socket"

</Directory>

################################################################################
# Deployment packages download area
#
# Alias to put Deployement package files outside Apache document root directory
#
Alias /download /var/lib/ocsinventory-reports/download


################################################################################
# Snmp communities area
#
# Alias to put Snmp communities reference file (snmp_com.txt) outside Apache document root directory
#
# This function is disabled by default in the Debian package, because it allows unauthenticated
# users to access the snmp_com.txt files, which contains the SNMP communities names and passwords
#
#Alias /snmp /var/lib/ocsinventory-reports/snmp


10. Re: ERROR: Can't connect to MySQL

jorge luiz dos santos
jorge.ti10

(usa Outra)

Enviado em 09/07/2014 - 14:19h

Boa tarde Fábio,

na linha bind-address = 127.0.0.1 eu deixei comentando para testar vou descomentar e inserir esse endereço.


11. Re: ERROR: Can't connect to MySQL

jorge luiz dos santos
jorge.ti10

(usa Outra)

Enviado em 09/07/2014 - 14:30h

deixa a linha apenas com 0.0.0.0

mais mesmo assim continua com o meu mesmo erro.


12. Re: ERROR: Can't connect to MySQL

jorge luiz dos santos
jorge.ti10

(usa Outra)

Enviado em 09/07/2014 - 14:31h

Vejas as configurações my.conf

cat /etc/mysql/my.cnf
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0
#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#log_slow_queries = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem



[mysqldump]
quick
quote-names
max_allowed_packet = 16M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer = 16M

#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/




01 02



Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts