MySQL

With XAMPP, permission denied for MySQL user with % (all) host access but works for localhost

Key words and phrases: 
Drupal development environment localhost User 'jonasconstructio'@'localhost' : Edit Privileges @% @localhost at percent all hosts
Description & Info: 

For reasons not known to man nor beast, on XAMPP on Mac OS X (and not XAMP but another all in one WAMP stack, but not that name either) will not work with the wildcard availability host name (%). It will work (or anyhow may work for you, it worked for Agaric!) with the @localhost for host name.

In a shell script, create a database if it does not exist

Key words and phrases: 
mysql create database from bash script mysql if database exists automate creation of database if it doesn't already exist PHP script bash script if mysql database does not exist create
Description & Info: 

Use the MySQL: SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'database_name'

<?php
if (mysql_num_rows(mysql_query("SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '". $dbname ."'"))) {
echo "Database $dbname already exists.";
}
else {
// go on and create the user, database, etc.
// create the user

by Benjamin Melançon
Posted on Tue, 2008-07-01 08:16
in

Setting up MAMP to work for the same scripts we use on the Debian server

Key words and phrases: 
phpMyAdmin change password using MySQL command line interface on a Mac MAMP CLI mysql paths Macintosh OS X MAMP path to mysql command line Can't connect to local MySQL server through socket '/var/mysql/mysql.sock mamp
Description & Info: 

I changed the mysql root password through phpMyAdmin... and promptly lost the connection– no! The password also has to be changed in MAMP's phpMyAdmin configuration file.

vi /Applications/MAMP/bin/phpMyAdmin/config.inc.php

$cfg['Servers'][$i]['password']      = 'changedpass';          // MySQL password (only needed

by Benjamin Melançon
Posted on Mon, 2008-04-21 21:47
in