{"id":397,"date":"2022-04-02T01:56:36","date_gmt":"2022-04-02T01:56:36","guid":{"rendered":"https:\/\/ouritsource.com\/blog\/?p=397"},"modified":"2025-05-29T17:33:05","modified_gmt":"2025-05-29T17:33:05","slug":"installing-mysql-in-redhat-linux","status":"publish","type":"post","link":"https:\/\/ouritsource.com\/blog\/installing-mysql-in-redhat-linux\/","title":{"rendered":"Installing MySQL in RedHat Linux"},"content":{"rendered":"<body>\n<p class=\"has-medium-font-size\">To install MySQL, in the terminal window, type the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code has-normal-font-size\"><code>#sudo yum -y install @mysql<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\">Once the install completes, start the MySQL Service:<\/p>\n\n\n\n<pre class=\"wp-block-code has-normal-font-size\"><code>#systemctl start mysqld<\/code><\/pre>\n\n\n\n<p>Enable it to automatically start at system boot<\/p>\n\n\n\n<pre class=\"wp-block-code has-normal-font-size\"><code>systemctl enable --now mysqld<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\">Next, verify the status<\/p>\n\n\n\n<pre class=\"wp-block-code has-normal-font-size\"><code>#systemctl status mysqld<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\">Thereafter, secure the MySQL installation by running the security script:<\/p>\n\n\n\n<pre class=\"wp-block-code has-normal-font-size\"><code>#mysql_secure_installation<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"640\" height=\"695\" src=\"https:\/\/i0.wp.com\/ouritsource.com\/blog\/wp-content\/uploads\/2022\/04\/image-1.png?resize=640%2C695&#038;ssl=1\" alt=\"\" class=\"wp-image-400\" loading=\"lazy\" srcset=\"https:\/\/i0.wp.com\/ouritsource.com\/blog\/wp-content\/uploads\/2022\/04\/image-1.png?w=810&amp;ssl=1 810w, https:\/\/i0.wp.com\/ouritsource.com\/blog\/wp-content\/uploads\/2022\/04\/image-1.png?resize=276%2C300&amp;ssl=1 276w, https:\/\/i0.wp.com\/ouritsource.com\/blog\/wp-content\/uploads\/2022\/04\/image-1.png?resize=768%2C834&amp;ssl=1 768w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">This script sets the MySQL root password, allows one to remove anonymous users, and allows one to allow or disable \u201croot\u201d from logging in remotely. <\/p>\n\n\n\n<p class=\"has-medium-font-size\">Once MySQL is secure, you can log in to the MySQL shell:<\/p>\n\n\n\n<pre class=\"wp-block-code has-normal-font-size\"><code>#mysql -u root -p<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\">You can create a new database<\/p>\n\n\n\n<pre class=\"wp-block-code has-normal-font-size\"><code>#create database newDB;<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\">You can also create a new user<\/p>\n\n\n\n<pre class=\"wp-block-code has-normal-font-size\"><code>#GRANT ALL ON newDB.* TO 'newuser'@'localhost' IDENTIFIED BY 'password';<\/code><\/pre>\n\n\n\n<pre id=\"block-d60a9fcb-0e43-4e51-8e3b-5a97f1439e1e\" class=\"wp-block-code\"><code><\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\">If trying to access the database from a remote computer and one receives the following error: \u201cxxx.xxx.xxx.xxx is not allowed to connect to this MySQL Server\u201d, simply create a user account and grant privileges to that remote user.<\/p>\n\n\n\n<pre class=\"wp-block-code has-normal-font-size\"><code>#CREATE USER 'newuser'@'remote_ip' IDENTIFIED BY 'password';\n#GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'remote_ip' WITH GRANT OPTION;\n\nOR\n\n#CREATE USER 'newuser'@'%' IDENTIFIED BY 'password';\n#GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'%' WITH GRANT OPTION;\n#FLUSH PRIVILEGES;\n<\/code><\/pre>\n\n\n\n<p><\/p>\n<\/body>","protected":false},"excerpt":{"rendered":"<p>To install MySQL, in the terminal window, type the following command: Once the install completes, start the MySQL Service: Enable it to automatically start at system boot Next, verify the status Thereafter,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":517,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[35,34],"tags":[],"class_list":["post-397","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mysql","category-redhat-linux","has-thumbnail"],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ouritsource.com\/blog\/wp-content\/uploads\/2022\/04\/ChatGPT-Image-May-29-2025-01_32_02-PM.png?fit=1024%2C1024&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ouritsource.com\/blog\/wp-json\/wp\/v2\/posts\/397","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ouritsource.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ouritsource.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ouritsource.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ouritsource.com\/blog\/wp-json\/wp\/v2\/comments?post=397"}],"version-history":[{"count":5,"href":"https:\/\/ouritsource.com\/blog\/wp-json\/wp\/v2\/posts\/397\/revisions"}],"predecessor-version":[{"id":518,"href":"https:\/\/ouritsource.com\/blog\/wp-json\/wp\/v2\/posts\/397\/revisions\/518"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ouritsource.com\/blog\/wp-json\/wp\/v2\/media\/517"}],"wp:attachment":[{"href":"https:\/\/ouritsource.com\/blog\/wp-json\/wp\/v2\/media?parent=397"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ouritsource.com\/blog\/wp-json\/wp\/v2\/categories?post=397"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ouritsource.com\/blog\/wp-json\/wp\/v2\/tags?post=397"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}