How To Create a New User and Grant Permissions in MySQL

Friday, October 17, 2014

How To Create a New User and Grant Permissions in MySQL ?

There are 3 steps :-

1. CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

2. GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';

3. FLUSH PRIVILEGES;


How To Grant Different User Permissions :-

Here is a short list of other common possible permissions that users can enjoy.

ALL PRIVILEGES- as we saw previously, this would allow a MySQL user all access to a designated database (or if no database is selected, across the system)
CREATE- allows them to create new tables or databases
DROP- allows them to them to delete tables or databases
DELETE- allows them to delete rows from tables
INSERT- allows them to insert rows into tables
SELECT- allows them to use the Select command to read through databases
UPDATE- allow them to update table rows

GRANT OPTION- allows them to grant or remove other users' privileges

1.  GRANT [type of permission] ON [database name].[table name] TO ‘[username]’@'localhost’;

2.  REVOKE [type of permission] ON [database name].[table name] FROM ‘[username]’@‘localhost’;

3. DROP USER ‘demo’@‘localhost’;

4.  quit 

5. mysql -u [username]-p


Read more...

Finding text string in all files on Linux

How To Finding text string in all files on Linux :-

Commands:-

1. grep -rnw 'directory' -e "pattern"

2. grep -Ril "text-to-find-here" /

3. grep -r "string to be searched"  /path/to/dir

4. grep -inr "Text" folder/to/be/searched/

grep "text string to search” directory-path

grep [option] "text string to search” directory-path

grep -r "text string to search” directory-path

grep -r -H "text string to search” directory-path

egrep -R "word-1|word-2” directory-path

egrep -w -R "word-1|word-2” directory-path

Read more...

Delete Symbolic Link or Softlink Linux

How To Delete Symbolic Link or Softlink in Linux, Centos, Ubuntu using command prompt ?

following command to remove symbolic links:-

1st rm - removes each given FILE including symbolic links
2nd unlink - deletes a single specified file name including symbolic links.

Delete Symbolic Link File :-

following syntax:

rm linkname
unlink linkname

Example:-

cd /tmp
ln -s /etc/resolv.conf mytest
ls -l mytest

output -
lrwxrwxrwx 1 user user 16 2008-12-16 08:27 mytest -> /etc/resolv.conf


Now delete dns symbolic link:
rm dns
OR
unlink dns


Delete Symbolic Link Directory :-

following syntax:-

rm linkDirName
unlink linkDirName

Example:-
cd /tmp
ln -s /etc test
ls -l test
Sample Output:

lrwxrwxrwx 1 user user 4 16 2008-12-16 08:27 test -> /etc

Now delete test symbolic link directory:
rm test
OR
unlink test

Read more...

Recursively delete .svn directories

How to Recursively delete .svn directories and files on linux, centos, ubunto :-

Step 1. "find" command to find all .svn folders beginning from current directory.

$ find . -type d -name .svn
./.svn
./sourceA/.svn
./sourceB/.svn
./sourceB/module/.svn

./sourceC/.svn


Step 2. rm command remove all .svn directories
     
     $ rm -rf `find . -type d -name .svn`


More Commands :-

find . -name .svn -exec rm -rf {} \;
Before running a command like that, I often like to run this first:

find . -name .svn -exec ls {} \;

or

You almost had it. If you want to pass the output of a command as parameters to another one, you'll need to use xargs. Adding -print0 makes sure the script can handle paths with whitespace:

find . -type d -name .svn -print0|xargs -0 rm -rf

Read more...

About This Blog

Lorem Ipsum

  © Copyright 2009 Linux-HelpLine.Blogspot.com

Back to TOP