Drug preguntas

Enable Remote connections To MySql Server

MySql No Comments »

By default, MySQL database server remote access disabled for security reasons. However, some time you need to provide the remote access to database server from home or from web server.

Step # 1: Login over ssh if server is outside your IDC

First, login over ssh to remote MySQL database server

Step # 2: Enable networking

Once connected you need edit the mysql configuration file my.cfg using text editor such as vi.

  • If you are using Debian Linux file is located at /etc/mysql/my.cnf location
  • If you are using Red Hat Linux/Fedora Linux file is located at /etc/my.cnf location
  • If you are using FreeBSD you need to create a file /var/db/mysql/my.cnf

# vi /etc/my.cnf

Step # 3: Once file open, locate line that read as

[mysqld]
Make sure line skip-networking is commented (or remove line) and add following line
bind-address=YOUR-SERVER-IP

For example, if your MySQL server IP is 65.55.55.2 then entire block should be look like as follows:
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/English
bind-address = 65.55.55.2
# skip-networking
….
..
….
Where,

  • bind-address : IP address to bind to.
  • skip-networking : Don’t listen for TCP/IP connections at all. All interaction with mysqld must be made via Unix sockets. This option is highly recommended for systems where only local requests are allowed. Since you need to allow remote connection this line should removed from file or put it in comment state.

Step# 4 Save and Close the file

Restart your mysql service to take change in effect:# /etc/init.d/mysql restart

Step # 5 Grant access to remote IP address

# mysql -u root -p mysqlGrant access to new database
If you want to add new database called foo for user bar and remote IP 202.54.10.20 then you need to type following commands at mysql> prompt:mysql> CREATE DATABASE foo;
mysql> GRANT ALL ON foo.* TO bar@'202.54.10.20' IDENTIFIED BY 'PASSWORD';

How Do I Grant access to existing database?

Let us assume that you are always making connection from remote IP called 202.54.10.20 for database called webdb for user webadmin, To grant access to this IP address type the following command At mysql> prompt for existing database:mysql> update db set Host='202.54.10.20' where Db='webdb';
mysql> update user set Host='202.54.10.20' where user='webadmin';

Step # 5: Logout of MySQL

Type exit command to logout mysql:mysql> exit

Step # 6: Test it
From remote system type command:

$ mysql -u webadmin –h 65.55.55.2 –p

Where,

  • -u webadmin: webadmin is MySQL username
  • -h IP or hostname: 65.55.55.2 is MySQL server IP address or hostname (FQDN)
  • -p : Prompt for password

You can also use telnet to connect to port 3306 for testing purpose:$ telnet 65.55.55.2 3306

MySql Remote connection Using Navicat

MySql No Comments »

What is Navicat?

Navicat is a set of graphical database management, reporting and monitoring tools for MySQL database systems. It allows to to perform all database management functions from a comfortable interface, rather than the command line. You can create tables, manage data, set user permissions, run queries and much more. Also includes comes a backup options, server monitoring and tools to create reports and more. The included Import Wizard allows you to import data from various sources, including MS Access database, Excel, text files and many other formats. MySQL Studio is an extremely useful package for anyone that is either administering or using MySQL server on a regular basis, since it not only makes day-today routine jobs a lot easier, but also provides an overall much easier way to manage advanced MySQL functionality.

You can download Navicat from

http://www.topshareware.com/Navicat-download-40530.htm
http://www.navicat.com/download.html

Connection Settings.
——————–

Host name : yourdomain name/server IP
Port : 3306
Username : database user name (for cpanel server it is cpanel-username_dbuser
Password : dbuser password.

Also you should have to check whether the server allowing remote connection to the server. If not please check my topic about enabling remote connection in the server.

How to reset the mySQL admin password

MySql No Comments »

How to reset the mySQL admin password

Last updated: 31/01/2005 (Wei Xing)
Uploaded: 02/08/2005

In a Unix environment, the procedure for resetting the root password is as follows:

1. Log on to your system as either the Unix root user or as the same user that the mysqld server runs as.

2. Locate the .pid file that contains the server’s process ID. The exact location and name of this file depend on your distribution, hostname, and configuration. Common locations are /var/lib/mysql/, /var/run/mysqld/, and /usr/local/mysql/data/. Generally, the filename has the extension of .pid and begins with either mysqld or your system’s hostname.

You can stop the MySQL server by sending a normal kill (not kill -9) to the mysqld process, using the pathname of the .pid file in the following command:

shell> kill `cat /mysql-data-directory/host_name.pid`

Note the use of backticks rather than forward quotes with the cat command; these cause the output of cat to be substituted into the kill command.

3. Restart the MySQL server with the special –skip-grant-tables option:

shell> mysqld_safe –skip-grant-tables &

4. Set a new password for the root@localhost MySQL account:

shell> mysqladmin -u root flush-privileges password “newpwd”

Replace “newpwd” with the actual root password that you want to use.

5. You should be able to connect using the new password.

Mysql Downgrade in Cpanel server

MySql No Comments »

Mysql Downgrade in Cpanel server

We need to do the following steps for downgrade MySQL,

1. Change the MySQL version in /var/cpanel/cpanel.config file,

mysql-version=4.1 to mysql-version=4.0

2. Take old MySQL database bakup,

# cp -rpf /var/lib/mysql /var/lib/mysql.old

3. Remove the old database,

# rm -rf /var/lib/mysql

4. Remove old mysql binary,

# rm -f /usr/sbin/mysqld

5. Now run the script mysqlup

# /script/mysqlup –force

6. It will install MySQL 4.0 on server.

Thats it !!! Smiley you r done !!! Cool

Wordpress Themes by Natty WP. Web Hosting
Images by our golf tips desEXign.