Posts with the tag SQL

Change MySQL password on the terminal

Here is how change the root password of MySQL on Ubuntu or Debian:

/etc/init.d/mysql stop
mysqld_safe --skip-grant-tables
echo "use mysql; update user set password=PASSWORD('newpass') where User='root'; flush privileges;" | mysql -u root -p
## this doesn't work in 'skip-grant-tables' mode:
#echo "SET PASSWORD FOR 'root' = PASSWORD('newpass');" |...

Read on

SQL

http://en.wikipedia.org/wiki/SQL

search using SQL

SELECT * from bash_history where  command LIKE '%modprobe%'

% is the wildcard character in SQL!

SQlite specifics

http://www.sqlite.org/lang.html

...

Read on

Database abstraction with Python: SQLAlchemy

The SQLAlchemy SQL Toolkit and Object Relational Mapper is a comprehensive set of tools for working with databases and Python. It has several distinct areas of functionality which can be used individually or combined together. Its major API components, all public-facing, are illustrated below:

+-----------------------------------------------------------+
|    ...

Read on

SQLite

http://www.sqlite.org/

Important Notes

Omitted SQL Language Features
http://www.sqlite.org/omitted.html

SQLite Keywords
http://www.sqlite.org/lang_keywords.html
you cannot choose table names from the keywords list!!!

enforce foreign keys
SQLite Foreign Key Trigger Generator: http://www.rcs-comp.com/site/index.php/view/Utilities-SQLite_foreign_key_trigger_generator
http://glossar.hs-augsburg.de/SQLite_Foreign_Keys_erzwingen
http://sqlzoo.net/howto/source/u.cgi/tip241028/sqlite

Jump Start

SQLite with Python

http://docs.python.org/library/sqlite3.html
http://www.wdvl.com/Authoring/python/SQLite/Watts07162009.html

Admin tools / GUIs

SQLiteStudio

http://sqlitestudio.one.pl/

Open Source, cross platform!

SQLite Database Browser

http://sqlitebrowser.sourceforge.net/

sudo apt-get install sqlitebrowser

Sqliteman

http://sqliteman.com/

sudo...

Read on

Convert Certain Tags to Categories / Delete Certain Tags using SQL

ATTENTION! Do not follow this advice! It is of no use, now that I found the converter for Tags ↔ Categories: Categories to Tags Converter Importer!!!

Sometimes you give posts a tag but realize later it should rather be a category.

What you can do to convert a certain tag –...

Read on

Change the date of WordPress posts in an SQL Mass Update

When I programatically added most of the blog posts in this blog, I forgot to adjust the date and time of each post to its actual age. So I decided to set it via SQL directly in the database.

First I worked out a SELECT query to filter all the entries...

Read on