Something Different In Linux

Home » Archive by category 'mysql'

The following script is used to  start mysql automatically when it is failed or stopped on the server. You can set 2 min cron “*/2 * * * * /bin/sh /root/” and it restart the mysql automatically. ============================ #!/bin/bash #Checking whether MySQL is alive or not if mysqladmin ping | grep -q “alive”; then echo “MySQL is  [ Read More ]

daily mysql databases backup on cpanel server

Posted by Rishikesh Vispute Categories: cpanel, mysql, Uncategorized

Question: How to back up MySQL databases using cron jobs on cpanel server ? Ans: You can take the mysql backup of all databases for last 10 days and keep on the server.  You need to add the cron to create the daily mysql backup of all the databases. The backup is stored in the folder  [ Read More ]

upgrade mysql version on linux server

Posted by Rishikesh Vispute Categories: How to, mysql

You can upgrade your mysql version from 5.0 to 5.5 by using following steps 1. Enable remi repository for yum wget wget sudo rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm 2. Run mysqldump to export data out from MySQL 5.0 mysqldump -uroot -p –all-databases > mysqlbackup.sql 3. Run ‘yum –enablerepo=remi install mysql mysql-server mysqlclient’ 4. Run  [ Read More ]

Reset MySQL root Password

Posted by Rishikesh Vispute Categories: How to, mysql

If you have forget the mysql root password and you are not able to access your mysql service then you need to reset the password of mysql root user by using following steps Ans : 1)root@server [~] /etc/init.d/mysqld stop 2) Start to MySQL server without password: root@server [~] mysqld_safe –skip-grant-tables & 3) root@server [~] mysql  [ Read More ]

enable mysql Query cache

Posted by Rishikesh Vispute Categories: mysql

How to enable mysql Query cache on linux server? Ans: You need to login to mysql by using root accesss. ========================== root@server[~]#mysql -u root –pPASSWORD mysql> SET GLOBAL query_cache_size = 16777216;              (If you want to set query_cache_size=16 MB) ========================== Then open the my.cnf file and add the following directives. # vi /etc/my.cnf query_cache_size = 268435456  [ Read More ]

reset mysql password in plesk

Posted by Rishikesh Vispute Categories: mysql, Plesk

Error :  ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES) Solution : To find password for user admin, run [root@server22 ~]# cat /etc/psa/.psa.shadow FfRBehWy [root@server22 ~]# To login to MySQL mysql -u admin -pFfRBehWy For example [root@server22 ~]# mysql -u admin -pFfRBehWy Welcome to the MySQL monitor. Commands end with ; or  [ Read More ]

mysqldump: Got error

Posted by Rishikesh Vispute Categories: mysql

Error : When you try to run the mysqldump command to make a backup of database then encounter the following error-exception: mysqldump databasename  > databasename.sql mysqldump: Got error: 1016: Can’t open file: ‘./databasename/wp_142_term_taxonomy.frm’ (errno: 24) when using LOCK TABLES Solution: Open the file /etc/my.cnf and  add the following line and restart the mysql service on  [ Read More ]

database not connected

Posted by Rishikesh Vispute Categories: Error and solution, mysql

Error : Your all database details is correct but the database is not connected  in any application. Solution : The problem due the ” sql.safe_mode”  is “On” in php.ini file.  You need to turn off the sql.safe_mode in server  php.ini file sql.safe_mode = Off Done

mysql connection in jsp

Posted by Rishikesh Vispute Categories: Email Marketing Series, How to, mysql, Tomcat

Database Connection by using jsp page . The URL based mysql connection  is ================================= jdbc:mysql://serverip address/DATABASENAME?user=USERNAME&password=PASSWORD ================================= OR ================================= <!– Database connection settings –> <property name=”connection.driver_class”>com.mysql.jdbc.Driver</property> <property name=”connection.url”>jdbc:mysql://localhost/database_name</property> <property name=”connection.username”>databses_user</property> <property name=”connection.password”>password</property> <!– configuration pool via c3p0–> ================================= OR ================================= try { Class.forName(“com.mysql.jdbc.Driver”).newInstance(); // here we are connecting to localhost, port 3306. Change it to  [ Read More ]

Letter case error in Mysql

Posted by Rishikesh Vispute Categories: mysql

If anyone has run into a situation where sql queries from your java app were erroring out because of letter case in tables and column names in MySQL database, I have a quick solution for you. First, what you should have done, but probably was too creative and used mixed case for creating table names/columns  [ Read More ]

Mysql Commands

Posted by Rishikesh Vispute Categories: Linux Commands, mysql

To login (from unix shell) use -h only if needed. # [mysql dir]mysql  -u username -p Create a database on the sql server. mysql> create database [databasename]; List all databases on the sql server. mysql> show databases; Switch to a database. mysql> use [db name]; To see all the tables in the db. mysql> show  [ Read More ]

why mysql_pconnect is disabled on shared server

Posted by Rishikesh Vispute Categories: mysql

mysql_pconnect() will maintain a persistent connection to the database. Whenever your script calls the connect to database function, it first searches already existing connections to the database and if exists it will use the same connection to connect to the database, if not it will open a new connection to the database. ie. Connection is  [ Read More ]

Database Hostname In mysql config file

Posted by Rishikesh Vispute Categories: mysql

Hosting Company ============================= DB_HOST Value Guess ====================== 1and1 db12345678 AN Hosting localhost BlueHost localhost DreamHost GoDaddy HostGator localhost HostICan localhost ICDSoft localhost:/tmp/mysql5.sock LaughingSquid localhost MediaTemple GridServer localhost pair Networks Yahoo mysql Hosts with cPanel localhost Hosts with Plesk localhost Hosts with DirectAdmin ============================= localhost =======================

Update to latest Mysql version provided by cpanel

Posted by Rishikesh Vispute Categories: mysql

Update to latest Mysql version provided by cpanel To upgrade the mysql on the cpanel server * The best method to use the cpanel #/script/mysqlup to upgrade the mysql. * To upgrade the mysql from 4.0.x to 4.1.x you need to enable the mysql upgrade in the whm under tweak setting /scripts/upcp –force /scripts/mysqlup –force

Mysql commands

Posted by Rishikesh Vispute Categories: mysql

How to connect to Database for any user through Server # mysql -u DBNAME -p DBPASS command for taking  mysql backup:=> #mysqldump databasename > file.sql command for restoring : => # mysql -u [username] -p[password] [database] < [backup_file] or #mysql database name < file.sql

Popular Posts

remove index.php fro

How to remove index.php from url in magento Ans : If you ...

PHP-Java bridge on p

  What is php-java bridge? The php-java bridge is the php ...

Set expiration for y

If you want to set the expiration to your site ...

Warning: Parameter 1

Error: Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a ...

domain pointing to e

If you domain uses external MX record and it is ...