This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-17. For the latest, interactive version please visit https://mariadb.com/kb/.

After activate mysql, I can't access mysql by php from other server.

I built a mariadb server and activate that use service command. I confirmed that it is active, so acess that from other server but i can't.
I thought it was suspicious so i try to nc command to 3306 from Macbook but connection refused. I tried mysql command on MariaDB server after mysql_secure_installation "mysql -u root -p" then I could login root user.
I didn't use ufw and iptable.

Here is the log after having installed and run MariaDB server.

● mariadb.service - MariaDB 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: active (running) since Wed 2017-08-30 11:37:36 EDT; 6min ago
Process: 2361 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 2356 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
Process: 2163 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSIT
Process: 2155 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 2150 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS) Main PID: 2323 (mysqld)
Status: "Taking your SQL requests now..."
Tasks: 32
Memory: 94.6M
CPU: 715ms
CGroup: /system.slice/mariadb.service
└─2323 /usr/sbin/mysqld

Aug 30 11:37:35 ubuntu mysqld[2323]: 2017-08-30 11:37:35 140427265321152 [Note] InnoDB: 5.7.19 started; log sequence number 1629245
Aug 30 11:37:35 ubuntu mysqld[2323]: 2017-08-30 11:37:35 140426027722496 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Aug 30 11:37:35 ubuntu mysqld[2323]: 2017-08-30 11:37:35 140426027722496 [Note] InnoDB: Buffer pool(s) load completed at 170830 11:37:35
Aug 30 11:37:36 ubuntu mysqld[2323]: 2017-08-30 11:37:36 140427265321152 [Note] Plugin 'FEEDBACK' is disabled.
Aug 30 11:37:36 ubuntu mysqld[2323]: 2017-08-30 11:37:36 140427265321152 [Note] Server socket created on IP: '127.0.0.1'.
Aug 30 11:37:36 ubuntu mysqld[2323]: 2017-08-30 11:37:36 140427265321152 [Note] Reading of all Master_info entries succeded
Aug 30 11:37:36 ubuntu mysqld[2323]: 2017-08-30 11:37:36 140427265321152 [Note] Added new Master_info '' to hash table
Aug 30 11:37:36 ubuntu mysqld[2323]: 2017-08-30 11:37:36 140427265321152 [Note] /usr/sbin/mysqld: ready for connections.
Aug 30 11:37:36 ubuntu mysqld[2323]: Version: '10.2.8-MariaDB-10.2.8+mariaxenial-log' socket: '/var/run/mysqld/mysqld.sock'
port: 3306 mariadb.org binary distribution
Aug 30 11:37:36 ubuntu systemd[1]: Started MariaDB database server.

So I thought that root user denied from remote so I create user and I could access.
Please, could tell me what's wrong ?

Takumi Hayashi

Answer Answered by Ian Gilfillan in this comment.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.