Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 part question newbie in Mysql

Status
Not open for further replies.

cxteam

Technical User
Feb 26, 2003
6
CA
Bare with me to see if I am doing this correct. Thanks

I need to create a database this i know. (newone being the db)
create database newone;
I have a newone.sql file with a the table I need.
mysql newone -uxxx -pxxx < /root/newone.sql
So far i have checked this and its all there correct.

Question one:
Setting a user name and password up for this database. I am haveing troubles doing this.

Question two:
If i get question one done it may change this problem.
In the php script I have i need to acces this db. since I am not sure about username and password I get a error.

&quot;Fatal error: Call to undefined function: mysql_pconnect() in /var/
Is this error cause by the username and password not being set or is there a error connecting to the DB.

In this php file i get a error too.

<h3> Press RELOAD to add a record to the MySQL database:</h3>

<?

//establish user connection

mysql_connect(&quot;localhost&quot;);

//open up database

mysql_create_db(&quot;testdatabase&quot;);

mysql_select_db(&quot;testdatabase&quot;);

//create table

mysql_query(&quot;CREATE TABLE newone(firstName VARCHAR(25),lastName VARCHAR(25))&quot;);

mysql_query (&quot;INSERT INTO newone (firstName, lastName) VALUES ('Amir', 'Khan')&quot;);

//display the information

$result = mysql_query (&quot;SELECT * FROM newone&quot;);

while($row = mysql_fetch_array($result))

{

print (&quot;Added record: &quot; . $row[&quot;firstName&quot;].&quot; &quot;.$row[&quot;lastName&quot;].&quot; <br>\n&quot;);

}

//close user connection

mysql_close();

?>

error is \n&quot;); } //close user connection mysql_close(); ?>

Not sure why this error. Please help me thanks

Cxteam
 
For question one, you use the GRANT command. Check for more information.
For question two, it seems like you didn't compile PHP with MySQL support. My assumption from paths and similar is that you have a system which supports RPMs, so installing the php-mysql RPM should solve your problems. //Daniel
 
Thanks for you help. I am useing Red Hat 8. I will look for the php-mysql rpm. I am just not really sure on the syntax of the grant command but I will seach alittle be to see if I can find the correct why I doing it.

But thanks for helping me in the correct direction

cxteam
 
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP,RELOAD,SHUTDOWN,
-> ON newone.*
-> TO cxteam@localhost
-> INDENTIFIED BY xxxxxxx
-> WITH GRANT OPTION;

is this correct i get a
ERROR 1064: You have an error in your SQL syntax near 'ON netbingodb.*
TO <cxteam@localhost>
INDENTIFIED BY xxxxxx
WITH GRANT OPTION' at line 2
 
[tt]mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP,RELOAD,SHUTDOWN,
-> ON newone.*
-> TO cxteam@localhost
-> INDENTIFIED BY xxxxxxx
-> WITH GRANT OPTION;[/tt]
You have a trailing comma there, remove it and it should work. //Daniel
 
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP,RELOAD,SHUTDOWN -> ON netbingodb.*
-> TO cxteam@localhost
-> INDENTIFIED BY xxxx
-> WITH GRANT OPTION;
ERROR 1064: You have an error in your SQL syntax near 'INDENTIFIED BY xxxx
WITH GRANT OPTION' at line 4

I thank you for helping I am new to this and I copy what I read off a web site and still get errors
 
I did not notice your spelling error on the word &quot;INDENTIFIED&quot;, which should be &quot;IDENTIFIED&quot;. //Daniel
 
lolol K i am losing it lol


thanks alot :)
 
If I wanted say joe smith(or anyone from the internet) to be able to enter data in my database can i do it so they can enter data but not change anything ?
 
[tt]GRANT INSERT ON database.* TO whoever@% IDENTIFIED BY 'password';[/tt]
should do it. //Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top