Raised This Month: $51 Target: $400
 12% 

Adding admins using Mysql Tutorial...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
L1nuxm4ster
Member
Join Date: Dec 2004
Old 12-25-2004 , 15:14   Adding admins using Mysql Tutorial...
Reply With Quote #1

Ok people. I've seen enough of you asking how, so I decided to post a solution. You will need command line access, mysql installed and your mysql user id and password. In this case we'll use "admin" as username and "password" as password.

Login to your server and type the following at the command line:

mysql -u admin -p (hit enter and type your password)

Now that you are logged in you have to create the database if you haven't already done so.

create database amxx (this will create your amx database if you haven't already done so)

After the database is created you have to go and edit the plugins.ini file on your server. The first few lines should look something like this:

; Admin Base - Always one has to be activated
;admin.amxx ; admin base (required for any admin-related)
admin_sql.amxx ; admin base - SQL version (comment admin.amxx)


In this file you have to put a semicolon in front of admin.amxx and remove the one in front of admin_sql.amx. That way you're telling it to use mysql.

Next step is to edit the sql.cfg file to put in your database name and login information. The file contents should look something like this:

amx_sql_host "localhost"
amx_sql_user "admin"
amx_sql_pass "password"
amx_sql_db "amxx"
amx_sql_table "admins"


Once that is done you have to wait for the next map change in your server. Once the map change takes place the server will create a table called "admins" in the amxx database you created.

OK. Now you have amxx using mysql and the admins tables was created by your server during the last map change. Now you'll need to get back into the command line in order to add your admins.

Type the following commands at the command line:

mysql -u admin -p (hit enter and it will ask you for the password)

After you have entered the password type the following:

use amxx (this will change to your amxx database)

INSERT INTO admins VALUES ('STEAM_0:1:1234567','password','abcdefghijkl u','e')

Substitute the steam ID for the actual steam ID or players name. You may also assing them the password of your choice and change their admin access level. You can look in your users.ini file for the access level legends.

I hope this helps. Post your success or any problems you may encounter during this process.
L1nuxm4ster is offline
Send a message via AIM to L1nuxm4ster Send a message via MSN to L1nuxm4ster Send a message via Yahoo to L1nuxm4ster
f1del1ty.oXi
Veteran Member
Join Date: Nov 2004
Old 12-25-2004 , 19:10  
Reply With Quote #2

small error, in the insert function, it should be CE and not E.

Also a simpler way is to use a program called PHPMyAdmin, which can give you a graphic interface so people don't have to hassle with the command line, although it is very easy done with your tutorial. Another option is Mysql Command Center, and although it's not supported anymore, ti still works beautifully.

Very well done.
f1del1ty.oXi is offline
L1nuxm4ster
Member
Join Date: Dec 2004
Old 12-26-2004 , 10:06  
Reply With Quote #3

I posted the 'e' in the INSERT function because that's what I use but people can use whichever one they want. You're right about PHPmyadmin it has a GUI but it's kind of confusing also and it's a lot easier to click the wrong link and drop a table or change field properties. I know that there are people outhere that have no clue like me at the beginning and the command line is kind of safer. People get curious and start snooping around on the GUI and they can't do it on the command line.

Then again it's just my opinion....
L1nuxm4ster is offline
Send a message via AIM to L1nuxm4ster Send a message via MSN to L1nuxm4ster Send a message via Yahoo to L1nuxm4ster
f1del1ty.oXi
Veteran Member
Join Date: Nov 2004
Old 12-26-2004 , 16:11  
Reply With Quote #4

but if your going to use an example like that dude..all they will do is copy-paste that and edit the STEAM ID and password and put that in, not thinking about the "C" that must go in there.

If people don't know how to add admins period, without searching or looking at users.ini, then technically they shouldn't be using Mysql though..

MySQL CC is very easy, probably a bit easier than PHPMyAdmin, because you actually have collumns and whatnot under each. I learned it when I was like 2 years yunger (proably 13 or 14) and it wasn't too tough. IT doesn't hurt to try it.

Also, don't they have to be in the mysql folder in order to do the commands? Also might want to explain what login to your server means, because if it's localhost, then they may be confused!

And another thing on the admin, I'd put full admin just to be on the safe side, as they will probably be doing this for themselves, and they will usually want full anyways. If not they can figure out what to take out.
f1del1ty.oXi is offline
L1nuxm4ster
Member
Join Date: Dec 2004
Old 12-29-2004 , 09:28  
Reply With Quote #5

Ok, As I said in my initial post "you can change your admin access level" this means you put in that last value whatever u want it to be. Also you do not have to be in the mysql folder to run the mysql command to get to your databases.

Also when I said "login to your server" that means exactly what I said. Log in to your server meaning SSH or Telnet access.

I figured that if someone has root access to their server and has managed to install the AMX mod and other stuff, they should be somewhat familiar with linux or windows for that matter.

Anyways, I was just trying to help, and as I said anyone having problems can always post it in here and I'll try to help.

L1nuxm4ster is offline
Send a message via AIM to L1nuxm4ster Send a message via MSN to L1nuxm4ster Send a message via Yahoo to L1nuxm4ster
ctpaba
Junior Member
Join Date: Jun 2004
Location: France
Old 01-16-2005 , 14:47  
Reply With Quote #6

in my case the plugin dont wana create admins table

someone can post here a structure of admins table ?
tnx
__________________
CTPABA uber alles

CS:1.6 - 62.93.224.88:27015
CS:1.6 - 195.200.122.77:27015
ctpaba is offline
Send a message via ICQ to ctpaba
f1del1ty.oXi
Veteran Member
Join Date: Nov 2004
Old 01-16-2005 , 14:51  
Reply With Quote #7

From AMX Mod, but it's the exact same format if I'm not mistaken:

CREATE TABLE admins (
auth varchar(32) NOT NULL default '',
password varchar(32) NOT NULL default '',
access varchar(32) NOT NULL default '',
flags varchar(32) NOT NULL default ''
) TYPE=MyISAM;

It's in admin.sma, a bit burried. This is the line:

dbi_query(sql,"CREATE TABLE IF NOT EXISTS `%s` ( `auth` VARCHAR( 32 ) NOT NULL, `password` VARCHAR( 32 ) NOT NULL, `access` VARCHAR( 32 ) NOT NULL, `flags` VARCHAR( 32 ) NOT NULL ) COMMENT = 'AMX Mod X Admins'",table)

But it looks the same to me. ;)
__________________
f1del1ty.oXi is offline
ctpaba
Junior Member
Join Date: Jun 2004
Location: France
Old 01-16-2005 , 16:05  
Reply With Quote #8

