As a quick way to test learning concepts and practice php/mysql/apache examples, I chose The Uniform Server (a WAMP one, where w is for windows).
It is small in size (about 10MB) and may be run from a USB stick (i.e. it is portable).
On the project's page, the authors claimed that it is secure enough and (provided the users set the relevant passwords etc. as they would on a production environment), it was actualy ready for production. I considered several other alternatives, among which XAMPP, but which, its aughtors admit, is not suitable for production.
It runs in the tray: if clicked with the RIGHT button, it offers the option to be run as a service. If LEFT is clicked - it offers to run as a regular program.
Almost all of the options that may be reached via localhost/apanel may also be reached from the tray menu.
It has phpMyAdmin, but the full power of mysql (i understand) can only be accessed thtough the command line.
Thus some modifications have to be made:
* find and copy the path to the /bin directory and add it to Win's environment variables (PATH) (win+pause break), using a ; to separate it from the rest of the PATHs.
C:\1PROG\WAMP\UniServer\UniServer\usr\local\mysql\bin
* I created a shortcut to cmd.exe, that started in the directory I wanted (edit the shortcut) and reseized the window (right click, properties on the shortcut -> layout, select at both places 170x80 for example).
The binaries of various CMSs may be put here:
C:\1PROG\WAMP\UniServer\UniServer\www
I did so wit Q2A and worked beautifully.
I am also learning from Lynda.com's mysql video tutorial: "The command line client that comes with mysql is able to access all the featuresof mysql in all variations - to be able to tap into its power; no graphical interface can do it"
show databases ;
shows the databases
root user in mysql:
special superuser ROOT; by defaul the ROOT user is installed w/o a password (fix it in production)
IMPORTANT: THERE ARE USUALLY 2 ROOT USERS (MAY BE MORE) AND YOU HAVE TO UPDATE ALL OF THEM.
mysql -u root
mysql stores it in a db called mysql in a table called user:
UPDATE mysql.user SET Password = PASSWORD('foo.bar') WHERE User = 'root' ;
Query ok, 2 rows updated (BECAUSE THERE ARE 2 ROOTS ON THE PARTICULAR SYSTEM)
FLUSH PRIVILEGES - to refresh
mysql -u root -p
with this command we tell it to ask for ask for password and then execute what we told it.
think of the users as for roles.
users are differentiated by username AND hostname.
we create 2 users - 1 for web work and 1 for administrative work:
CREATE USER web@localhost ;
CREATE USER admin@localhost ;
web - everyth except admini
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, FILE, INDEX, ALTER, CREATE TEMPORARY TABLES, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EXECUTE ON *.* web@localhost ;
these privileges can be used on all the tables on ALL DATABASES (*.*)
__________
privileges to admin users:
GRANT ALL ON *.* TO admin@localhost WITH GRANT OPTION
FLUSH PRIVILEGES
______________________
then we assign passwords:
UPDATE mysql.user SET PASSWORD = PASSWORD('foo.web') WHERE User = 'web'
UPDATE mysql.user SET PASSWORD = PASSWORD('foo.admin') WHERE User = 'admin'
FLUSH PRIVILEGES
good thing: test thiongs wo paswords to see if working
mysql -u admin -p (doesn't work w/o the -p)
_________________
IMPORTING
album-mysql.slq
test-mysql.slq
world-mysql.slq
these populate the daabase with the data
>>> mysql-u admin -p < album-mysql.slq
this < is the PIPE character that reads data from the file. then it asks us for password and then populates the db without returning to us any comments;
mysql> use test ;
this tells it that from now on we work in the test database.
show tables ;
the ; terminates a command
use album ;
database changed
show tables
use world ;
show tables ;
select sount(*) from city
returns the number of records.
now we kniw how to import date - very simple with very little typing.
______________________
tables are contained in a database
CREATE DATABASE sales
____________________
SHOW DATABASES
to see the dbs available
__________________
DROP dbase1 - IT ERASES IT FOREVER, does not ask for confirmation, very dangerous
______________
a table definition contains all the