HOW TO CREATE THE MySQL DATABASE
This step is only necessary if you don't already have a database set-up . In the following examples, 'username' is an example MySQL user which has the CREATE and GRANT privileges. Use the appropriate user name for your system.
First, you must create a new database for your site (here, 'databasename' is the name of the new database):
mysqladmin -u username -p create databasename
MySQL will prompt for the 'username' database password and then create the initial database files. Next you must login and set the access database rights:
mysql -u username -p
Again, you will be asked for the 'username' database password. At the MySQL prompt, enter following command:
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES
ON databasename.* TO 'username'@'localhost' IDENTIFIED BY 'password';
where
'databasename' is the name of your database
'username@localhost' is the username of your MySQL account
'password' is the password required for that username
Note: Unless your database user has all of the privileges listed above, you will not be able to run site on that database.
If successful, MySQL will reply with:
Query OK, 0 rows affected
To activate the new permissions, enter the following command:
FLUSH PRIVILEGES;
ABHIONLINUX
Site useful for linux administration and web hosting
2009/11/16
How to connect mysql from remote server
mysql -u root -p -h
where remote server = remote server ip address
To enable MySQL to listen to remote connections, you must find your my.cnf file.
find / -name 'my.cnf'
(the global 'my.cnf is' likely to be /etc but it may be found in other places)
Open the file, and put a # in front of skip-networking or bind-address=127.0.0.1
Example of end result:
1. skip-networking
or
1. bind-address = 127.0.0.1
Also check for any firewall stopping port 3306
Restart MySQL and everything should work fine.
Don't forget to grant users access from remote hosts.
where remote server = remote server ip address
To enable MySQL to listen to remote connections, you must find your my.cnf file.
find / -name 'my.cnf'
(the global 'my.cnf is' likely to be /etc but it may be found in other places)
Open the file, and put a # in front of skip-networking or bind-address=127.0.0.1
Example of end result:
1. skip-networking
or
1. bind-address = 127.0.0.1
Also check for any firewall stopping port 3306
Restart MySQL and everything should work fine.
Don't forget to grant users access from remote hosts.
Subscribe to:
Comments (Atom)