Mysql Problem, Operating system error number 13 in a file operation

Posted by cikul | Posted in Linux, SQL | Posted on 31-07-2017-05-2008


Mysql Fail to start, check in /var/log/mysqld.log :

170731 16:56:50 InnoDB: Initializing buffer pool, size = 8.0M
170731 16:56:50 InnoDB: Completed initialization of buffer pool
170731 16:56:50 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
170731 16:56:50 mysqld_safe mysqld from pid file /var/run/mysqld/ ended


Cause :

Permission problem in /var/lib/mysql

Solutions :

  1. Ensure user and group permission on /var/lib/mysql is mysql
  2. Check SELINUX Configuration : getenforce
  3. If SELINUX enabled, disabled with command : setenforce 0
  4. For permanent disable, edit /etc/selinux/config and set SELINUX=disabled
  5. Try to restart mysql service

[script] Auto Backup Mysql

Posted by cikul | Posted in Linux, Programming | Posted on 27-05-2016-05-2008


Now we will creating simple script to backup mysql databases, this script will automatically list all databases and back it up in a folder defined.

# Simple script to backup MySQL databases

# Parent backup directory

# MySQL settings

# Read MySQL password from stdin if empty
if [ -z "${mysql_password}" ]; then
echo -n "Enter MySQL ${mysql_user} password: "
read -s mysql_password

# Check MySQL password
echo exit | mysql --user=${mysql_user} --password=${mysql_password} -B 2>/dev/null
if [ "$?" -gt 0 ]; then
echo "MySQL ${mysql_user} password incorrect"
exit 1
echo "MySQL ${mysql_user} password correct."

# Create backup directory and set permissions
backup_date=`date +%Y_%m_%d_%H_%M`
echo "Backup directory: ${backup_dir}"
mkdir -p "${backup_dir}"
chmod 700 "${backup_dir}"

# Get MySQL databases
mysql_databases=`echo 'show databases' | mysql --user=${mysql_user} --password=${mysql_password} -B | sed /^Database$/d`

# Backup and compress each database
for database in $mysql_databases
if [ "${database}" == "information_schema" ] || [ "${database}" == "performance_schema" ]; then
echo "Creating backup of \"${database}\" database"
mysqldump ${additional_mysqldump_params} --user=${mysql_user} --password=${mysql_password} ${database} | gzip > "${backup_dir}/${database}.gz"
chmod 600 "${backup_dir}/${database}.gz"


Change & Reset Mysql Password

Posted by cikul | Posted in Linux, SQL, Tips | Posted on 18-10-2015-05-2008


This tutorial explains how to change or reset your MySQL root password under Unix-Like Operating Systems (Linux, FreeBSD, OpenBSD, etc) over SSH. MySQL root account should be managed carefully.

As a system administrator, we must ensure that the password is safe and prevent from unauthorized access.

There are some method to change mysql password :

Type 1 : use mysqladmin

However, if you want to change mysql root/user password, mysql had tool to simplify the process using mysqladmin command, the syntax is :

$ mysqladmin -u root -p'oldpassword' password newpass
$ mysqladmin -u dbuser -p'oldpassword' password 'itsnewpassword';

Read the rest of this entry »

How To Optimizing MySQL server

Posted by cikul | Posted in Internet, Linux, web | Posted on 20-04-2009-05-2008


mysqlFor the web server that using mysql as a database engine. Sometimes the process in mysql need a large resource, especially if server has a high traffic. According to my experience, to the high traffic server, the MySQL process itself can spend more than 30% of server resources. So, I will give you tips for optimizing mysql on the server that has high traffic.

Mysql configuration located in the my.cnf file, usually this file is in the /etc directory, but can also in other folders. For more safe, you can search my.cnf file to make sure the location of the file. Read the rest of this entry »

Incoming search terms:

optimize mysql server | your applications are not closing mysql connections properly | how to optimize mysql server | optimize mysql | YYGU |