MYSQLI Error

Hi,

Consider below example which i’m using it for connecting to mysqli

$mysqli_connect = mysqli_connect(
$parameters[‘mysql_hostname’],
$parameters[‘mysql_username’],
$parameters[‘mysql_password’]
);

When I trying to connect its hitting this error ->mysqli::mysqli(): (28000/1045): Access denied for user ‘examplec_testte1’@‘localhost’ (using password: YES). Where $parameters[‘mysql_hostname’] is ‘localhost’ & if I set $parameters[‘mysql_hostname’] = ‘172.17.0.2’ then its connecting to mysqli without error.

Is it required to do changes in any .config files OR php.ini file ?If anything else need to change please suggest me the same.

Thank you
kiran upadhya

Hi kiran

Many thanks

Please could I ask if you have setup a different MySQL server and attached it to Iw server

If not, and 172.17.0.2 is your internal IP address, then localhost should have worked.

It could just be when you created the MySQL user, you only gave it external connection access and not % access perhaps

I could be wrong though sorry

Many thanks

John

Hi Kiran
if you log into nodeworx, server settings, logs, MYSQL log, can you see the below shown (note, you may need to restart mysql to view the startup options set at the time)
170706 9:09:06 [Note] Server socket created on IP: ‘0.0.0.0’.
170706 9:09:06 [Note] - ‘0.0.0.0’ resolves to ‘0.0.0.0’;
170706 9:09:06 [Note] Server hostname (bind-address): ‘0.0.0.0’; port: 3306
If your are different, please could you post your 3 lines
Many thanks
John

Hi,
Inside the nodeworx->server->logs->Mysql log showing empty. Does it have any settings to enable mysql log ?

Thank you
kiran upadhya

Hi kiran

Many thanks

There is 2 MySQL, one is shown in Interworx logs (not this one). The one you should look at in logs, is mysql

Is this the log you looked at (if so, restart MySQL and look at MySQL log - it should show startup log

Are you using MySQL on the Interworx server

Many thanks

John

Hi,

Yes i’m using MYSQL on the interworx server. Below is the database log & is this enough to trace my error!.

[root@a49e74c2ee02 /]# tail /var/log/
anaconda/ grubby_prune_debug lastlog pop3-ssl/ samba/ wtmp
apf_log httpd/ mariadb/ proftpd/ send/ yum.log
btmp imap4/ ntpstats/ rhsm/ smtp/
clamav/ imap4-ssl/ pop3/ sa/ tallylog
[root@a49e74c2ee02 /]# tail /var/log/mariadb/mariadb.log
170706 9:09:42 InnoDB: Using Linux native AIO
170706 9:09:42 InnoDB: Initializing buffer pool, size = 128.0M
170706 9:09:42 InnoDB: Completed initialization of buffer pool
170706 9:09:42 InnoDB: highest supported file format is Barracuda.
170706 9:09:42 InnoDB: Waiting for the background threads to start
170706 9:09:43 Percona XtraDB (http://www.percona.com) 5.5.49-MariaDB-38.0 started; log sequence number 5695038
170706 9:09:43 [Note] Plugin ‘FEEDBACK’ is disabled.
170706 9:09:43 [Note] Server socket created on IP: ‘0.0.0.0’.
170706 9:09:43 [Note] /usr/libexec/mysqld: ready for connections.
Version: ‘5.5.52-MariaDB’ socket: ‘/var/lib/mysql/mysql.sock’ port: 3306 MariaDB Server

Thank you
kiran upadhya

Hi kiran

Many thanks. Sorry got busy today so I’ll have a think over this

Your post shows 0.0.0.0, which covers all interfaces on server

The only other quick thought then, is the user restricted to external only.

Is there another database you could try to see if same happens

Many thanks

John

Hi,

In my script I did few changes i.e If I get $parameters[‘mysql_hostname’] == ‘localhost’ then I set $parameters[‘mysql_hostname’] = ‘127.0.0.1’. Now its working fine. Thank you for the information.:). I will get back to you If I found any error!.

Regards
kiran upadhya

thanks Jone I have almost the same problem, you help me too :smiley:

Hi gabithompson730

Many thanks

To try to help, we need more information

What IW-CP are you using

Is it the default MySQL

What distro are you using

Which php version are you using

What exactly is the issue

Many thanks

John