Results 1 to 3 of 3
Hey,
I installed LAMP server in my ubuntu-9.04 server through the Synaptic Package Manager.
Now I have a php page where I want to save data by creating a DB ...
- 10-21-2009 #1Just Joined!
- Join Date
- Aug 2009
- Posts
- 80
SQL database in LAMP
Hey,
I installed LAMP server in my ubuntu-9.04 server through the Synaptic Package Manager.
Now I have a php page where I want to save data by creating a DB with table name, but I'm not sure of how to write SQL query and execute it to create a db and table.
Also, can I connect to this db remotely, I mean I run asterisk on this server. But I create the php pages on my Windows laptop, if I execute the php page will I still be able to connect db.
Help me!
- 10-21-2009 #2Just Joined!
- Join Date
- May 2008
- Posts
- 8
create a database
you need:
a username and password for mysql that can create a database. in my example this is u:user p
assword and the database is "database1"
mysql -u user1 -p
<enter password when prompted>
now:
mysql> CREATE DATABASE database1;
mysql> SHOW DATABASEs;
and you should see yours.
mysql> quit
now you want to add some security, this will be user2
assword2
mysql -u user1 -p
<enter password when prompted>
mysql> GRANT ALL ON database1.* TO user2@localhost;
mysql>quit
now you can connect to database1 with user2 password2
mysql -uuser2 -ppassword2
or
mysql -uuser2 -p <enter>
<enter password when prompted>
I would guess that your app will create the appropriate tables when you connect as that seems to be typical and better than the app requiring mysql root access to create the database in the first place.
good luck and RTFM at
hxxp://dev.mysql.com/doc/refman/5.1/en/tutorial.html
MySQL :: MySQL 5.1 Reference Manual :: 3 Tutorial
- 10-23-2009 #3Just Joined!
- Join Date
- Aug 2009
- Posts
- 80
Since I'm newbie, I don't want to take the risk of using commands and creating db and tables.
How can I install and use phpmyadmin tool. Which I feel a bit easier that command-line.
Help me!


Reply With Quote