Category: MySQL

Subdomain Session Sharing Solutions

1. Use a cookie to store the session_id(); Example: PHP code in Domain One: <?phpsession_start();setcookie("session_id",session_id(),time()+3600*24*365*10,"/",".session.com"); $_SESSION['user_name'] = 'Liangshan …

How to Recover MySQL Database Using mysqlbinlog

What should you do if you accidentally perform a wrong operation on a database and don鈥檛 have a timely backup? This is probably a common problem that many coders often encounter.
Today, I accidentally deleted a database, but the last backup was from a week ago. The only way to resolve this is through mysqlbinl …

MySQL Data Recovery

Accidental database data deletion is a common occurrence, making data recovery an essential fundamental skill for DBAs. A more rudimentary approach is to pull a historical backup and restore it on a separate machine, but this method often consumes considerable …

FLUSH TABLES WITH READ LOCK vs LOCK TABLES

Today, while resolving a database synchronization issue, I used the flush tables with read lock command and took the opportunity to learn more about table locking. 1. FLUSH TABLES WITH READ LOCK This command enforces a global read lock; after executing it …

How to Clear MySQL log-bin Logs

Lately I’ve been swamped with work projects, and now with departmental restructuring I’ll be moving to a new project. I’m pretty excited to dive into a lot of new knowledge again. After getting off work today, I checked on my VPS status and found that my VPS only had about 1 GB of disk space left! My first reaction was that it had been hacked …

MySQL Master-Slave Replication Configuration Guide

How to Configure MySQL 5 Master-Slave Replication
I. Choosing the Installation Package
mysql-mysql-5.0.77
II. Installation Environment
Two Red Hat Enterprise Linux AS release 4 (Nahant Update 5) virtual machines
Master Server: 192.168.126.118
Slave Server: 192.168.126.166
III. Master Server …

How to Install MySQL on CentOS

With nothing to do this afternoon and bored out of my mind, I just set up an FTP server, which is basically just for show since I rarely use it. So I figured I’d install MySQL to learn a bit. I installed it with yum install mysql, then ran mysql and got:
ERROR 2002 (HY000): Can't connect to local MySQL server through socke …

How to Reset a Forgotten MySQL Password

When using MySQL databases, we often run into the problem of forgetting the MySQL password. I’ve encountered this myself, and I searched online for many solutions but couldn’t resolve it (the web is full of reposted content…). In the end, I figured it out on my own and came up with a solution for resetting a forgotten MySQL password …

MySQL SHOW STATUS Explained

The server maintains many status variables that provide operation-related information. You can view these variables and their values using the SHOW STATUS statement, and through these values, discover some key issues currently present in the database. For example, if Opened_tables is too large, then your table_cache variable…