Accessing a local MySQL database - easy?

Discussion in 'Programming & Software Development' started by MonoJoker, Jun 28, 2018.

Tags:
  1. MonoJoker

    MonoJoker Member

    Joined:
    Jul 11, 2001
    Messages:
    2,514
    Location:
    An hour west of Brisvegas
    Hi All,

    Having some issues trying to setup a simple room booking database which runs as a MySQL database on PHPMyAdmin. https://mrbs.sourceforge.io/

    Not knowing what I'm really doing I just ran through all the documentation steps, have installed XAMPP so I have an Apache Web server and MySQL server running locally:

    upload_2018-6-28_9-28-37.png

    The database is setup, I've configured the php config file as per the documentation:

    $dbsys = "mysql";
    $db_host = "localhost";
    $db_port = 3306;
    $db_database = "rmbooking";
    $db_login = "mrbs";
    $db_password = 'mrbs_password';
    $db_tbl_prefix = "mrbs_";
    $db_persist = FALSE;

    When I try to connect to 127.0.0.1/rmbooking I get an error: Object not found!
    If I try to connect to 127.0.0.1/rmbooking:3306 I get an error: Access forbidden!

    I'm at a bit of a loss because how do I send my credentials to the MySQL server via the browser? I've setup a user in the MySQL database admin of [myname] but why in the php config file does it have a hardcoded user/pass? I've put some more screenshots below of anything I think might be relevant.

    If anybody could assist me in getting an actual login to the database happening that would be great :)

    upload_2018-6-28_9-43-34.png

    upload_2018-6-28_9-44-7.png
     
  2. neRok

    neRok Member

    Joined:
    Aug 19, 2006
    Messages:
    2,633
    Location:
    Perth NOR
    You don't login to the database at all.

    XAMPP basically just bundles a few things together, for convenience. Those things include;
    - the web server (Apache), which (among other things) handles running php modules/pages as web apps.
    - MySQL is the database server, which stores all your data in databases, that the php apps can access.
    - PHPMyAdmin seems to be included for convinience, and it is a pre-configured php module that will be running on the included apache web server, and accesses and configures the MySQL database server.

    So once apache and mysql are running, you would use phpmyadmin to configure a database in mysql (which it sounds like you have done).
    Then you need to install the php module for your web app. See the documentation INSTALLING THE MRBS FILES.
    Then you need to configure the php module, so it knows how it will be served, and how it can access the database. See CONFIGURING MRBS
    Then you probably need to configure apache, so it knows where/what php module it needs to serve.
    Then you should be able to view the web app in your browser at 127.0.0.1. I haven't played with WAMP stacks in a few years (which XAMPP is), but I remember them being a bit of a hassle, and sometimes I would have to access pages via http://localhost, not http://127.0.0.1.
     
    MonoJoker likes this.
  3. OP
    OP
    MonoJoker

    MonoJoker Member

    Joined:
    Jul 11, 2001
    Messages:
    2,514
    Location:
    An hour west of Brisvegas
    Thanks neRok I'll try those steps and hopefully have some luck.

    Edit: sorry I've already done those steps:

    Created the database (rmbooking) and tables in MySQL (7 standard tables)
    Configured the variables in the config.inc.php file as per the above - timezone, database name, etc. as per the second link you posted.

    So my next step should be to configure apache, so it knows where/what php module it needs to serve.

    So from here surely all I need to do is point a browser to:
    http://localhost/rmbooking - Object not found...
     

    Attached Files:

    Last edited: Jun 28, 2018
  4. neRok

    neRok Member

    Joined:
    Aug 19, 2006
    Messages:
    2,633
    Location:
    Perth NOR
    I'm flying blind here, but to configure apache, you need to edit it's files, or use any convenience features in the XAMPP control panel (ie. by pushing that config button). The document root will be the folder that contains the rmbooking files. Judging by this (on windows), the default document root is C:\xampp\htdocs\, so the php files would have to be placed under C:\xampp\htdocs\rmbooking to be available at url http://localhost/rmbooking. In that instance (using default folder locations), you probably don't have to configure apache at all. Some more helpful info here.

    Make sure you restart apache after making any changes.
     
    Last edited: Jun 28, 2018
    MonoJoker likes this.
  5. w0ng

    w0ng Member

    Joined:
    Dec 17, 2006
    Messages:
    125
    Location:
    Sydney
    Hi MonoJoker, have you considered using Docker?

    The great thing about something like Docker is that there preconfigured images of applications or systems you want, which saves you the hassle of needing to manually setup apache, ,mysql and php. All you need to do is pull or download the image, start the instance and be up and running.

    See: https://hub.docker.com/r/systemsector/mrbs/

    Hope this helps
     
  6. OP
    OP
    MonoJoker

    MonoJoker Member

    Joined:
    Jul 11, 2001
    Messages:
    2,514
    Location:
    An hour west of Brisvegas
    Thanks neRok the solution was to move the location of the php files - cheers!
     
  7. Foliage

    Foliage Member

    Joined:
    Jan 22, 2002
    Messages:
    31,994
    Location:
    Sleepwithyourdadelaide
    This is assuming the docker images aren't compromised. This has happened before and was only discovered after several million people had downloaded the image.
     

Share This Page