{"id":16,"date":"2017-10-08T04:59:00","date_gmt":"2017-10-08T04:59:00","guid":{"rendered":"https:\/\/linuxadmin.melberi.com\/uncategorized\/how-to-install-mysql-in-linux"},"modified":"2017-10-08T08:18:55","modified_gmt":"2017-10-08T08:18:55","slug":"install-mysql-in-linux","status":"publish","type":"post","link":"https:\/\/www.melberi.com\/linuxadmin\/mysql\/install-mysql-in-linux","title":{"rendered":"MySql Command Line Installation Procedure"},"content":{"rendered":"<p>How To Install Mysql On Linux Fedora Cent OS Ubuntu Linux Redhat Debian through Command Line<\/p>\n<p>There are multiple ways to install mysql on Linux machine<\/p>\n<h3><u>Installing through dnf or yum<\/u><\/h3>\n<p>If your server is on internet and yum or dnf repository is enabled, then you can install directly by running the below command on linux console.<\/p>\n<p><strong>#dnf install -y mysql-server<\/strong><\/p>\n<p>Installing:<br \/>\nmysql-server x86_64 5.1.47-2.fc12<br \/>\nInstalling for dependencies:<br \/>\nperl-DBD-MySQL x86_64 4.016-1.fc12<br \/>\nperl-DBI x86_64 1.609-3.fc12<br \/>\nUpdating for dependencies<br \/>\nmysql x86_64 5.1.47-2.fc12<br \/>\nmysql-libs x86_64 5.1.47-2.fc12<\/p>\n<h3><u>Installing from RPM<\/u><\/h3>\n<p>Download the latest mysql-server rpm from <a href=\"http:\/\/rpm.pbone.net\/\">rpm.pbone.net<\/a><\/p>\n<p>You may need to download and install the dependency packages (mysql-libs, mysql, perl-DBD-MySQL, perl-DBD ) before installing mysql-server<\/p>\n<p>Transfer the downloaded file to the server using winscp or some other file transfer method<\/p>\n<p><b>#rpm -ivh mysql-libs* mysql* perl-DBD-MySQL* perl-DBD*<br \/>\n#rpm -ivh mysql-server*<\/b><\/p>\n<h3><u>Initial Configurations<\/u><\/h3>\n<p>After installing the mysql using one of the above method, you can start mysql with the default my.cnf settings<br \/>\n<b><br \/>\n#service mysqld start<\/b><\/p>\n<p>To start mysqld at boot time you have to copy<br \/>\nsupport-files\/mysql.server to the right place for your system.<\/p>\n<p><strong>\/usr\/bin\/mysqladmin -u root password &#8216;new-password&#8217;<\/strong><\/p>\n<p>Alternatively you can run:<br \/>\n\/usr\/bin\/mysql_secure_installation<\/p>\n<p><strong>Default my.cnf file<\/strong><\/p>\n<p><span style=\"color: #808080;\">[mysqld]<\/span><br \/>\n<span style=\"color: #808080;\"> datadir=\/var\/lib\/mysql<\/span><br \/>\n<span style=\"color: #808080;\"> socket=\/var\/lib\/mysql\/mysql.sock<\/span><br \/>\n<span style=\"color: #808080;\"> user=mysql<\/span><br \/>\n<span style=\"color: #808080;\"> # Default to using old password format for compatibility with mysql 3.x<\/span><br \/>\n<span style=\"color: #808080;\"> # clients (those using the mysqlclient10 compatibility package).<\/span><br \/>\n<span style=\"color: #808080;\"> old_passwords=1<\/span><\/p>\n<p><span style=\"color: #808080;\"># Disabling symbolic-links is recommended to prevent assorted security risks;<\/span><br \/>\n<span style=\"color: #808080;\"> # to do so, uncomment this line:<\/span><br \/>\n<span style=\"color: #808080;\"> # symbolic-links=0<\/span><\/p>\n<p><span style=\"color: #808080;\"># To allow mysqld to connect to a MySQL Cluster management daemon, uncomment<\/span><br \/>\n<span style=\"color: #808080;\"> # these lines and adjust the connectstring as needed.<\/span><br \/>\n<span style=\"color: #808080;\"> #ndbcluster<\/span><br \/>\n<span style=\"color: #808080;\"> #ndb-connectstring=&#8221;nodeid=4;host=localhost:1186&#8243;<\/span><\/p>\n<p><span style=\"color: #808080;\">[mysqld_safe]<\/span><br \/>\n<span style=\"color: #808080;\"> log-error=\/var\/log\/mysqld.log<\/span><br \/>\n<span style=\"color: #808080;\"> pid-file=\/var\/run\/mysqld\/mysqld.pid<\/span><\/p>\n<p><span style=\"color: #808080;\">[ndbd]<\/span><br \/>\n<span style=\"color: #808080;\"> # If you are running a MySQL Cluster storage daemon (ndbd) on this machine,<\/span><br \/>\n<span style=\"color: #808080;\"> # adjust its connection to the management daemon here.<\/span><br \/>\n<span style=\"color: #808080;\"> # Note: ndbd init script requires this to include nodeid!<\/span><br \/>\n<span style=\"color: #808080;\"> connect-string=&#8221;nodeid=2;host=localhost:1186&#8243;<\/span><\/p>\n<p><span style=\"color: #808080;\">[ndb_mgm]<\/span><br \/>\n<span style=\"color: #808080;\"> # connection string for MySQL Cluster management tool<\/span><br \/>\n<span style=\"color: #808080;\"> connect-string=&#8221;host=localhost:1186&#8243;<\/span><\/p>\n<h3><u>Set default root password<\/u><\/h3>\n<p>By default there will be <b>no password set for mysql admin<\/b> <b>(root)<\/b>.<\/p>\n<p>Now you can set root password using the below command<\/p>\n<p><strong>#\/usr\/bin\/mysqladmin -u root password &#8216;new-password&#8217;<\/strong><\/p>\n<p>or<\/p>\n<p><b>#mysqladmin -u root password mysqlpasswd <\/b><\/p>\n<p>Now you can login to mysql server using the below commands<\/p>\n<p><b>#mysql -u root -p <\/b><\/p>\n<p><u><b>Related Articles:<\/b><\/u><br \/>\n<b>How to create database<\/b><br \/>\n<a href=\"https:\/\/www.melberi.com\/linuxadmin\/mysql\/reset-mysql-root-password\"><b>How to reset root password<\/b><\/a><\/p>\n<p><b>\u00a0<\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How To Install Mysql On Linux Fedora Cent OS Ubuntu Linux Redhat Debian through Command Line There are multiple ways to install mysql on Linux machine Installing through dnf or&#8230; <a href=\"https:\/\/www.melberi.com\/linuxadmin\/mysql\/install-mysql-in-linux\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[88],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/posts\/16"}],"collection":[{"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/comments?post=16"}],"version-history":[{"count":6,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/posts\/16\/revisions"}],"predecessor-version":[{"id":445,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/posts\/16\/revisions\/445"}],"wp:attachment":[{"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/media?parent=16"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/categories?post=16"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/tags?post=16"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}