# MySQL Installation Bits This is not meant to be used outside the context of the Catalyst MySQL Installation Workshop. ## How to Use these Commands: 1. Highlight all of the text with your fancy, space-age mouse, 2. Copy (*Control+C*), and 3. In PuTTY, simply right-click (note that *Control+V* does **not** paste in PuTTY). ## The Commands * **Start the BaSH Shell** bash * **Enable colors and "nice" paths on the command line**: wget http://uwwebpub.com/tools/bash_profile.sh \ && cat bash_profile.sh >> ~/.bash_profile \ && rm bash_profile.sh \ && source ~/.bash_profile * **Set-up and run UWTechnology's MySQL Binary:** wget http://uwwebpub.com/tools/{config,protect,cmds,install}.sh \ && chmod u+x ./{config,protect,cmds,install}.sh \ && ./install.sh * **Starting Over** This is pretty drastic: you will lose any data you have in your databases! This will ask for your MySQL Password. /usr/local/mysql/bin/mysqladmin -u root -p shutdown \ && rm ~/.my.cnf \ && rm -rf ~/mysql-data \ && rm -rf ~/mysql_install_logs \ && rm -rf ~/connect.php * **Killing it** This is the most drastic: it stops MySQL dead in its tracks. This is almost guaranteed to corrupt your data (although it may not). You should only use this if you've forgotten your MySQL password. kill -9 `ps ux | grep mysql | cut -f2 -d' ' | egrep '[0-9]+'` ## Installing Software This is the very generalized procedure for installing database-driven webapps into a UW staff UA computer account. 1. Find the URL of the **.tar.gz** file you want to download. **.zip** files fine too. 2. Run cd $HOME/public_html wget http://your-url.com/path/file-1.2.tar.gz 3. Run tar zxf file-1.2.tar.gz or unzip file-1.2.zip 4. Create the symbolic link in the manner of ln -s file-1.2 file 5. Navigate to and follow the instructions. 6. Navigate to to create a database if you need to. ## Some Useful *NIX Commands (Also see the [Unix Curriculum][unix]). [unix]:http://catalyst.washington.edu/help/computing_fundamentals/unix * `pwd` prints the working directory * `cat FILE` shows the contents of `FILE` all at once * `less FILE` shows a file screen-by-screen (press `q` to exit.) * `pico FILE` opens the UW Pico basic text editor to edit (or create) `FILE` (Control+O to save; Control+X to exit) * `mkdir DIR` creates a directory `DIR` inside the working directory. * `mv OLD NEW` moves (or renames) the file `OLD` to `NEW` * `ln -s LONG SHORT` creates a shortcut (symbolic link) to `LONG` at `SHORT` * `cd DIR` changes working directory to `DIR` * `cd` (without a `DIR`) changes working directory to home (a/k/a `~`) * `ls` lists the contents of the current directory * `rm -r F` (recursively) delete the file (or folder) `F` * `wget URL` downloads the file at `URL` to the working directory * `tar xzf FILE` unzips a tar.gz or .tgz file called `FILE` * `chmod 755 FILE` makes `FILE` writable by the web server (and visible to everyone else!) * `/usr/local/mysql/bin/mysqladmin -u root -p shutdown` stops your MySQL server (this will ask for your MySQL password). * `/usr/local/mysql/bin/mysqld_safe &` starts your MySQL server if it's stopped * `/usr/local/mysql/bin/mysql -u root -p` allows you to interface directly with the server (*Control+D* or *Control+C* to exit; *Control+G* if you you're stuck in the prompt) * `/usr/local/mysql/bin/mysql -u root -p < FILE` allows you to send the contents of `FILE` directly to the MySQL server (some installation scripts will give you an SQL file to run.) * `cd; protect.sh public_html/DIR USER1 USER2 USER3` allows you to limit access to `DIR` (within your public_html directory) to only users with UWNetID `USER1`, `USER2`, etc. - - - Author: Ryan Timmons Last Modified: 06 August 2008 15:23:13 PDT URL: Also see the HTML version by changing the file extension to `.html`.