Centos, LifeRay with mysql database install

  • Install Centos 4.8 using DVD
  • vi /etc/yum.conf to include proxy server if internal
  • Run “yum update” to upgrade your CENTOS to the latest.
  • Install MySQL server “yum install mysql-server”
  • /etc/init.d/mysqld start
  • mysqladmin -u root password ‘hardpassword’
  • mysqladmin -u root -p create liferay
  • mysqladmin -u root -p reload

Setup MySQL Permissions

To access the user, host databases, etc… type this;

mysql> use mysql;
Database changed
mysql>

To give localhost permission to access all databases, enter this:

mysql> insert into
         -> host(host,db,Select_priv, Insert_priv, Update_priv,
         -> Delete_priv, Create_priv, Drop_priv)
         -> values('localhost','%','Y','Y','Y','Y','Y','Y');

Note, the ‘%’ can be replaced with a database name. The ‘%’ is a wildcard.

Following the previous format, to allow access from another hostname (in this case “windowsbox”) add this:

mysql> insert into
         -> host(host,db,Select_priv, Insert_priv, Update_priv,
         -> Delete_priv, Create_priv, Drop_priv)
         -> values('windowsbox','%','Y','Y','Y','Y','Y','Y');

Again, ‘%’ is used as a Wild-Card.

To create a user ‘djg’ who can access the MySQL server from localhost, type this:

mysql> insert into
         -> user (host, user, password)
         -> values('localhost','djg',password('mypassword'));

To give the user access from another hostname, domain, etc… add other entries accordingly. For example, to give user djg access from windowsbox:

mysql> insert into
         -> user (host, user, password)
         -> values('windowsbox','djg',password('mypassword'));

Now… to give the user permissions to access a database from localhost, add this entry and change with your appropriate information:

mysql> insert into
-> db (host,db,user,Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv)
-> values (‘localhost’,’mydatabase’,’djg’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’);

To give the user permissions from windowsbox, add this:

mysql> insert into
-> db (host,db,user,Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv)
-> values (‘windowsbox’,’mydatabase’,’djg’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’);

Now, type: quit and you will exit mysql.

Finally, create the actual database (in this case, ‘mydatabase’) type this:

mysqladmin -u root -p create mydatabase

After prompting you for a password, it should create the database.

At this point, you must reload MySQL. Type:

mysqladmin -u root -p reload

After prompting you for a password it should reload MySQL.

Leave a Reply