Posts

Showing posts with the label mysql

Command line sql database setup.

Image
This is just enough to hang yourself with. #========================================================================== # pseudo-code or generic instructions to set up a lamp web server apps on # Debian based lamp servers you will have to modify it to your needs. # this is assuming a lamp server is already properly set up. # Setup is another discussion. # all rights unreserved by the unknown admin #************************************************************************** # Get file from internet chances are you visited the sit and have the # location of the file to be downloaded. # use Curl for a directory or wget for a single file. use the man pages for # additional instructions wget $website/$subdirectory/$filename # Extract the file in the home directory (not the destination filename for use # in the next step. tar zxvf filename.tar.gz # move the directory into the web document root for use with http # webappdirectory will become webappname sudo...

Experimental mysql database setup scripts.

Image
Some experimental mysql database setup scripts. ( USE AT YOUR OWN RISK !) Original script: #!/bin/bash EXPECTED_ARGS=3 E_BADARGS=65 MYSQL=`which mysql` #Danger do not use GRANT ALL ON *.* Q1="CREATE DATABASE IF NOT EXISTS $1;" Q2="GRANT ALL ON *.* TO '$2'@'localhost' IDENTIFIED BY '$3';" Q3="FLUSH PRIVILEGES;" SQL="${Q1}${Q2}${Q3}" if [ $# -ne $EXPECTED_ARGS ] then echo "Usage: $0 dbname dbuser dbpass" exit $E_BADARGS fi $MYSQL -uroot -p -e "$SQL" To use it, just run: ./createdb testdb testuser secretpass Someone's modified script: #!/bin/bash BTICK=’`’ EXPECTED_ARGS=3 E_BADARGS=65 MYSQL=`which mysql` Q1=”CREATE DATABASE IF NOT EXISTS ${BTICK}$1${BTICK};” Q2=”GRANT ALL ON ${BTICK}$1${BTICK}.* TO ‘$2’@’localhost’ IDENTIFIED BY ‘$3′;” Q3=”FLUSH PRIVILEGES;” SQL=”${Q1}${Q2}${Q3}” if [ $# -ne $EXPECTED_ARGS ] then echo “Usage: $0 dbname dbuser dbpass” exit $E_BADARG...