{"id":3006,"date":"2012-05-10T21:54:26","date_gmt":"2012-05-10T13:54:26","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=3006"},"modified":"2023-04-28T09:49:20","modified_gmt":"2023-04-28T09:49:20","slug":"how-to-securing-mysql-database-server-on-centos-5-8","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-securing-mysql-database-server-on-centos-5-8\/","title":{"rendered":"How to Securing MySQL Database Server on CentOS 5.8"},"content":{"rendered":"<p>In this post, i will show the quick steps to securing MySQL database server on linux CentOS 5.8. On fresh MySQL server installation, MySQL root password does not set and anonymous user also allowed to enter your database. This is very insecure and danger for sensitive data. To start securing your MySQL, simply run this command. This post assumed that you have installed MySQL server.<\/p>\n<pre>\n[root@centos58 ~]# \/usr\/bin\/mysql_secure_installation\n<\/pre>\n<p>Examples :<\/p>\n<pre>\n[root@centos58 ~]# \/usr\/bin\/mysql_secure_installation\n\n\n\n\nNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL\n      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!\n\n\nIn order to log into MySQL to secure it, we'll need the current\npassword for the root user.  If you've just installed MySQL, and\nyou haven't set the root password yet, the password will be blank,\nso you should just press enter here.\n\nEnter current password for root (enter for none):\nOK, successfully used password, moving on...\n\nSetting the root password ensures that nobody can log into the MySQL\nroot user without the proper authorisation.\n\nSet root password? [Y\/n] y\nNew password:\nRe-enter new password:\nPassword updated successfully!\nReloading privilege tables..\n ... Success!\n\n\nBy default, a MySQL installation has an anonymous user, allowing anyone\nto log into MySQL without having to have a user account created for\nthem.  This is intended only for testing, and to make the installation\ngo a bit smoother.  You should remove them before moving into a\nproduction environment.\n\nRemove anonymous users? [Y\/n] y\n ... Success!\n\nNormally, root should only be allowed to connect from 'localhost'.  This\nensures that someone cannot guess at the root password from the network.\n\nDisallow root login remotely? [Y\/n] n\n ... skipping.\n\nBy default, MySQL comes with a database named 'test' that anyone can\naccess.  This is also intended only for testing, and should be removed\nbefore moving into a production environment.\n\nRemove test database and access to it? [Y\/n] y\n - Dropping test database...\n ... Success!\n - Removing privileges on test database...\n ... Success!\n\nReloading the privilege tables will ensure that all changes made so far\nwill take effect immediately.\n\nReload privilege tables now? [Y\/n] y\n ... Success!\n\nCleaning up...\n\n\n\nAll done!  If you've completed all of the above steps, your MySQL\ninstallation should now be secure.\n\nThanks for using MySQL!\n\n\n<\/pre>\n<p>Login to mysql server :<\/p>\n<pre>\n[root@centos58 ~]# mysql -u root -p\nEnter password:\n<\/pre>\n<p>How to show user info on mysql :<\/p>\n<pre>\nmysql> use mysql;\nReading table information for completion of table and column names\nYou can turn off this feature to get a quicker startup with -A\n\nDatabase changed\nmysql> select user,host,password from user;\n+------+-------------------------+------------------+\n| user | host                    | password         |\n+------+-------------------------+------------------+\n| root | localhost               | 5d2e19393cc5ef67 |\n| root | centos58.ehowtuff.local | 5d2e19393cc5ef67 |\n| root | 127.0.0.1               | 5d2e19393cc5ef67 |\n+------+-------------------------+------------------+\n3 rows in set (0.00 sec)\n<\/pre>\n<p>Alternatively, you can run the following command :<\/p>\n<pre>\nmysql> select user,host,password from mysql.user;\n+------+-------------------------+------------------+\n| user | host                    | password         |\n+------+-------------------------+------------------+\n| root | localhost               | 5d2e19393cc5ef67 |\n| root | centos58.ehowtuff.local | 5d2e19393cc5ef67 |\n| root | 127.0.0.1               | 5d2e19393cc5ef67 |\n+------+-------------------------+------------------+\n3 rows in set (0.00 sec)\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In this post, i will show the quick steps to securing MySQL database server on linux CentOS 5.8. On fresh MySQL server installation, MySQL root password does not set and&#8230;<\/p>\n","protected":false},"author":6,"featured_media":343,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[2055,1008],"tags":[1536,1546,1585],"class_list":["post-3006","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-mysql","tag-linux","tag-linux-utilities","tag-mysql"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/3006","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=3006"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/3006\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/343"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=3006"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=3006"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=3006"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}