IDGLabs.COM - tips, tools and resource

Knowledge Sharing - Want to participate in the discussion?

This tutorial section deals with mysqldump which is a tool to import and export databases.

It can be used to back up a database or to move database information from one to another.

1. Export A Database

This example shows you how to export a database. It is a good idea to export your data often as a backup.

# mysqldump -u username -ppassword database_name > FILE.sql

Replace username, password and database_name with your username, password and database name.

File FILE.sql now holds a backup of your database, it to your .

2. Import A Database

Here, we import a database. Use this to restore data from a backup or to import from another .

Start by uploading the FILE.sql file to the where you will be running this command.

# -u username -ppassword database_name < FILE.sql

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 and import it on your account with the new host.

Tags: , , , ,
  • 0 Comments
  • Filed under: MySql
  • Anyone who’s looking to upgrade, or install a new 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 (32 bit) and x86_64 bit platforms.

    Below are snippits from an strace (for clarity) of ’strace -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: , , ,
  • 0 Comments
  • Filed under: Zend Optimizer
  • Linux E-mail Alert on Root SSH Login

    You can get notification email when some one login to your as root when you are using bash shell.

    To enable root login notification, do the following

    1. /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 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: , , ,
  • 0 Comments
  • Filed under: Linux
  • I’m moving one of my websites to another .
    It uses a database.

    To back and move the database, first did a back with command:
    Code:

    mysqldump –opt -Q -u dbusername -p databasename > backupname.sql

    Then, after transfering the dump into the new , i try to run the command:

    Code:

    -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 ?
    if i try to put database in new 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”
     

    Tags: , ,
  • 0 Comments
  • Filed under: MySql
  • Share Your Score

    Advertise