tnx now it work


I didn't look in sma file
__________________
CTPABA uber alles

CS:1.6 - 62.93.224.88:27015
CS:1.6 - 195.200.122.77:27015
ctpaba is offline
Send a message via ICQ to ctpaba
a10waveracer
Member
Join Date: Nov 2004
Location: 69.65.20.66:27015
Old 01-17-2005 , 18:28  
Reply With Quote #9

Okay, i just wanted to post this to give people a headsup/get told if i did something wrong.

Whenever i put in an entry, it works well. But when i edit that entry (ex. adding different flags) i use the same command to do it, and it adds 2 entries. Anyhow, you have to use the CC gui so you have the actual tables and delete the repetitive entries.

if you dont do that, it might not load the correct one
a10waveracer is offline
Send a message via AIM to a10waveracer Send a message via MSN to a10waveracer
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 01-17-2005 , 19:00  
Reply With Quote #10

Some notes:

There is no admin_sql.sma. Open admin.sma and uncomment USING_SQL, and recompile.

You really shouldn't assume SQL fields to come in any specific order. When inserting data, it's better to explicitly specify the fields.

INSERT INTO admins ('auth', 'password', 'access', 'flags')
VALUES ('STEAM_0:1:1234567','password','abcdefghijkl u','e')
Johnny got his gun is offline
Reply



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 On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:36.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode