MySQL is one of my favorite databases to work with. It has it's limitations but overall it is a pretty well rounded system for the money. I particularly like to code stored procedures in MySQL. It is more like a program that a stored proc.
Starting an Stopping...
To start, stop and restart MySQL on Linux use these commands
...Windows is different. There are two seperate files to use. mysqld and mysqladmin. To start use:
patsh_to_mysql]/bin/mysqld i.e. C:/Program Files/MySQL/MySQL Server 5.0/bin/mysqld
...to stop use:
[path_to_mysql]/bin/mysqladmin shutdown i.e. C:/Program Files/MySQL/MySQL Server 5.0/bin/mysqladmin shutdown
To find out what port MySQL is running on, from the server use this:
netstat -an | grep -i mysql
Or look in the /etc/mysql/my.cnf for this section...
[client] port = 3306 socket = /var/run/mysqld/mysqld.sock
Connecting... or not?
To connect to MySQL... not that hard...
mysql -u [username] -p
Better not to add the password here. Let MySQL Prompt for it. If it is added on the command line it's not encrypted. If MySQL prompts for it, it is.
Can't connect remotely? Check the config file in /etc/mysql/my.cnf. Look for the BIND_ADDRESS, if it is 127.0.0.1 -> change it to the machine address.
Connecting to a Remote...
Connecting to a remote server with MySQL...
mysql --h [host | IP] -u [username] --password=[passowrd] [database] OR mysql --host=[host | IP] --user=[username] --password=[passowrd] [database]
mysql --host=188.8.131.52 --user=kennyl --password=apassword BW OR mysql --host=savage --user=kennyl --password=apassword BW OR mysql -host savage -u kennyl -p
It is best to just use -p with no password. MySQL will prompt you for the password and encrypt it as it is typed. If a password must be used, there should be no space between --password= and the actual password.
Note: when creating passwords they are actually logged in a file called .mysql_history in the home directory. It is a good idea to keep track of this file. I delete the file on logout.
in plain test