[web] PHP/MySQL creating the setup pages

Started by
28 comments, last by sathenzar 19 years, 7 months ago
ok I understand that no one would want to program it for me (to much time). So I was wondering, even in phpMyAdmin now it's saying error #1044 - Access denied for user: 'demon_SIAD@localhost' to database 'demon_test'. What get's me is before hand it says success in database connection.
if it successfully connected...then why is it saying Access Denied? This isn't makign any sense. I'm logged in why isn't it working?
Advertisement
Ok, I"m about to go insane. I know this sounds really unprofessional but I"m starting to think MySQL is just a big p.o.s. that just sits there going, yep there he is agian, let's tick him off by denying him of the most simplest thing ever. I've been on this for days, I tell it to create adatabase and I expect it to do it. I'm tired of it saying "Well haha I'm so stupid I'm going to say a big **** you and have a nice day!" Like I said, it's not suppoesed to be hard logic. I'm just getting so mad that everyone else can do it but me, I know that sounds stupid but I'm at the end of my rope as of now. I can't do anything else for my site until I get this worked out.
Whatever user you're logged in as does not have permission to create new databases, probably. mysql is not being a piece of shit, it's keeping your website from being hacked.

or, does that database already exist?

run the 'mysql' client, connect to the db, and do a 'show databases;'
Arg! I will code you a database creation script as long as you jump3.rating++ me [wink]

[edit]
Do this for me first in phpmyadmin and replace the username and password from above with bob and try that. I made a super user.
GRANT SELECT , INSERT , UPDATE , DELETE , CREATE , DROP , FILE , INDEX , ALTER , CREATE TEMPORARY TABLES ON * . * TO "bob"@ "%"IDENTIFIED BY "bob"WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 ;

That should work when queried off the admin account in mysql.
I didn't have time to post this before.
Use the function 'mysql_create_db' in PHP to create databases.

Here is an example code, that works perfectly here:
<?php$database = "baz";$id = mysql_connect("localhost", "root", "") or die(mysql_error());// Tries to select the database. If it can't select, tries// to create the database...if(!@mysql_select_db($database)){    if(!mysql_create_db($database))    {        printf("I couldn't create database %s!", $database);        die;    }    // Database created... select it.    @mysql_select_db($database);}// code... code.. code..?>


And if you want PHPBB, here is the latest version links: http://area51.phpbb.com/cvs/
Download a "phpBB 2.1.x Snapshots".

[Edited by - Maquiavel on September 14, 2004 10:38:52 PM]
Alfred Reinold Baudisch[Game Development Student] [MAC lover] [Ruby, Ruby on Rails and PHP developer] [Twitter]
Thank you so much, there is only one problem left, nbow it gives me this error (whihc I'm saure is jsut a sp error):
Fatal error: Call to undefined function: mysql_create_db() in /home/demon/public_html/forums/setup/index.php on line 10
My page code:
<?php$database = "baz";$id = mysql_connect("localhost", "root", "") or die(mysql_error());// Tries to select the database. If it can't select, tries// to create the database...if(!@mysql_select_db($database)){    if(!mysql_create_db($database))    {        printf("I couldn't create database %s!", $database);        die;    }    // Database created... select it.    @mysql_select_db($database);}// code... code.. code..?><html><head><title>Demon Realms Studios&reg; Setup 2004</title></head><body bgcolor="#FFFFFF">If you're seeing this message, then everything went well.</body></html>

Thanks for all of yor help so far, what is causing this erro though? if I could get past this one erro I'm set! -_-
Well, I've run exactly this code here and it works well.
Do you really have MySQL extension loaded? This is the unique reason to PHP saying that the function create_db doesn't exist.

BUT, you can try mysql_createdb("blah"); too.

That a look here: http://www.php.net/manual/en/function.mysql-create-db.php

It must work, since it was in PHP since PHP3!

All the best.
Alfred Reinold Baudisch[Game Development Student] [MAC lover] [Ruby, Ruby on Rails and PHP developer] [Twitter]
well now it's being the dumbest thing and it doesn't work it gives me the same exact error.

[Edited by - sathenzar on September 15, 2004 3:48:30 PM]
never mind now it says it worked but under phpMyAdmin I can't see the database I created.
even though it says I created it successfully it doens't show up under phpMyAdmin, is this because the user it root, and the only user account I have created is demon_SIAD? OR anyone have any other idea's? Thanks.

This topic is closed to new replies.

Advertisement