Posts Categorized: mysql

Password-less Login to the MySQL Command Line

The goal here was to be able to log in to the MySQL command prompt be simply typing

rather than:

This is particularly useful for automation of routine backups etc. mysql_config_editor The command mysql_config_editor has several options (e.g. add, remove, print) for managing encrypted passwords. To create a new login

It is… Read more »

Connecting in to Docker MySQL Instance

Just recording a few of these steps for future reference. Pull the MySQL image from the hub:

Run an instance:

Run a shell on the instance:

Once inside the instance use the MySQL client:

and create a new user:

Quit the MySQL client and exit the instance. From the host… Read more »

MySQL GRANT SELECT on a demo database to all users

MySQL access to all users

I needed to give all students read access to a demo database and did so with: mysql> GRANT SELECT ON gameofthrones.* TO ”@localhost; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01 sec)    

MySQL dummy placeholder RPM package for MariaDB

On CentOS 7 MariaDB has (quite rightfully IMHO) replaced MySQL in the repositories however this has caused me a few problems. Since MySQL was so widely used there are other things that have MySQL as a requirement/dependency. Mainly my problem was some puppet modules that wanted the mysql-server package installed before they would proceed with… Read more »

MySQL: Give a User Grant Permissions

I needed to create a new MySQL user that would be able to create new users itself and grant permissions to the accounts that it creates. To do so I used the following:


Beginning PostgreSQL

As a MySQL user for a number of years I needed a translation tutorial from MySQL to PostgreSQL. So to get started on CentOS: Installation yum install postgresql-server If you also want the phpPgAdmin WUI: yum install phpPgAdmin php-pgsql httpd Create the configuration file and initialise the database: cp /usr/share/pgsql/postgresql.conf.sample /var/lib/pgsql/data/postgresql.conf /etc/init.d/postgresql initdb Make changes… Read more »

LAMP Performance

The following scripts can help in determining good values for Apache and MySQL configurations based on the amount of memory available: MySQL Tuner Apache Tuner Apache Buddy The following will giveĀ  a list of Apache Modules loaded: apachectl -t -D DUMP_MODULES The following will give the memory usage of Apache: #!/bin/sh # # Calculate… Read more »

LAMP on Ubuntu

There are several different commands that can be used to install Apache and MySQL services with PHP support: sudo apt-get install tasksel && sudo tasksel sudo apt-get install lamp-server^ sudo apt-get install apache2 libapache2-mod-php5 php5 php5-cli php5-mysql php5-gd php5-mcrypt php5-curl mysql-client mysql-server libmysqlclient15-dev phpmyadmin   For number two the carat at the end is important.

MySQL Proxy

Today I wanted to create a straight-forward MySQL Proxy service which would forward MySQL queries from a development machine to another live server which was running MySQL. The aim was to allow people on the development machine to use the same connection string as on the live server, specifying the MySQL host as localhost but… Read more »

MySQL query output to text or CSV

I needed to output the results of a MySQL query today for further analysis and found the answer here. For future reference… SELECT * FROM errors WHERE mailfrom LIKE ‘a.n.other%’ INTO OUTFILE ‘/tmp/a.n.other.txt’ FIELDS TERMINATED BY ‘,’ LINES TERMINATED BY ‘\n’; It is also possible to enclose the fields with quotes using: ENCLOSED BY ‘”‘