Posts

Showing posts with the label MySQL Administration

Start Your MySQL Server Automatically After a System Restart

Log into your mysql server If you are familiar with the text editor "vim" or "vi," go ahead to the next step. If not, type the following command. export EDITOR=/usr/local/bin/pico To add a cron job, type the following command: crontab -e Insert this line of text: @reboot /ux01/tools/mysql.starter Save and close the file using Pico.  (Click for instructions on how to use pico) . You can check the contents of your crontab by typing the following command: crontab -l If you ever want to delete all of your cron jobs, type the following command crontab -r

Resetting your MySQL Password

Use ps and kill to stop your MySQL server without having the password. Running ps uxw will list the processes running on your account, including their PID or Process ID. The kill command takes PIDs as arguments, and attempts to stop the processes those PIDs refer to. Below is an example of using ps and kill to stop your MySQL processes. $ ps uxw USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND netid 8977 0.0 0.0 10952 1620 ? S 14:16 0:00 sshd: netid@pts/51 netid 8978 0.0 0.0 5348 1748 pts/51 Ss+ 14:16 0:00 -psh netid 10539 0.0 0.0 5068 1256 pts/51 R+ 14:32 0:00 ps uxw netid 18438 0.0 0.0 4488 1188 ? S Nov09 0:00 /bin/sh bin/mysqld_safe netid 18463 0.0 0.0 15852 3848 ? S Nov09 0:00 /da23/d54/netid/mysql/bin/mysqld --basedir=/da23/d54/netid/mysql netid 18464 0.0 0.0 15852 3848 ? S Nov09 0:00 /da23/d54/netid/...

Stopping and Restarting Your MySQL Server

Stopping MySQL To stop your MySQL server, make sure you are in your mysql directory, and then type ./bin/mysqladmin -u root -p shutdown This lets the mysqladmin utility know that you want to shut down MySQL running as user root (-u root), and that you will enter a password (-p). Starting MySQL To start up your MySQL server again, connect to your MySQL host and then type cd ~/mysql ./bin/mysqld_safe &

Determine Whether Your MySQL Server Is Running

Log into your mysql server Switch to your into your mysql directory by typing the following command: cd mysql Type the following at the command line: ~/mysql/bin/mysqladmin -u root -p status Enter your root MySQL password in order to continue. If the results look something like the following output, MySQL is running properly: Uptime: 4 Threads: 1 Questions: 62 Slow queries: 0 Opens: 51 Flush tables: 1 Open tables: 45 Queries per second avg: 15.500 If the results look like the following output, MySQL is running properly, but you entered the incorrect password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) If the results look like the following output, MySQL is not running properly: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/path/to/sock/mysql.sock' (111)