Knowledge Sharing - Want to participate in the discussion?
31 Mar
This tutorial section deals with mysqldump which is a tool to import and export MySQL databases.
It can be used to back up a database or to move database information from one server to another.
1. Export A MySQL Database
This example shows you how to export a database. It is a good idea to export your data often as a backup.
|
Replace username, password and database_name with your MySQL username, password and database name.
File FILE.sql now holds a backup of your database, download it to your computer.
2. Import A MySQL Database
Here, we import a database. Use this to restore data from a backup or to import from another MySQL server.
Start by uploading the FILE.sql file to the server where you will be running this command.
|
Replace the parts in red with your own information.
This powerful, easy to use command has many uses. Let’s say you wanted to switch web hosting providers.
Simply export your data on the old provider’s server and import it on your account with the new host.
Tags: computer, download, MySql, MySql, server29 Mar
Anyone who’s looking to upgrade, or install a new server and require Zend Optimizer to run Zend Encoder / Zend Guard encoded programs -
Zend Optimizer 3.3.0a is broken. It has some broken SHM setup calls in it, which cause it to execute sometimes, but abort early. This breaks ‘interactive’ mode, as well as pipes.
I have confirmed this behavior on Linux (32 bit) and Linux x86_64 bit platforms.
Below are snippits from an strace (for clarity) of ’strace php -a’; this problem is not exhibited in 3.2.8 or earlier versions.
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0×2b5dfbf94000
lseek(0, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
close(0) = 0
munmap(0×2b5dfbf94000, 4096) = 0
ioctl(-1, SNDCTL_TMR_TIMEBASE or TCGETS, 0×7fffaeb6b7a0) = -1 EBADF (Bad file descriptor)
mmap(NULL, 1052672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0×2b5e0189c000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0×2b5e0199d000
read(4294967295, 0xd75cb0, 8192) = -1 EBADF (Bad file descriptor)
I suggest everyone stick to Zend Encoder 3.2.8 until this is resolved.
Tags: Linux, PHP, server, Zend Optimizer20 Mar
You can get notification email when some one login to your server as root when you are using bash shell.
To enable root login notification, do the following
1. cd /root
2. edit .bashrc file with command
vi .bashrc
3. Add following content to .bashrc file
echo ‘ALERT - ServerName Root Access on:’ `date` `who` | mail -s “Alert: Root Access from `who | cut -d’(’ -f2 | cut -d’)’ -f1`” you@yourdomain.com
Change
ServerName to your server name.
you@yourdomain.com to your email address.
4. Save and Exit vi text editor with command :wq
Now log out of SSH and login, you will get SSH Root Login alert email with IP addrss and time of login.
Tags: cd, Linux, Linux, server19 Mar
I’m moving one of my websites to another server.
It uses a mysql database.
To back and move the MySQL database, first did a back with command:
Code:
mysqldump –opt -Q -u dbusername -p databasename > backupname.sql
Then, after transfering the mysql dump into the new server, i try to run the command:
Code:
mysql -u dbusername -p databasename < backupname.sql
But then it always gives me errors, telling me i don’t have access or i haven’t access to X table.
Do i need to create the same table named X, as i had in the old server?
if i try to put database in new server with above command, i get:
Quote:
ERROR 1044 (42000): Access denied for user ’smsport’@'localhost’ to database ’sms’
and if i try to create first in cpanel the database “sms”, i get this error:
Quote:
ERROR 1007 (HY000) at line 12: Can’t create database ’smsport_sms’; database exists
any tip?
open the sql file in notepad delete the line at the top that says
“CREATE DATABASE `smsport_sms` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;”
You have to create the database manualy.
User name should be in the same format your databse name is. should be somthing like “smsport_smsport”