MySQL is the world's most popular open source database.
MySQL Community Edition is freely downloadable version.
Commercial customers have the flexibility of choosing from multiple editions to meet specific business and technical requirements. For more details please refer to the MySQL official website.
INSTALL :
On any CentOS server with open internet, run the below command to install MySQL Community Edition:
OR
Download the server and client rpm files from the MySQL Website depending upon the platform(OS) and architecture(32/64bit).
Install both rpm files using below command:
Example:
CONFIGURE :
Once installed, run the below commands to configure MySQL Server:
1.Set the MySQL service to start on boot
2. Start the MySQL service
3. By default the root user will have no password, so to log into MySQL use command:
4. To exit Mysql Console, enter below command
SET PASSWORD FOR ROOT :
To set the root user password for all local domains, login and run below commands
(Replace <<new-password>> with actual password)
OR
run below command at linux shell:
(Replace <<new-password>> with actual password)
Once password is set, to login to Mysql use below command:
Once you enter the above command, you will be prompted for the root password.
To add a new user for MySQL login, use the below SQL query. Remember this query must be run from the MySQL prompt.
for localhost:
for anyhostname:
Replace <<USERNAME>> and <<PASSWORD>> with actual username and password respectively.
Note they must be enclosed in single quotes.
DROP ANY USER :
In case, you want to drop any user use below command:
(Replace <<username>> with actual username)
For more help and commands, refer --> http://www.yolinux.com/TUTORIALS/LinuxTutorialMySQL.html
MySQL Community Edition is freely downloadable version.
Commercial customers have the flexibility of choosing from multiple editions to meet specific business and technical requirements. For more details please refer to the MySQL official website.
INSTALL :
On any CentOS server with open internet, run the below command to install MySQL Community Edition:
yum install mysql-server mysql php-mysql
OR
Download the server and client rpm files from the MySQL Website depending upon the platform(OS) and architecture(32/64bit).
Install both rpm files using below command:
rpm -ivh <<rpm_filenames>>
Example:
rpm -ivh mysql-server-version.rpm mysqlclient9-version.rpm
CONFIGURE :
Once installed, run the below commands to configure MySQL Server:
1.Set the MySQL service to start on boot
chkconfig --levels 235 mysqld on
service mysqld start
mysql -u root
4. To exit Mysql Console, enter below command
exit;
SET PASSWORD FOR ROOT :
To set the root user password for all local domains, login and run below commands
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('<<new-password>>');
SET PASSWORD FOR 'root'@'localhost.localdomain' = PASSWORD('<<new-password>>');
SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('<<new-password>>');
(Replace <<new-password>> with actual password)
OR
run below command at linux shell:
mysqladmin -u root password '<<new-password>>'
Once password is set, to login to Mysql use below command:
mysql -u root -p
Once you enter the above command, you will be prompted for the root password.
ADD NEW USER :
To add a new user for MySQL login, use the below SQL query. Remember this query must be run from the MySQL prompt.
for localhost:
INSERT INTO user (Host, User, Password, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv, Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, Event_priv, Trigger_priv, ssl_type, ssl_cipher, x509_issuer, x509_subject, max_questions, max_updates, max_connections, max_user_connections) VALUES ('localhost', '<<USERNAME>>', password('<<PASSWORD>>'), 'Y','Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'N', '', '', '', '', 0, 0, 0, 0);
for anyhostname:
INSERT INTO user (Host, User, Password, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv, Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, Event_priv, Trigger_priv, ssl_type, ssl_cipher, x509_issuer, x509_subject, max_questions, max_updates, max_connections, max_user_connections) VALUES ('%', '<<USERNAME>>', password('<<PASSWORD>>'), 'Y','Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'N', '', '', '', '', 0, 0, 0, 0);
Replace <<USERNAME>> and <<PASSWORD>> with actual username and password respectively.
Note they must be enclosed in single quotes.
DROP ANY USER :
In case, you want to drop any user use below command:
DROP '<<username>>''@'localhost';
DROP '<<username>>''@'localhost.localdomain';
(Replace <<username>> with actual username)
For more help and commands, refer --> http://www.yolinux.com/TUTORIALS/LinuxTutorialMySQL.html
No comments:
Post a Comment