New Mysql Database (and user)

Alrighty, it's an easy one, but I keep going astray. So here's how to set up a new MySQL database and add a user while at it. All at the command line, of course.

$ mysql -u ''adminusername'' -p

mysql> CREATE DATABASE ''databasename''; 
mysql> GRANT ALL PRIVILEGES ON ''databasename''.* TO "''username''"@"''hostname''" IDENTIFIED BY "''password''";
mysql> FLUSH PRIVILEGES;
mysql> EXIT

 

Pack it up, dude

Okay, I just realized that giving instructions on how to unpack archives is neat - but about creating tar.gz archives?

Easy: Just use

tar -cvpzf <output filename> <directory>

this means: -c = create new archive -v = be verbose

-p = preserver permissions -z = compress using gzip -f = filename to create for the new archive for the directory dont to "directory/*" just to "directory" with no slash filenames should end in ".tar.gz" as they are tarr'ed then zipped

Unpack that stuff

Well, well, the old lady let you move back in, did she? Time to unpack your bags, then.

In case you happen to be a Linux or Unix server, that might be a bit of an issue. Sure, we all know what to do with zip files in Windows - but what about them tar or gz files? No worries - Bubba to the Rescue.

Here's what you do:

To unpack a tar.gz file, you can use the tar command from the shell. Here's an example:

tar -xzf bubba.tar.gz

The result will be a new directory containing the files.

Of course, this was the way we did things back then in the old days. Nowadays, when you download the tar.gz from a web browser, a lot of times an unpacker will open - and you can just use that. But that's for whimps. Or Yankees. Or both.

For just .gz (.gzip)

In some cases the file is just a gzip format, not tar. Then you can use:

gunzip bubba.gz