collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18363
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Problem with 2.10 Connecting to MySQL  (Read 2521 times)

0 Members and 1 Guest are viewing this topic.

Offline tylerp

  • BeBot Rookie
  • *
  • Posts: 13
  • Karma: +0/-0
Problem with 2.10 Connecting to MySQL
« on: January 09, 2007, 02:23:42 am »
So I set everything up, and I got confirmation messages that I did everything correctly.. I try running the bot and the window flashes for a split second, so I opened the debug to figure out the problem. This is what it says, I have no idea how to fix it. Please help, I know nothing about MySQL.


Warning: mysql_connect(): Access denied for user 'ODBC'@'localhost' (using passw
ord: NO) in C:\Documents and Settings\Tyler\Desktop\BeBot\MySQL.php on line 63
MySQL error (# 0) on query: Cannot connect to the database server!
Access denied for user 'ODBC'@'localhost' (using password: NO)
« Last Edit: January 09, 2007, 02:37:48 am by tylerp »

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Problem with 2.10 Connecting to MySQL
« Reply #1 on: January 09, 2007, 03:36:50 am »
Silly question, but did you actually make a MySQL user named ODBC?

Please post the contents of your mysql.conf file. Should look something like this:

<?
    $dbase = "bebot";
    $user = "bebotuser";
    $pass = "password";
    $server = "localhost";
?>

P.S. The above is just an example. You can mask out the password so others here don't see it. And please read this very carefully -> http://bebot.link/index.php/topic,384.0.html
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline tylerp

  • BeBot Rookie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: Problem with 2.10 Connecting to MySQL
« Reply #2 on: January 09, 2007, 03:47:30 am »
No, I didn't make a user with that name, I think it defaulted back to that when something went awry. Um, I could try making one and setting privileges I guess..

Code: [Select]
class MySQL
{
var $CONN = "";
var $DBASE = "Items";
var $USER = "tyler";
var $PASS = "********";
var $SERVER = "localhost";

function MySQL()
{
$this -> error_count = 0;
$this -> last_error = 0;
$this -> last_reconnect = 0;

/*
Load up config
*/
include "conf/MySQL.conf";

$this->USER = tyler;
$this->PASS = ********;
$this->SERVER = localhost;
$this->DBASE = Items;

$this -> connect(true);

return true;
}

function connect($fatal = false)
{
$conn = mysql_connect($this -> localhost, $this -> root, $this -> *******, true);

if (!$conn)
{
$this->error("Cannot connect to the database server!", $fatal);
return false;
}
if(!mysql_select_db($this -> DBASE, $conn))
{
$this->error("Database not found or insufficient priviledges!", $fatal);
return false;
}
echo "Connected to MySQL\n";
$this->CONN = $conn;
$this->error_count = 0;
}


function error($text, $fatal = false)
{
// Check if more than 30 seconds has passed since the last error
if (time() >= ($this -> last_error + 30))
{
// If so reset the error count
$this -> error_count = 0;
}

// We display a maximum of 10 errors every 10 seconds to prevent flooding of the logs/console
if ($this -> error_count <= 10)
{
$msg = mysql_error();
echo "MySQL error (# " . $this -> error_count . ") on query: $text\n";
echo "$msg\n";

// If this error is occuring while we are trying to first connect to the database when starting
// rthe bot its a fatal error.
if ($fatal == true)
{
exit;
}

// Did we just loose the connection to the database server?
if (strcasecmp($msg, "MySQL server has gone away") == 0)
{
// We wait 30 seconds between each reconnect attempt
if (time () >= ($this -> last_reconnect + 30))
{
// Lets reconnect
echo "Attempting reconnect to MySQL server...\n";
$this -> last_reconnect = time();
$this -> connect(false);
}
}
$this -> error_count += 1;
$this -> last_error = time();
if ($this -> error_count == 11)
{
echo "Threshold of 10 errors in 30 seconds reached. Supressing error output for 30 seconds\n";
}
}

}


function select ($sql)
{
$data = "";
$result = mysql_query($sql, $this->CONN);

if (!$result)
{
$this -> error($sql);
return false;
}

if (empty($result))
{
return false;
}

$count = 0;

while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
$data[$count] = $row;
$count++;
}

mysql_free_result($result);
return $data;
}


function query ($sql)
{

$return = mysql_query($sql, $this->CONN);

if (!$return)
{
$this -> error($sql);
}
}


function returnQuery ($sql)
{
return mysql_query($sql, $this->CONN);
}


function dropTable ($sql)
{
$result = mysql_query("DROP TABLE " . $sql, $this->CONN);
}
}
?>
« Last Edit: January 09, 2007, 03:52:39 am by tylerp »

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Problem with 2.10 Connecting to MySQL
« Reply #3 on: January 09, 2007, 03:58:08 am »
Well there's your problem right there. You edited the MySQL.php file. DO NOT edit that file.

Please find the file ..\Root_path_to_Bebot\conf\mysql.conf and set the variables there.

From the Setup guide:
Phase 3: Logging into MySQL
1. Open a command prompt. (Start > Run > CMD, Click OK)
2. In the command prompt, enter the command mysql -u root -p
3. Enter your root password (You did write it down so you wouldn't forget it right?)

You should now have a MySQL prompt that looks like: mysql>

Phase 4: Create a Database and Database User for BeBot
1. Type CREATE DATABASE databasename; (replace databasename with the name of the database you wish to create)
2. Press Enter/Return.
3. CREATE USER username@localhost; (Change username to the username you want, keep @localhost)
4. Press Enter/Return.
5. SET PASSWORD FOR username@localhost = PASSWORD('newpassword'); (Change username and newpassword to your selected username and password, again keep @localhost)
6. Press Enter/Return.
7. Type GRANT ALL on databasename.* TO username@localhost; (Again, change username, keep @localhost)
8. Press Enter/Return.
9. Type quit then Enter/Return to exit the MySQL Monitor.
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline tylerp

  • BeBot Rookie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: Problem with 2.10 Connecting to MySQL
« Reply #4 on: January 09, 2007, 04:35:46 am »
Problem fixed, bot is up and running. Thanks!!

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Problem with 2.10 Connecting to MySQL
« Reply #5 on: January 09, 2007, 05:18:26 am »
Your welcome.   8)
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

 

* Recent Posts
[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm]


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 423
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal