LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-09-2019, 09:27 AM   #1
HarishMooly
LQ Newbie
 
Registered: May 2018
Posts: 19

Rep: Reputation: Disabled
mariadb


Hello

Hi

I have two server, one is database hosted and another one is application base server, in database server i gave the remote access , i can access the database by command prompt but in web through i cant, am not able to understand what i missed.

can you please help me how to get out this situation.


Note : This two server is linux based
 
Old 10-09-2019, 09:36 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 21,944

Rep: Reputation: 5810Reputation: 5810Reputation: 5810Reputation: 5810Reputation: 5810Reputation: 5810Reputation: 5810Reputation: 5810Reputation: 5810Reputation: 5810Reputation: 5810
Quote:
Originally Posted by HarishMooly View Post
I have two server, one is database hosted and another one is application base server, in database server i gave the remote access , i can access the database by command prompt but in web through i cant, am not able to understand what i missed. can you please help me how to get out this situation.

Note : This two server is linux based
Right...this takes us back to last year, when you asked a similar question: https://www.linuxquestions.org/quest...in-4175630472/

You aren't providing us details; saying "linux based" tells us nothing, nor does "web through i cant". You don't tell us version/distro of Linux, what web app(s) you're using to try to access the database, etc. We can't guess, but if you can access it over command-line, then your problem is simple; you haven't configured your web page/system/program/whatever, to use the right connection details. And since you don't tell us what those things are, we don't know what to tell you.
 
Old 10-09-2019, 09:43 AM   #3
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 4,160
Blog Entries: 3

Rep: Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061
Please say which distro you have on these machines (including version), which version of mariadb you have, and which shell you are using. Also are you accessing through SSH or directly to the database via an exposed external port?
 
1 members found this post helpful.
Old 10-09-2019, 09:56 AM   #4
HarishMooly
LQ Newbie
 
Registered: May 2018
Posts: 19

Original Poster
Rep: Reputation: Disabled
am extremely very sorry, I didn't mentioned rest of information .

I have two dedicated Linux server, OS is CentOS 7, On first server i configured the maria db and i set the grant privileges to that server (grant all on *.* to 'root'@'%' . On second server i hosted one web application. now my issues on second server is by command prompt i can access my database by using following command

mysql -u root -h database_ipaddress -p

but on same server i make a simple php page for checking database connectivity.

<?php
$servername = "00.00.00.00";
$username = "root";
$password = "xxxxxxxx";

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>

when i run webpage like http://abc.com/database.php the its showing error like this

This page isn’t workingsaleszipemail.com is currently unable to handle this request.
HTTP ERROR 500


Thanks
 
Old 10-09-2019, 10:09 AM   #5
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 4,160
Blog Entries: 3

Rep: Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061
How is the arrangement between the web server with PHP and the mariadb daemon? Are they on the same machine or different machines? If they are on different machines, are they on the same LAN or not?
 
Old 10-09-2019, 10:23 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 19,028

Rep: Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890
A 500 error is generic and does not provide any real information.

Check the apache logs on the web server at /var/log/httpd. I assume your using apache.

Did you install the apache php and php-mysql modules?

Does your php script have the correct permissions?

Your missing the database name in the mysqli connect statement
$conn = new mysqli($servername, $username, $password, database_name);

Last edited by michaelk; 10-09-2019 at 10:25 AM.
 
1 members found this post helpful.
Old 10-09-2019, 10:31 AM   #7
HarishMooly
LQ Newbie
 
Registered: May 2018
Posts: 19

Original Poster
Rep: Reputation: Disabled
@michaelk


Thanks Michael

Its solved. I installed php-mysql modules, now i can access database by webpage.


Thanks once agian.
 
2 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: KDE Participating in Google Summer of Code 2019, MariaDB Releasing New Open-Source MariaDB Enterprise Server, CentOS Celebrates 15th B LXer Syndicated Linux News 0 02-28-2019 06:50 AM
LXer: Installing MariaDB and mod_ruid2 on Debian Squeeze LXer Syndicated Linux News 0 05-09-2012 08:40 AM
[SOLVED] Slackware: Replace MySQL with MariaDB on fresh installation. astanton Slackware 4 03-03-2012 02:37 AM
LXer: Road to MariaDB 5.2: Virtual Columns LXer Syndicated Linux News 1 10-01-2010 02:08 AM
LXer: MariaDB 5.1.42 released! LXer Syndicated Linux News 0 02-09-2010 07:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration