The PHP MySQL mysql_connect() can't connect to local MySQL server through...
PHP MySQL socket error FAQ: I'm getting a MySQL error like "Warning: mysql_connect(): Can't connect to local MySQL server through socket '/home/lib/mysql/mysql.sock'" when trying to connect to my MySQL...
View ArticleThe PHP PDOException SQLSTATE MySQL can't connect socket error
PHP PDOException MySQL socket error FAQ: What is the PHP PDOException SQLSTATE MySQL socket error, and how do I fix the problem?Every time I work with a new web hosting company, I keep running into one...
View ArticleJava MySQL examples and tutorials
Today was mostly a day off for me, but I thought I'd do one thing here to help organize the website a little better. To that end, I've put together a list of the Java MySQL examples I've created, i.e.,...
View ArticleA Drupal PHP script to log database errors
I've been having some problems with a GoDaddy website lately (see my GoDaddy 4GH performance problems page, and in an effort to see if the errors were related to a MySQL database problem, I created the...
View ArticleHow to change a Drupal user password using mysql or phpmyadmin
Drupal FAQ: How can I change the password of a Drupal user in the database without using the Drupal UI? That is, how can I change a user's password using a database query (such as the need to change...
View ArticleA MySQL database backup shell script
MySQL database backup FAQ: Can you share a Linux shell script that I can use to make a MySQL backup?I currently have a collection of websites on several different servers (including GoDaddy and A2...
View ArticleMySQL show users - how to show the users in a MySQL database
MySQL users FAQ: How do I show MySQL users (How do I show user accounts I've created in a MySQL database)?To show/list the users in a MySQL database, first log into your MySQL server as an...
View ArticleA Scala JDBC connection and SQL SELECT example
Scala JDBC FAQ: How can I use the Java JDBC API in my Scala application?If you want to use a SQL database with your Scala applications, it's good to know you can still use the traditional Java JDBC...
View ArticleMySQL create database example - How to create a MySQL database and user...
MySQL "create database" FAQ: Can you share an example of how to create a MySQL database, including (a) creating the MySQL database and (b) a new MySQL database user, with all appropriate MySQL GRANT...
View ArticleMySQL restore - How to restore a MySQL database from a backup
MySQL database FAQ: How do I restore a MySQL backup? (Also written as, "How do I restore a MySQL database dump?")read more
View ArticleMySQL backup - How to backup a MySQL database
MySQL backup FAQ: How do I back up a MySQL database?I can't speak about backing up MySQL databases that are modified twenty-four hours a day seven days a week, but on all the MySQL databases I...
View ArticleA MySQL 'create table' syntax example
I used to use MySQL every day for years, but over the last two years I haven't used it much. Today I needed to create a MySQL database table, and had to wonder for a few moments what the MySQL CREATE...
View ArticleMySQL - Default a date (timestamp) field to now
MySQL DATE syntax FAQ: How do I set a MySQL DATE field to default to "now", i.e., the current time?MySQL default date now - SolutionUnfortunately you can't default a MySQL DATE field to "now", but you...
View ArticleMySQL show status - show open database connections
MySQL "show status" FAQ: Can you demonstrate how to use the MySQL show status command to show MySQL variables and MySQL status information, such as the number of open MySQL connections?I don't have a...
View ArticleMySQL syntax examples - create table, primary key, foreign key
Just a quick note here today that if you need some example MySQL database tables, you can use these. I created them for some experiments I ran last night. They show the MySQL create table, primary key,...
View Articlemysqldump error: 1044: Access denied for user ... when using LOCK TABLES
A quick note on a MySQL error: I got the following error when using mysqldump this past weekend:mysqldump: Got error: 1044: Access denied for user 'USER'@'localhost' to database 'DBNAME' when using...
View ArticleThe MySQL Sakila sample database
The MySQL “Sakila” sample database can be helpful when you want to test a new application framework, or write a blog post, or book.
View ArticleA Play Framework Anorm insert method that returns the database auto-insert ID
As a quick example, if you need to see some code for a Play FrameworkAnorm method that inserts an object into a relational database table and returns the auto-into (MySQL auto_increment) ID field on...
View ArticleHow to convert from a Scala BigDecimal to Java BigDecimal
Scala FAQ: How do I convert from a Scala BigDecimal instance to a Java BigDecimal?Call the bigDecimal method on your Scala BigDecimal instance, as shown in this example in the REPL:scala> val sb =...
View ArticleThe Play Framework, MySQL, currency, decimal fields, and BigDecimal types
I’m currently working on a Play Framework server-side application that handles money/currency. (The application UI uses Sencha ExtJS, but that doesn’t matter for this example.)From past experience I...
View Article