Web Hosting Talk







View Full Version : Basic Command for adding users / MYSQL


ThePrimeHost
08-28-2001, 08:08 PM
Please excuse my ignorance, but what is the basic telnet command for adding users and creating a database for their virtual site?










-Thanks for your time.

dektong
08-28-2001, 08:25 PM
I don't know what the easiest way to do that ... but here is what I would do:

1. get into your mysql using your mysql root password:
$mysql -uroot -pyour_mysql_password mysql
you will see the following if your login is successfull ...

Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 49947 to server version: 3.23.40

Type 'help;' or '\h' for help. Type '\c' to clear the buffer

mysql>

2. type CREATE DATABASE dbname; where dbname is your database name you want to create. if this is successful, it will show you the following:

mysql> CREATE DATABASE tongtest;
Query OK, 1 row affected (0.13 sec)

mysql>

3. Now you will need to assign this db to a mysql user (need not be the same as your user login name). Type: GRANT ALL PRIVILEGES ON tongtest.* TO mysqluser@localhost IDENTIFIED BY 'mysqluser_password';. Note: mysqluser and mysqluser_password is the user name and password needed to login to mysql server. If you are successfull, then you will get the following output:

mysql> GRANT ALL PRIVILEGES ON tongtest.* TO tong@localhost IDENTIFIED BY 'tongmysql';
Query OK, 0 rows affected (0.04 sec)


4. now just type exit, and basically you are done ...

There is a easier way to do it with mysqladmin ... But I like doing it this way :) Good Luck ...

cheers,
:beer:

mikeknoxv
08-28-2001, 08:38 PM
dektong,
How do you completely remove a user from MySQL. Say I add the user "bob," and now I want to remove the login from my MySQL system. How do I go about doing so? Thanks!

Chicken
08-28-2001, 08:44 PM
Prime, not the telnet command but for a super easy method:

http://www.raqsupport.net/utilities.html - PHP: MySQL adder

or

http://www.raqzone.com/tools.htm

ThePrimeHost
08-28-2001, 08:46 PM
:D

Outstanding!!! Everything appears to be working!!!

Question(s) though..how do I go about testing this?

How do I add a user for his or her domain?

How would they get to the database? Would it be linked through their domain?

Once again, forgive my ignorance. I really appreciate the help.

Kind Regards,
Darrell Buckhaults

ThePrimeHost
08-28-2001, 08:47 PM
Chicken,

I attempted to install that script but receive the following error when trying to run it:

Warning: MySQL Connection Failed: Access denied for user: 'root@localhost' (Using password: YES) in /home/sites/site3/web/mysql.php on line 35

Warning: Supplied argument is not a valid MySQL-Link resource in /home/sites/site3/web/mysql.php on line 37

Warning: Supplied argument is not a valid MySQL-Link resource in /home/sites/site3/web/mysql.php on line 40

Warning: Supplied argument is not a valid MySQL-Link resource in /home/sites/site3/web/mysql.php on line 45

Warning: Supplied argument is not a valid MySQL-Link resource in /home/sites/site3/web/mysql.php on line 47

dektong
08-28-2001, 08:58 PM
Originally posted by mikeknoxv
How do you completely remove a user from MySQL. Say I add the user "bob," and now I want to remove the login from my MySQL system. How do I go about doing so? Thanks!

To completely remove an user:
1. Login into your mysql server ... $mysql -uroot -p mysql
2. Once you are in, type the following: DELETE FROM user WHERE User='bob'; In my example, here is what I did and what the output is supposed to be ...

mysql> DELETE FROM user where User='tong';
Query OK, 1 row affected (0.00 sec)

3. Now if you do SELECT * FROM user; you should not see 'bob' in the mysql user table ...
4. type exit and you are done ...

Good luck, and cheers ...
:beer:

jks
08-28-2001, 09:04 PM
Originally posted by theprimehost
Chicken,

I attempted to install that script but receive the following error when trying to run it:

Warning: MySQL Connection Failed: Access denied for user: 'root@localhost' (Using password: YES) in /home/sites/site3/web/mysql.php on line 35


Did you remember to edit the file and enter your own root password?

madsere
08-28-2001, 09:05 PM
And if you also want to get rid of his data you do

>drop database tongtest;

and viola! Gone!

dektong
08-28-2001, 09:10 PM
Originally posted by theprimehost
Outstanding!!! Everything appears to be working!!!

phew .. glad it worked out :)


Question(s) though..how do I go about testing this?

you can try to connect to the mysql server with his/her login name: $mysql -umysqluser -p[i]mysqluser_password dbname where mysqluser, mysqluser_password, and dbname are the mysql user login, password and database name you just create for your user. If everything is OK, you should now be in the mysql server with his/her login.

How do I add a user for his or her domain?
I don't quite understand that question ;)

How would they get to the database? Would it be linked through their domain?
To get into mysql serer with their login name, do like the above step .... They also can connect to the server, create db, do sql querries, etc through php ... Now ... I am not the expert in this, but your user should know this ... all you need to do is to set up db for him/her and grant access for him/her to that db ...

Once again, forgive my ignorance. I really appreciate the help.

No problem ... Don't forget to visit www.mysql.com for tons of documentation and also do searches on the internet about this... That's how I learn bits by bits ... :)

cheers,
:beer:

Chicken
08-28-2001, 09:10 PM
Prime, which script was that? I've used Jens' and it worked flawlessly.

dektong
08-28-2001, 09:11 PM
Originally posted by madsere
And if you also want to get rid of his data you do

>drop database tongtest;

and viola! Gone!

ah ... yes, of course :D

cheers,
:beer:

mikeknoxv
08-29-2001, 06:51 AM
http://phpmyadmin.sourceforge.net/documentation/#faq
Look for "I'm an ISP. Can I setup one central copy of phpMyAdmin or do I need to install it for each customer?"

This way, when you're using phpMyAdmin, a client will only have access to the database you give him.

ThePrimeHost
09-01-2001, 02:05 AM
Chicken,
Jen's script appears to be working flawlessly now!!!!

Woo Hoo!!!!!!!!!!!!!!!

Thanks a million!!!!!

Chicken
09-01-2001, 01:52 PM
Glad to hear it... but thank him, not me :D