logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Help getting MySQL stuff running
Goto page Previous  1, 2
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related
View previous topic :: View next topic  
Author Message
Leigt



Joined: 25 Jan 2005
Posts: 15

PostPosted: Fri Jan 28, 2005 13:28    Post subject: Reply with quote

>>mysql -u root -p

gave me

>>password:

I entered my password there and got the mysql> prompt

>>use mysql

gave database changed, like you said it should.

>>SELECT User, Host, Password FROM users;

gave Table 'mysql.users' doesn't exist

>>SELECT Db, User, Host, Select_priv FROM db;

gave:

+-------+----------+------+-------------+
| Db | User | Host | Select_priv |
+-------+-----------+------+-------------+
| test | nwserver| % | N |
| mysql | nwserver| % | N |
| nwn | nwserver| % | Y |
+-------+-----------+------+-------------+
3 rows in set (0.01 sec)

>>use nwn

gave Unknown database 'nwn'

I'm confused. It lists 'nwn' under "Db". Question

And I did install an ODBC driver... I think. The file name is MyODBC-3.51.10-2-win.exe It didn't make any tests when I installed.

Oh, and I found a new file called nwnx_odbc.txt in my logs.0 folder IT has the following lines repeated over and over:

o Logfile maximum size limit is: 524288 bytes
o Log level: Everything will be logged.
o Using ODBC connection.
o Hooking SCO....hooked at 5c4320
o Hooking RCO....hooked at 5c4200
! Error while connecting to database: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
o Got request: SELECT identifier FROM player_tracking WHERE playername='Leigt' AND charname='Leigt Niac'
! SQL Error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
o Got request: INSERT INTO player_tracking(playername, charname, pc_dm,level_1,level_2,level_3,class_1,class_2,class_3,experience,gender,public_cdkey,ip_address,subrace,deity,last_seen) VALUES('Leigt','Leigt Niac','0','3','3','0','Ranger','Dragon','Invalid','20783','M','FTRMTTJ4','192.168.2.100','Silver Half-Dragon','Selune',now())
! SQL Error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
...
Back to top
View user's profile Send private message
NoMercy



Joined: 03 Jan 2005
Posts: 123
Location: UK

PostPosted: Fri Jan 28, 2005 14:52    Post subject: Reply with quote

I rarely go anywhere near the controll database inside MySQL, so I can't see why you should have to worry aobut it. To create users you don't even need to touch it, to first find out what databases exist use:

Code:
SHOW DATABASES;


If the database nwn doesn't exist you can:

Code:
CREATE DATABASE nwn;


Then you need to create a user, the following line if I remembered corretly should create the user "nwn" and allow it to login from the localhost when giving the password "nwn", without the quotes, naturally.

Code:
GRANT ALL PRIVILEGES ON nwn.* TO 'nwn'@'localhost' IDENTIFIED BY 'nwn';


Those should be the default values in the nwnx.ini for the MySQL connection, and allow the aps_demo to create the pwdata table, you can check this by using the nwn database and:

Code:
SHOW TABLES;


If your curious what the table created's schema looks like:

Code:
EXPLAIN pwdata;


And to list the data inside it:

Code:
SELECT * FROM pwdata;


--

I believe a 'schema' is the correct term for what we often call a 'table' a schema being the details of what a table is, it's column names and column types. The 'table' in the strict sense refers to the created item, a table is a building, the schema the blueprint for the building, or something like that.

Just to improve that definition, a schema refers to the blueprints for all the tables in a database collectively :)


Last edited by NoMercy on Sat Jan 29, 2005 3:18; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Leigt



Joined: 25 Jan 2005
Posts: 15

PostPosted: Fri Jan 28, 2005 16:28    Post subject: Reply with quote

Boy do I feel sheepish. Embarassed Realized my biggest problem was forgetting to put the semicolon at the end of each command. Anyway, everything is working nicely now. Thanks all! Very Happy
Back to top
View user's profile Send private message
Leigt



Joined: 25 Jan 2005
Posts: 15

PostPosted: Fri Jan 28, 2005 16:54    Post subject: Reply with quote

I wonder if you can put up with me for a little longer. Almost to my goal. The website now doesn't want to load the server status page. It just sits there trying to load. I'm using the following php file with the listed settings... well, now that I'm looking at it I notice it's written by you guys. Smile

serverstatus.php

// Specify ip address or name of NWN server
// If behind a router with the server, fill this with the internal IP of the game server.
// otherwise give the normal ip used by players for direct connect.
$ipaddr = '83.130.93.8';
//direct connect ip for displaying.
$directconnip = '83.130.93.8'; // Example: The World Of Talus
// Specify port of server (5121 is default)
$port = '5121';
// Specify timeout (maximum time to wait for connection and data)
$timeout = 1; // changed to 1 seconds;

//mysql port. 3306 is default.
$mysqlport = '5212';
//mysql server ip address. default for local instance is 'localhost'
$mysqlipaddr = '83.130.93.8';
//mysql username.
$mysqluser = 'nwserver';
//mysql password. seriously folks, you better have a firewall in place.
$mysqlpass = 'nwpass';
//mysql database name.
$mysqldb='nwn';
//default server name used if offline.
$servername = "Isles of the Red Phoenix";
//default module name used if offline.
$modulename = "Red Phoenix";
//set this to 0 if you don't want all the extra junk displayed.
$printjunk=0;

