MySQL

In this article, let us review how to install MySQL on CentOS using yum. Instead of searching and installing mysql and related packages one-by-one, it is better to install MySQL using yum groups.
(more…)

{ 23 comments }

Photo courtesey: Jessica Finson

Photo courtesy: Jessica Finson

A while back we tried to customize unix prompt to look like Angelina Jolie.

Oh boy, didn’t I fail miserably in that attempt? Well, that didn’t stop me from trying an extreme makeover for mysql> prompt.

Let us face it. The following mysql> prompt is boring. Nobody wants to see it. Let us change the default mysql> prompt to something functional and useful.
(more…)

{ 6 comments }

Question: How do I disable mysql history? I don’t want mysql to remember the previous commands that I typed from the mysql> prompt. This is important for me, as when I type some sql commands that contains passwords, I see the clear text password stored in the ~/.mysql_history, which I don’t want to happen.

Answer: Bash history feature stores the Unix commands typed in the command line in the ~/.bash_history file. Similar to bash shell, mysql stores the commands typed in the mysql> prompt in the ~/.mysql_history file.

In this article, let us review how to disable mysql history.

(more…)

{ 3 comments }

Forgot MySQL Root Password – How To Reset It?

by Ramesh Natarajan on July 22, 2009

Recover MySQL Root Password on Ubuntu and DebianForgot your MySQL root user password? Don’t worry. We are here for rescue.

When you tried to login to root without entering a password, you may get ‘Access Denied’ message, as MySQL is expecting a password.

This article explains how to recover mysql root password by setting a new MySQL password when you don’t remember your old one.

(more…)

{ 13 comments }

MySQL LogoIn all the 15 mysqladmin command-line examples below, tmppassword is used as the MySQL root user password. Please change this to your MySQL root password.

1. How to change the MySQL root user password?

# mysqladmin -u root -ptmppassword password 'newpassword'

# mysql -u root -pnewpassword
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.1.25-rc-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

(more…)

{ 14 comments }

[MySQL Information Schema]Starting from MySQL 5, when you execute show databases command, information_schema will be listed in the database list. information_schema is a virtual MySQL database that stores metadata information of all the MySQL databases.

Typically you will execute either DESCRIBE or SHOW commands to get the metadata information. However using the information_schema views, you can execute the standard select SQL command to get the metadata information. In this article, let us review few practical examples on how to use the information_schema database.
(more…)

{ 7 comments }

[Bugzilla Logo]Bugzilla, an open source bug tracking system uses MySQL for the database. When you try to attach a document to the bug that is greater than 1MB in size, you will get the error message shown below. This article explains how to fix this problem by changing the MySQL max_allowed_packet database parameter and bugzilla maxattachmentsize parameter.
 
When a MySQL client or the mysqld server receives a packet bigger than max_allowed_packet bytes, it issues a Packet too large error and closes the connection.
 
MySQL client’s default max_allowed_packet value is 16MB. MySQL server’s default max_allowed_packet is 1MB. For bugzilla attachment, we need to increase the max_allowed_packet size of the MySQL server.
(more…)

{ 0 comments }

How To Upload Data to MySQL tables using mysqlimport

by Ramesh Natarajan on October 14, 2008

MySQL LogoUploading several rows of data from a text, csv, and excel file into a MySQL table is a routine task for sysadmins and DBAs who are managing MySQL database. This article explains 4 practical examples on how to import data from a file to MySQL table using both mysqlimport and “load data local infile” method. Instead of importing data, if you want to backup and restore MySQL database, please use mysqldump or mysqlhotcopy.
(more…)

{ 3 comments }