Important! - For users of the ovid systems: those servers are in a cluster, so please be sure to log into the correct ovid server before using the following instructions.
~/mysql/bin/mysqladmin -u root -p status
Uptime: 4 Threads: 1 Questions: 62 Slow queries: 0 Opens: 51 Flush tables: 1 Open tables: 45 Queries per second avg: 15.500If 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)
~/mysql/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).~/mysql/bin/mysqld_safe &
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. PID's are in bold text.
$ 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
$ kill 18438 18463
$ 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
You can see in the output from the second run of ps uxw
that the MySQL processes are no longer running. Your MySQL server is currently off.~/mysql/bin/mysqld_safe --skip-grant-tables &
~/mysql/bin/mysql
UPDATE mysql.user SET Password=PASSWORD('put your password here') WHERE User='root';
mysql>EXIT;
~/mysql/bin/mysqladmin shutdown
~/mysql/bin/mysqld_safe &
~/mysql/bin/mysql -u root -p
select user,host from mysql.user;
use mysql;
delete from user where Host like "%";
grant all privileges on *.* to root@"%.uw.edu" identified by "mypassword" with grant option;
grant all privileges on *.* to root@"%.washington.edu" identified by "mypassword" with grant option;
grant all privileges on *.* to root@localhost identified by "mypassword" with grant option;
flush privileges;
Normally, you would have to start your MySQL server up again after the system it is running on is restarted. Cron is a program that can start it for you, so you don't have to log in and start it again before using your database after a system restart. In some cases, manual recovery may still be required. Important! - For users of the ovid systems: those servers are in a cluster, so please be sure to log into the correct ovid server before using the following instructions. Log into your web development server using a terminal emulator. If you're not sure how to do this, click here for instructions.
export EDITOR=/usr/local/bin/pico
crontab -e
@reboot /usr/local/bin/mysql.starter
crontab -l
crontab -r
These instructions will guide you through creating a simple and automated way to back up your database, where they will be copied to a backup file on disk that will be retrieved by UW-IT's nightly filesystem backups. This can be done without stopping the database, though tables will be locked while it completes. While the nightly filesystem backups create backup copies of your data files as well, it is not recommended to rely on these for consistent backups as the database files may be in an inconsistent state. This method avoids this pitfall by making an authoritative copy of your data. Warning: Using the backup method outlined below will create two additional copies of your database. If you have a large database, this could put your account over quota. Pay attention to how large your database is and how close your account is to its quota before using this method. | Manage Your Disk Space
mysql>Make sure to replace backup_password with a real password.grant SELECT, LOCK TABLES on *.* to backup@"localhost" identified by 'backup_password';
mysql>flush privileges;
mysql>quit;
mkdir ~/mysql_backup
mysql_backup.sh
script to run the backup by typing this command: wget https://it.uw.edu/mysql_backup.sh
chmod 700 ~/mysql_backup.sh
##### required configuration parameters ################# MYSQL_BACKUP_PASSWORD='BACKUP_PASSWORD' MYSQL_PORT='PORT' ###### end configuration -- see below for requirements ##Remember to substitute the real password for backup_password.
export EDITOR=pico;crontab -e
0 2 * * * ~/mysql_backup.sh