Monday, September 28, 2009

Restore mysql database from command prompt

mysql - u user_name -p your_password database_name < file_name.sql

Thursday, September 24, 2009

My note on creating a user

To avoid wasting time and reinventing the wheel every time I created a new user on my server, I think I have to record the steps so I can save my time

Here are the steps:
1. adduser username
2. edit /etc/httpd/conf/extra/directadmin-vhosts.conf
3. create a new file, /etc/httpd/conf/extra/user-username.conf
4. Use :%s/oldstring/newstring/g to edit the file above
5. service httpd restart
6. Set quota for the user

If the user needs MySQL, need the following steps also:
1. mysql -u admin-name -p
2. create database;
3. grant all privileges on database.* to username@localhost identified by 'password';

That's it.

Quota in Linux

To set quota for the user, use the command below:
/usr/sbin/setquota

Then to see the quota, use the command below:
/usr/sbin/repquota