SOLVED: Unable to access mysql database on server

truckerDave

Well-Known Member
Joined
Oct 7, 2023
Messages
291
Reaction score
280
Credits
2,409
THIS ENDED UP BEING A SIMPLE PERMISSIONS ISSUE.


First off. Total Linux noob here!

installed Ubuntu 22.04 (jammy)
Installed Apache/2.4.52 (Ubuntu)
Installed mysql Ver 8.0.35-0ubuntu0.22.04.1 for Linux
Installed php Version 8.1.2-1ubuntu2.14
Installed phpmyadmin 4:5.1.1+dfsg1-5ubuntu1

This morning I started my server from scratch with a fresh install as listed above.

I can access pages, such as the phpMyAdmin login, on the server from my Linux Mint PC. However, nothing I have tried over the last 2 weekends has allowed me to access the server database from my PC.

In no particular order .... what I have done/tried.

Added bind-address = 0.0.0.0 to the mysqld.cnf

In mysql ... Created a mysql user via: CREATE USER 'user_name'@'remote_server_ip' IDENTIFIED BY 'password';
In mysql ... Created another user via: CREATE USER 'sammy'@'remote_server_ip' IDENTIFIED WITH caching_sha2_password BY 'password';
In mysql ... Granted each GRANT ALL ON database.* TO 'user_name'@'remote_ip_address';
in mysql ... FLUSH PRIVILEGES;

Firewall ... ufw allow from remote_ip_address to any port 3306
Firewall ... ufw allow 3306

I know there are other things I've tried that I'm drawing a blank on at the moment. One was iptables, come to think of it. It changed nothing.

Each part (apache, mysql, php) seems to function just fine. I just keep getting the error : mysqli::real_connect(): (HY000/1045): Access denied for user 'user_name'@'localhost' (using password: YES)

"user_name@localhost" bugs me. But I'm assuming that's just the way the developers wrote the error announcement.

If I use a terminal on my PC ...... mysql -u user -h 192.168.254.19 -p .... I get ERROR 1045 (28000): Access denied for user 'user'@'dave-LM-15.home' (using password: YES)

Not sure why it says @dave-LM-15.home
I've not seen anything named quite like that. But what do I know?

I don't THINK I need someone to hold my hand (mine sweat and you won't like it) but could someone give this ole man a swift kick in the right direction? Put up a neon sign, paint arrows on the ground, or turn the bulb on in the lighthouse!

I really appreciate your time!
Dave
 
Last edited:


I'm the wrong person to answer this question, but I can possibly get some information from you that will help the next person.

What's the output of service mysql status?
 
I'm the wrong person to answer this question, but I can possibly get some information from you that will help the next person.

What's the output of service mysql status?

If it helps the next person, you're the right person. Thanks for kicking it off.

Code:
mysql.service - MySQL Community Server
    Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
    Active: active (running) since Sat 2023-11-04 21:52:07 UTC; 12h ago
   Process: 1253 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/success)
  Main PID: 1261 (mysqld)
    Status: "Server is operational"
     Tasks: 39 (limit: 9227)
    Memory: 366.3M
       CPU: 8min 46.953s
    CGroup: /system.slice/mysql.service
            '-1261 /user/sbin/mysqld
           
Nov 4 21:52:05 daveserv systemd[1]; Starting MySQL Community Server...
Nov 4 21:52:07 daveserv systemd[1]; Started MySQL Community Server.
 
I thought I gave the right permissions to my PC login. I thought wrong. Fixed now.
 

Staff online

Members online


Latest posts

Top