Main stuff
Home
Announcements
Bookmarks
Contact me
GTA
Warcraft 2
WebRings
School stuff
Prom 2001
Randomness
Amazon WishList
Chainmail
Jokes
Tech Support
The end
Virus Warnings
Life stuff
Life Instructions
Meangingful Quotes
Friends?
Emotions?
Meanging of life
Site stuff
The MailBag
Links
Add Link
Disclaimer
Tech stuff
HTML tutorial
Installing Apache
Installing MySQL
Installing PHP
Website password protection |
|
|
MySQL, what is it?
It's a server-side database, essentially. It's one of the most widely used of the SQL's, and that's probabily because it's one of the best
It's a rather advanced SQL, too. You can store all kinds of things in a MySQL database, be it numbers (All kinds, and can be specific sets - Integers, real numbers, etc etc), binary data (e.g. graphics) or, well, anything, really
So, if you're sick of using flat-file databases, although they have their uses, they are somewhat limited. Why not leap into the wonderful world of MySQL
As you may or may not know, this tutorial's for the Windows version of MySQL. Currently, I don't have a Linux box to use that version of MySQL. The only difference is the installation, the interaction with the actual SQL server is exactaly the same
First off, you'll need the actual server, no?
Currently (As of 18/12/00) the latest windows version is 3.23.22b
If you want to compile your own server (Beyond the scope of this tutorial), you can download the source for MySQL
If you don't have the knowledge or inclination for doing that, you can download a pre-compiled binary
This document makes several assumptions, and maybe more which I've forgotten
I assume you have downloaded and installed Apache
I assume you have downloaded and installed PHP
I assume you have some basic understanding of PHP, nothing amazing. Just understanding how to do simple stuff (E.G. Feedback forms)
I assume you have some basic understanding of what a database is
I assume you want to use MySQL as your SQL server :o)
Maybe I should've written a PHP tutorial first. But, well, I write about things that interest me at the particular time I'm writing. At the present moment in time, PHP's boring
So, download (Compile if needed) and install MySQL. Don't be scared, it comes with a nice little install routine
When you get the option to do so, chose to go for a custom install. Make sure you install everything (Program files, Help files, Benchmark files, Privilige tables, Libs & include files)
In less time than it takes to eat a horse, MySQL will be installed. So, find it (You told the install program where to install, I used e:\servers\mysql)
Find the program winmysqladmin.exe and run it (Double click on it, kids)
Given a second, MySQL will be running.
Choose a username and a password, and click "Ok"
Click the traffic lights (In the systray) once, with the left mouse button. And, then click "Show me" from the pop-up menu
Click the "my.ini Setup" tab
The contents of my.ini should read something like
----- BEGIN -----
#This File was made using the Winmysqladmin 1.0 Tool
#18/12/2000 21:13:58
#Uncomment or Add only the keys that you know how works.
#Read the MySQL Manual for instructions
[mysqld]
basedir=c:/mysq
#bind-address=10.0.0.11
#datadir=c:/mysql/data
#language=c:/mysql/share/your language directory
#delay-key-write-for-all-tables
#log-long-format
#slow query log=#
#tmpdir=#
#ansi
#new
#port=3306
#safe
#skip-name-resolve
#skip-networking
#skip-new
#skip-host-cache
#set-variable = key_buffer=16M
#set-variable = max_allowed_packet=1M
#set-variable = thread_stack=128K
#set-variable = flush_time=1800
[mysqldump]
#quick
#set-variable = max_allowed_packet=16M
[mysql]
#no-auto-rehash
[isamchk]
#set-variable= key=16M
[Winmysqladmin]
Server=c:/mysql/bin/mysqld-opt.exe
user=benquick
password=benquick
----- END -----
Where username and password are chosen by yourself earlyer. I chose username & password = benquick
You may want to change the following lines, to suit (Uncommenting them first)
basedir=e:/servers/mysq
datadir=e:/servers/mysql/data
port=3306
Server=e:/servers/mysql/bin/mysqld-opt.exe
Hopefully, you'll have noticed a few lines begenning with a #, that's a comment, meaning it has no effect on the running of the server. If you write things in perl, you'll know about comments put this way. There are, of course, other ways to comment in other languages. But, that's not important
Obv, if this was a production server, or a server that was accessable by anyone other than myself, then the username and password would be both different, and better. But that's by the way
So, MySQL's installed. Great!
What next?
Well, interaction with the server will be a little hard, if it's not actually running. See, so far, you've only been setting the server up, it's not actually running
But you said "Find the program winmysqladmin.exe and run it (Double click on it, kids) Given a second, MySQL will be running."
True, I did. Maybe I lied a little bit. The frontend for MySQL was running, not the server itself. Don't worry, starting the server is no more painful than a couple of clicks
Hopefully, you'll see a bit on the MySQL window that says "Right Click for Menu Options" (It's the top-right of the window). Well, right click there, y'know, for the menu options
Click the Win9x (WinNT, if that's what floats your boat) heading, then click "Start server"
You'll be prompted "Start the MySQL server?"
Well, duh! Click yes...
A dos box will appear, ignore it. But do nothing to it. That's the server starting.
NOTE: If you have a firewall installed, it'll most likely cry about now. Let MySQL have the access it requires
- If you don't have a firewall, or don't know what one is, ignore this little snippet
Lets see if we can play with MySQL then, yeah. Goto the /bin/ directory within the mysql directory (In my case, it's at E:\servers\mysql\bin) and hopefully, you'll see mysql.exe
Right, now goto a MS-DOS prompt, navigate to the /bin/ directory
C:\WINDOWS>e:
E:\>cd\servers\mysql\bin
And type, mysql -h localhost
Hopefully, you'll see something like
E:\servers\mysql\bin>mysql -h localhost
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 3.23.22-beta
Type 'help' for help.
mysql>
Enter this to the MySQL prompt mysql> SELECT VERSION(), CURRENT_DATE;
Press return, and look at the results. Do you see: -
mysql> SELECT VERSION(), CURRENT_DATE;
+--------------+--------------+
| VERSION() | CURRENT_DATE |
+--------------+--------------+
| 3.23.22-beta | 2000-12-18 |
+--------------+--------------+
1 row in set (1.48 sec)
mysql>
Aww, ain't that nice?
MySQL WORKS!
|
|