After installation =========== Starting a windows MySQL server for the first time ============================== go to dos environment for Windows NT, 2000, or XP ------------------------- cd c:\mysql\bin mysqld --install ## for win98 only type... mysqld ##no --install net start mysql ## for win 98, do not type this line, do not need to start service ------------------------ A running MySQL server uses a lot of system resources. You may check the resources used under windows task manager. To stop the MySQL server servie and COMPLETELY remove the MySQL server. go to dos environment ------------------------------------- cd c:\mysql\bin net stop mysql mysqld --remove go to control panel, remove program MySQL go to c:\WinNT\, remove my.ini remove c:\mysql\ folder ------------------------------------- ------------------------------------- To stop MySQL server from starting up when you start Windows... (for home PCs) go to Control panel => Administrative Tools => Services, change MySQL to manual ------------------------------------ ---------------------------------------- Using SQL databases ================ Go to the “bin” directory of your MySQL installation Ex: cd C:\mysql\bin Type mysql Type exit; Examples ===================================== mysql> SELECT VERSION(), CURRENT_DATE; mysql> SHOW DATABASES; +----------+ | Database | +----------+ | mysql | | test | | tmp | +----------+ mysql> USE test Database changed mysql> CREATE DATABASE menagerie; mysql> USE menagerie Database changed mysql> SHOW TABLES; Empty set (0.00 sec) mysql> CREATE TABLE pet (name VARCHAR(20), owner VARCHAR(20)); mysql> SHOW TABLES; +---------------------+ | Tables in menagerie | +---------------------+ | pet | +---------------------+ mysql> DESCRIBE pet; mysql> LOAD DATA LOCAL INFILE "c:/temp/pet.txt" INTO TABLE pet; (content of pet.txt: use Tab and return keys) Whistler Gwen Slim Benny mysql> select * from pet; mysql> INSERT INTO pet -> VALUES ('Puffball','Diane'); mysql> select * from pet; mysql> SELECT name FROM pet; mysql> SELECT * FROM pet WHERE name = "Slim"; mysql> SELECT * FROM pet ORDER BY name; mysql> SELECT * FROM pet ORDER BY name desc; mysql> DROP TABLE pet; Find out about users in MYSQL ========================================= mysql> show databases; mysql> use mysql mysql> show tables; mysql> describe user; mysql> select user, password from user; Change root password (do not do this for school PC) ===================== shell> mysql -u root mysql mysql> SET PASSWORD FOR root@localhost=PASSWORD('new_password'); or shell> mysql -u root mysql mysql> UPDATE user SET Password=PASSWORD('new_password') -> WHERE user='root'; mysql> FLUSH PRIVILEGES; Login as root and create user ===================== shell> mysql -u root mysql mysql> GRANT ALL PRIVILEGES ON *.* TO monty@localhost -> IDENTIFIED BY 'some_pass' WITH GRANT OPTION; Note ==== User names, as used by MySQL for authentication purposes, have nothing to do with Unix user names (login names) or Windows user names. Most MySQL clients by default try to log in using the current Unix user name as the MySQL user name, but that is for convenience only. Client programs allow a different name to be specified with the -u or --user options. This means that you can't make a database secure in any way unless all MySQL user names have passwords. Anyone may attempt to connect to the server using any name, and they will succeed if they specify any name that doesn't have a password.