And, yes, I changed the port in use by MySQL to 5212. Smile At least, I did using the administrator. I also set up a Virtual Server port forwarder through my router for 5212 only; exact same setup I have for the module.

Thanks!
Back to top
View user's profile Send private message
NoMercy



Joined: 03 Jan 2005
Posts: 123
Location: UK

PostPosted: Fri Jan 28, 2005 19:58    Post subject: Reply with quote

Couln't possibly say, that problem looks a bit specific to your setup, others might have some ideas.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Lokey



Joined: 02 Jan 2005
Posts: 158

PostPosted: Fri Jan 28, 2005 21:50    Post subject: Reply with quote

The GRANT command adds lines to those control databases...if you add by hand you just need to call FLUSH PRIVILEGES; to get your changes to work immediately (reloads the permissions for the active server).

Error files with NWNx: MySQL server running when you tried (just checking)? I'd guess it's your ODBC setup offhand if you're not using ODBC2 (Admin Tools/ODBC Data Sources)...which it sounds like you may not have done. Click that, add new data source (user, system or file depending on your setup) select MySQL ODBC 3.51morenumbers and fill in the options (Resource name, user name, pass, db, port). Then click that test datasource button (with your flavor MySQL server running).

MySQL runs on 3306 by default, you need to specify the port to run the server on when you start it, i.e. mysqlnt --port 5212. Then you may need to add port numbers to the current users, i.e. nwnx@localhost:5212 or root@localhost:5212. I don't know if % means any port, but it may...RTFM and all that. Then create a user account for your webserver account@ip:5212. Uncharted territory for me, never had cause to use a port besides the default.
_________________
Neversummer PW NWNx powered mayhem Wink
Back to top
View user's profile Send private message
Leigt



Joined: 25 Jan 2005
Posts: 15

PostPosted: Sat Jan 29, 2005 21:06    Post subject: Reply with quote

Okay, I didn't really understand that first paragraph about GRANT and FLUSH.

The second paragraph I did for User and System just now with no change. When I clicked Test each time I got a success message, so I guess that part is working. Log files for NWNX are showing no problems, too.

The third, I set up port 5212 using the Administrator but it may not have actually done anything. I don't know how to add ports via the command prompt. Anywhere I can get a list of prompt commands for MySQL? Smile I tried using \h but I just got confused.

All of this just to display on a website how many players are in the module. Confused
Back to top
View user's profile Send private message
NoMercy



Joined: 03 Jan 2005
Posts: 123
Location: UK

PostPosted: Sun Jan 30, 2005 5:39    Post subject: Reply with quote

If you want to just count how many players there are there are php scripts which will query servers using UDP sockets, the database route does give a lot more flexibility.

Something I use on my webserver is:
Code:
exec('quakestat -xml -gs2 68.221.209.105:5121', $output);


Which asuming you have qstat/quakestat installed, spits out a small chunk of XML into $output like:

Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<qstat>
   <server type="GS2" address="68.221.209.105:5121" status="UP">
      <hostname>68.221.209.105:5121</hostname>
      <name>The Legacy of Blood</name>
      <gametype>Social</gametype>
      <map>Legacy of Blood v4.1</map>
      <numplayers>8</numplayers>
      <maxplayers>30</maxplayers>
      <ping>181</ping>
      <retries>0</retries>
   </server>
</qstat>


In my case, I preorm some XML wizzardary to produce some HTML from it, but simple pattern-matching would do the trick.

The database issue I'm going to leave well alone still :)
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Leigt



Joined: 25 Jan 2005
Posts: 15

PostPosted: Sun Jan 30, 2005 6:13    Post subject: Reply with quote

Okay, well, I finally figured out two things. First, the port is still 3306, so any changes I make in Administrator don't actually happen. But I can't figure out how to change the port setting and when I do to keep it permanent.

Second, information gets written to the table and it doesn't overwrite old info so I have multiple copies of the same records. Sad
Back to top
View user's profile Send private message
Leigt



Joined: 25 Jan 2005
Posts: 15

PostPosted: Sun Jan 30, 2005 6:16    Post subject: Reply with quote

The database is working fine now. It's just getting the webserver to log in and retrieve it for display that's the problem.

Oh, and I found the initialization file for MySQL. I changed the Client port from 3306 to 5212. Server port was already 5212. But now I can't use mysql -u... so on to log in. I get an error. :/

Ack! And after changing it back to 3306 I still can't get in. Sad

EDIT: Okay, well everything's back to before. Changed things around so I'm now using the default port but no luck. I've figured out enough that I fixed the repeating entries thing for the table. Strange since I'm pretty sure I followed the directions for installing that setup correctly. Anyway, I can only assume from here on out that the problem resides in the php file. Thanks for all the help.
Back to top
View user's profile Send private message
window229



Joined: 21 Sep 2005
Posts: 3

PostPosted: Wed Sep 21, 2005 19:08    Post subject: Hmmm... Reply with quote

Quote:
There's no problem with the server running the website, as far as I know. The problem is that the module crashes when I try to log in to it as DM or as player with everything running and the above settings in the NWNX.ini.


I think that that's a rather good meathod.^]
_________________
roulette online gambling 777
Internet Gambling Credit Card
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related All times are GMT + 2 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group