Forum Moderators: mack

Message Too Old, No Replies

MySQL Beginner

How to use it.

         

Mr_Brutal

8:46 pm on Dec 15, 2003 (gmt 0)

10+ Year Member



Hi,

I am just about to start a small database driven site that I was going to create in Access. However due to most posts on the subject here i've been convinced i should be using MySQL. Idownloaded a recent version and installed it on my XP pc and it starts correctly and is probably running OK but i'm finding it difficult to use it. I wanted to just use a connection in a page like (not ODBC)

set conntemp=server.createobject("adodb.connection")
dbname="database.mdb"
myconnect="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="
myconnect=myconnect & server.mappath(dbname)& ";"
conntemp.Open myconnect
sqltemp="select * etc"

which works fine for my Access based intranet sites but i'm thinking that i can't do this for my new site thats gonna be hosted by an ASP hosting company i've found.

Please excuse my naviety but i just wanted to upload a MySQL database file with my web pages and have it work. When you've all stopped laughing can you please tell me how i can use a MySQL database! I'm thinking i should stick to my Access design for now and maybe spend time learning about MySQL first before i go this way. Any links to simple guides would be appreciated. I have been through loads of sites looking for stuff but none of it is clicking with me.

Sorry for my waffley(?) style

Thanks in advance.

coho75

10:44 pm on Dec 15, 2003 (gmt 0)

10+ Year Member



What are you trying to do? Access the db from a webpage or populate the db? I use phpMyAdmin to access and populate my mySQL db. To access the db from a webpage I use php. I am not sure if this helps. Good luck!

griz_fan

11:11 pm on Dec 15, 2003 (gmt 0)

10+ Year Member



Hey Mr_Brutal,

In order to use MySQL, you'll need a web server running it, then you'll need to create a database and at least one database table. Once you get all that set up, then you'll want some sort of server-side scripting language to allow your web pages to interact with your MySQL stuff. The most commonly used server-side processing for MySQL is PHP, though PERL and ASP (and others) will work, too.
If you're coming from an ASP/Access background, it takes a different "mental" approach to MySQL.

with Access, you create your database on your own PC, then upload the single, self-contained file to your web host, then create a connection string in an ASP page to work with that database. With a more sophisticated database, such as MySQL, MS SQL Server, etc..., things are a bit more complex.
First, you need to make sure your web host supports MySQL. A few, but not many, ASP hosts support MySQL, most go with Access and/or MS SQL Server. If your host doesn't support MySQL, you'll either need to go with a new host, or a different database.
If your host does support MySQL, have your host create a database for you. I'm not sure what ASP tools (if any) are available that will allow you to manipulate a MySQL database. Normally, you can create tables, etc... either by using the command line (if you can access to the command line on your server), or through a web-based database admin tool (PHPmyAdmin is really slick).

Unfortunately, while technically possible to use ASP with a MySQL database, in practice its a tall order, especially on a shared hosting environment. PHP is a much better fit. So, if you're really set on using ASP, but want a more robust database than Access, I'd recomend going with Microsoft SQL Server. Most ASP hosts should have online tools to help you manage the database, and there are plenty of how-to guides available for ASP and MS SQL server. Downside is that MS SQL Server costs extra $$$. If you don't expect much traffic to the database driven pages on your site, you can get away with using ASP and Access. Access was never intended to be a database server and can have problems when more than a handful of users are connected. I run a low-traffic site (50-60 visitors a day) using ASP and Access with few if any problems. I do have to keep search engine spiders away from the Access driven pages, though. I also have a higher-traffic site (aprox 300 visitors/day) running PHP and MySQL.

If you haven't committed to a hosting company yet, and aren't married to ASP, I'd recomend looking into PHP and MySQL. I've used both, and I've found the PHP/MySQL combo more robust and actually a bit easier than ASP (paired with either Access or MS SQL). Just my $0.02, but I think it would be worth your time to investigate all your options.

Mr_Brutal

8:35 am on Dec 16, 2003 (gmt 0)

10+ Year Member



Cheers Griz_fan i think i knew what you've stated but hoped it wasn't true.

I will be using a shared host so haven't got much access to the server it will be on really. I agree that i'll definately have to migrate to php and MySQL in the future but for now i think i'll stick with Access as it will be quicker for this project.

spud01

10:06 am on Dec 16, 2003 (gmt 0)

10+ Year Member



Hi I also like to have MySQL running on a NT4/NT5 test Webserver with php running too, but I find it difficult to get all these components working together.

Apparently IIS makes life really complicated and having Apache as the webserver is the ideal scenario.

I like to stick to IIS coz I'm very familiar with and get MySQL/PHP working along side.

Is this an impossible task?

Is there any good guide I can read up on?

Thx

griz_fan

4:32 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



Hi spud01,

For the most part, it is pretty easy to have both IIS and Apache running on the same Windows system (much easier with Win2k, NT4 or XP, than win9x though). I have two personal/hobby websites, one done in ASP with Access, the other with PHP and MySQL. On my home system, I have XP pro with IIS set up. I then installed an Apache/PHP/MySQL/Perl install kit. Check out HotScripts.com for the latest. I'm currently using Apache2Triad, which works great.

The only caveat is that both IIS and Apache will want to listen to port 80 for HTTP requests, so I simply stop IIS when I want to do Apache/PHP, or vise versa for IIS/ASP. Also, before installing Apache, PHP, et al, be sure to stop IIS to ensure a smooth install.

It is also possible to run PHP under IIS, but I thought that might get a bit complex. Besides, my web host runs PHP under Apache, and I want to come as close as possible to reproducing my hosting environment. But, it certainly is possible to have PHP and MySQL available under IIS. The official web sites for PHP and MySQL should have plenty of documentation and guides for doing this.