Showing posts with label root. Show all posts
Showing posts with label root. Show all posts

Basic Command Linux


 
 Show Direktori Files - ls
Command ls (LiSt) To Show files or directory in some directory
Create Directory: $ mkdir (name directory)
Command mkdir (MaKeDIRectory) for create directory
Change location : $ cd (location)
Command cd (ChangeDirectory) will be change location where you are now, to destination you set
Copy File / Folder : $ cp (Name File / Directory) (Destination File / Directory)
Command cp (CoPy) will be copy file to destination you set. command cp -r will be copy directory to destination you set.
Delete / Remove: $ rm (Name File / directory)
Command rm (ReMove) will remove / delete file you set. Command rm -rf will delete / remove directory you set.
Move File / Directory: $ mv (Name File / directory)
Command mv (MoVe) Will be change name of file or move file to destination you set .
Search File / Directory: $ locate (Name File / directory)
Command locate using methode indexing from files in your system, It will be work fastest. To Most up to date, do this command updatedb. It will by automaticly running if you computer is always on, and this command can run under root privileges.
You can use wildcard for matching file or more files, like "*" (for all) or "?" (for matching some character).
See Also Ubuntu command basic .[Source]

Add user in Mysql Database


Add users mysql using two different ways, by using GRANT statement or manipulating Mysql users grant table.
The recommend method is to use GRANT Statement, because they are more concise, safe, and less error command. Book for learning basic until experd using mysql and how to get pwerfull performance mysql database.
  


For add user Mysql, You must be Administator user or also called root user.
The example below, show how add user using Grant Statement method.

user@localhost> mysql --user=root mysql {enter into Mysql database, using root user}
mysql> GRANT ALL PRIVILEGES ON *.* TO newuser@localhost
IDENTIFIED BY 'some_password' WITH GRANT OPTION; newuser is superuser but only from localhost}.

mysql> GRANT ALL PRIVILEGES ON *.* TO newuser@"%"
IDENTIFIED BY 'some_password' WITH GRANT OPTION; {newuser is superuser but only from localhost}.

mysql> GRANT RELOAD,PROCESS ON *.* TO admin@localhost; ( user admin have Administrative privileges, like the mysqladmin reload, mysqladmin refresh, and mysqladmin flush-* commands, as well as mysqladmin processlist)
mysql> GRANT USAGE ON *.* TO dummy@localhost; ( user can connect without password, but only from localhost).

Issue Grant Statement for both newuser@localhost and newuser@"%", if we don’t add the entry with localhost, the anonymous user can entered into Mysql take precedence when connect from outside localhost, it very dangerous, because it we has a more specific Host field value for prevent it.

The example below, add users use the specific privilege for each user.

mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
ON tbl_data.*
TO didai@localhost
IDENTIFIED BY 'stupid'; (user didai at localhost have a privileges mentioned, but must use a password ‘stupid’)
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
ON tbl_transaction.*
TO didai@greenhouse
IDENTIFIED BY 'stupid';(user didai from hostname “greenhouse” have a privileges mentioned and must use a password ‘stupid’)
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
ON tbl_customer.*
TO didai@'%' IDENTIFIED BY 'stupid';(user didai from anonymous host have a privileges mentioned and must use a password ‘stupid’)

Or you can manipulating user in table user at database Mysql, like below.

INSERT INTO user VALUES('localhost','user_abcd',PASSWORD('pass_abcd), 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');

Or

mysql> INSERT INTO db
(Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,
Create_priv,Drop_priv)
VALUES
('localhost','transaction','user_abcd','Y','Y','Y','Y','Y','Y');

Both of The example is very crucial command and not usefull.

Now, the choice is in you. Choose the choice with safety consideration.

Thank you, I hope this little article is something worthwhile
reference from http://mysql.com