LINUX How to using sql command line

Open a terminal window.
Connect to the MySQL server using your root MySQL password and go to the mysql database within it:
1. Create local sql username
mysql -u root -p mysql
At the mysql> prompt, type:
GRANT ALL PRIVILEGES ON *.* TO mary@localhost IDENTIFIED BY 'ship3marker';
then press ENTER.
This command string creates a new account on the MySQL server for the user mary. Her password is ship3marker.
2. Create remote sql username
GRANT ALL PRIVILEGES ON *.* TO remote@'%' IDENTIFIED BY 'nopass' WITH GRANT OPTION;
then press ENTER.
This command string is slightly different than the previous one:
TO marty@'%'
GRANT ALL PRIVILEGES ON *.* TO marty@'%' IDENTIFIED BY 'watch4keys' WITH GRANT OPTION;
The % wildcard allows connections on this account from any domain, not just localhost.
If you only wanted connections from the visibooks.com domain, you'd use this instead:
GRANT ALL PRIVILEGES ON *.* TO marty@visibooks.com IDENTIFIED BY 'watch4keys' WITH GRANT OPTION;
The GRANT OPTION sets the ability to GRANT privileges to other users. In other words, marty can create accounts for new users.
flush privileges;

Comments

Popular posts from this blog

Java : Variables Declaring

SQL Self JOIN