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

0

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/mysqld.pid 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

0

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.


#!/bin/bash
# Simple script to backup MySQL databases

# Parent backup directory
backup_parent_dir="/backup/mysql"

# MySQL settings
mysql_user="root"
mysql_password="******"

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

# 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
else
echo "MySQL ${mysql_user} password correct."
fi

# Create backup directory and set permissions
backup_date=`date +%Y_%m_%d_%H_%M`
backup_dir="${backup_parent_dir}/${backup_date}"
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
do
if [ "${database}" == "information_schema" ] || [ "${database}" == "performance_schema" ]; then
additional_mysqldump_params="--skip-lock-tables"
else
additional_mysqldump_params=""
fi
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"
done

 

Change & Reset Mysql Password

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

0

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 »

[JQuery] Open POST result in new window

Posted by cikul | Posted in Internet, Programming, web | Posted on 16-10-2012-05-2008

0


$.post('/url/to/get/data',data,function(result) {
WinId = window.open('', 'newwin', 'width=400,height=500');
WinId.document.open();
WinId.document.write(result);
WinId.document.close();
});

[Oracle] Automatically Kill inactive Sessions

Posted by cikul | Posted in Oracle, Programming, SQL, Technology | Posted on 28-09-2012-05-2008

0

The problem you could face with arbitrary killing of inactive sessions is that you may kill a session that was still running (it could have just completed one procedure & hadn’t yet started another).

Perhaps an easier way to accomplish what you want (although I’m guessing here at what it is you want to do!) is to set the users’ profiles to automatically kill their session after a specified period of time e.g.

Read the rest of this entry »

[Oracle] instance recovery required, cannot set ARCHIVELOG mode

Posted by cikul | Posted in Oracle, SQL, Technology | Posted on 26-09-2012-05-2008

1

When I try to set archivelog in another machine using this guidance. I’ve got this error message :


SQL> startup mount;
ORACLE instance started.

Total System Global Area  320309648 bytes
Fixed Size                   731536 bytes
Variable Size             285212672 bytes
Database Buffers           33554432 bytes
Redo Buffers                 811008 bytes
Database mounted.
SQL> alter database archivelog;
alter database archivelog
*
ERROR at line 1:
ORA-00265: instance recovery required, cannot set ARCHIVELOG mode

Read the rest of this entry »

[Oracle] Setting ArchiveLog mode

Posted by cikul | Posted in Oracle, SQL | Posted on 25-09-2012-05-2008

2

What Is Archive Log?

As a DBA, you are responsible to recover any failures to a point of failure and also to perform your backup while online. Your organization is a 24×7 shop and you are not able to shutdown the database. Therefore, the database has to be in an archive mode.

For example you have severe corruption or a database crash that required you to restore some datafiles from several hours ago. If you have all the archived logs from that pint in time up until the moment of the crash, you can roll forward all the changes contained in those archived logs against the restored datafiles.

This process will replays all the changes in the database over the past hours. After recovering the last archived log, Oracle will then look to roll forward even more by using the online redo logs. If those online redo logs contain changes necessary, Oracle will apply those changes also.

Read the rest of this entry »

[Oracle] Troubleshoot “Connected to an idle instance.”

Posted by cikul | Posted in Linux, Oracle, SQL, Windows | Posted on 24-09-2012-05-2008

0

Problem : You have an Oracle instance, and you know it’s running on the system, when you’re trying to connect using “/ as sysdba” it says the instance is idle. You know the database is up and opened, because your application’s talking to it.


[oracle@server db_1]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Sep 24 15:22:47 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to an idle instance.
SQL>

Read the rest of this entry »

[PHP] Extract XML Data

Posted by cikul | Posted in PHP, Programming | Posted on 24-07-2012-05-2008

1

XML was designed to transport and store data. The design goals of XML emphasize simplicity, generality, and usability over the Internet.

It is a textual data format with strong support via Unicode for the languages of the world. Although the design of XML focuses on documents, it is widely used for the representation of arbitrary data structures, for example in web services.

Read the rest of this entry »

[PHP] Excel, Word, PowerPoint Libraries

Posted by cikul | Posted in PHP, Programming | Posted on 20-07-2012-05-2008

1

Need export your data in XLS Format? maybe DOC format or PPT format. It’s can be frustrating to PHP programmer converting data to these formats.

No worry, there are several libraries/classes available for PHP to simplify your process to export data. let’s discuss one by one :

Read the rest of this entry »