creating a database file..
Moderator: General Moderators
-
gavinbsocom
- Forum Commoner
- Posts: 71
- Joined: Tue Sep 30, 2003 9:51 pm
creating a database file..
I'm unsure on how to create a database file? I have been reading different tutorials and I just dont understand it. I have mysql installed on my computer and I will also have it on my web hosting service in about a week. The main purpose of this is database is to make a user login / register. So do I open up a blank page in notepad and call it database1.db?
Re: creating a database file..
Forgive me if I do not quite understand the issue, but what exactly do you mean by 'database file'?gavinbsocom wrote:I'm unsure on how to create a database file?
...
So do I open up a blank page in notepad and call it database1.db?
-
gavinbsocom
- Forum Commoner
- Posts: 71
- Joined: Tue Sep 30, 2003 9:51 pm
-
gavinbsocom
- Forum Commoner
- Posts: 71
- Joined: Tue Sep 30, 2003 9:51 pm
well, the easiest way possible is to just create teh database from within MySQL itself. As i said, there is a manual inside the MySQL directory that you installed it to that tells you pretty indepthly how to do this.so I create the database and then have php install it? Infolock your saying I could create the database from php code but it would be easier to create the database and then have the php code call the database?
as far as calling the database, php is by far the easiest way. check this link out :
http://www.php.net/function.mysql-connect
it gives you some very nice functions and methods of how to connect. as far as creating the user authentication program, you may want to hold off on doing that until you learn how to create databases/tables with mysql, and then learn how to pull that info from mysql.
after you will need to learn about $_POST as i'm sure you will be typing the username/password in a post field. give me a few and i'll post a sample script i wrote a few months(maybe a year?) ago and it may give you a pretty good insight.
here's the link :
viewtopic.php?t=3649&highlight=
-
gavinbsocom
- Forum Commoner
- Posts: 71
- Joined: Tue Sep 30, 2003 9:51 pm
Ok, but check this out,,,this isf romt he manual...this is what i dont understand....
To connect to the server, you'll usually need to provide a MySQL user name when you invoke mysql and, most likely, a password. If the server runs on a machine other than the one where you log in, you'll also need to specify a hostname. Contact your administrator to find out what connection parameters you should use to connect (that is, what host, user name, and password to use). Once you know the proper parameters, you should be able to connect like this:
shell> mysql -h host -u user -p
Enter password: ********
Where do i type that shell statement or w/e it is? In notepad? in command prompt? in what?
To connect to the server, you'll usually need to provide a MySQL user name when you invoke mysql and, most likely, a password. If the server runs on a machine other than the one where you log in, you'll also need to specify a hostname. Contact your administrator to find out what connection parameters you should use to connect (that is, what host, user name, and password to use). Once you know the proper parameters, you should be able to connect like this:
shell> mysql -h host -u user -p
Enter password: ********
Where do i type that shell statement or w/e it is? In notepad? in command prompt? in what?
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
-
gavinbsocom
- Forum Commoner
- Posts: 71
- Joined: Tue Sep 30, 2003 9:51 pm
Like I said, if you would read the manual that's found in your MySQL directory, you would be able to do this so much easier 
i'm not trying to be rude, but that manual gives you STEP BY STEP instructions on how to do the things you need.
but if you need a quicker response, here :
1) Clicks Start
2) Click Run
3) type CMD and press enter
4) type cd \ and press enter. this will take you to the root of C:\
5) type cd mysql
6) type cd bin
7) type mysql -u root
now, this will just get you into mysql. you are going ot need to setup another username that will ONLY have read/write/create/drop options on particular databases or tables.
all this is covered in the manual that's in your mysql/doc directory
if you want more information on function calling from within php, i suggest you read the link i posted above for calling convensions
hope that helps
i'm not trying to be rude, but that manual gives you STEP BY STEP instructions on how to do the things you need.
but if you need a quicker response, here :
1) Clicks Start
2) Click Run
3) type CMD and press enter
4) type cd \ and press enter. this will take you to the root of C:\
5) type cd mysql
6) type cd bin
7) type mysql -u root
now, this will just get you into mysql. you are going ot need to setup another username that will ONLY have read/write/create/drop options on particular databases or tables.
all this is covered in the manual that's in your mysql/doc directory
if you want more information on function calling from within php, i suggest you read the link i posted above for calling convensions
hope that helps