Install MySQL online under Linux CentOS

Source: Internet
Author: User

installing MySQL for the first time is easy and quick to install online.


1 to see if MySQL has been installed:

#rpm-qa | grep mysql


If no results are returned, the description does not install MySQL and can be installed completely.


2. Check which MySQL-related installation packages are available on the online server:

#yum list | grep mysql


650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7E/53/wKioL1b80aODUH6OAAMm-6sRVdk743.jpg "title=" Mysql-yum list.jpg "alt=" Wkiol1b80aoduh6oaamm-6srvdk743.jpg "/>

3, install these several can:

#yum install MySQL mysql-server mysql-devel


Or if you don't know which packages to install,

#yum Install mysql*


Install all of the MySQL-related installation packages listed.


650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M02/7E/57/wKiom1b80YTAGB9hAAGbroZA2Fs544.jpg "style=" float: none; "title=" Mysql-yum install-1.jpg "alt=" wkiom1b80ytagb9haagbroza2fs544.jpg "/>"

650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M00/7E/57/wKiom1b80YeBUMODAAILvMF_w0A802.jpg "style=" float: none; "title=" Mysql-yum install-2.jpg "alt=" wkiom1b80yebumodaailvmf_w0a802.jpg "/>"


4, the installation is complete.

Prompt installation is complete, you can find the MySQL package that has been installed:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7E/57/wKiom1b80c6QWqt6AAE4wQpQa5c386.jpg "title=" Mysql-yum-complete.jpg "alt=" Wkiom1b80c6qwqt6aae4wqpqa5c386.jpg "/>


5, after the completion, the MySQL is initialized and configured.


When the installation is complete, a mysqld service appears in the/etc/init.d/directory, which is the MySQL service we just installed.


Start the service:

#/etc/init.d/mysqld Restart //recommended to use restart without start.

Or

#service mysqld Restart


Installing MySQL for the first time, starting the MYSQLD service, initializes the configuration (similar to the following scenario):

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7E/57/wKiom1b800aBho2OAANNMFj9gCg716.jpg "title=" Mysql-ini.jpg "alt=" Wkiom1b800abho2oaannmfj9gcg716.jpg "/>


Once the above initialization is complete, restart MySQL again, there will be no such hint (only initialized at the first boot).

650) this.width=650; "Src=" http://s2.51cto.com/wyfs02/M01/7E/58/wKiom1b807-yLePVAAB0vozMgWs197.jpg " Title= "Mysql-restart.jpg" alt= "Wkiom1b807-ylepvaab0vozmgws197.jpg"/>


When we use MySQL database, we have to start the Mysqld service first, we can

#chkconfig--list | grep mysqld

command to see if the MySQL service is booting automatically. Pass

#chkconfig mysqld on

command to enable the MYSQLD service to boot from start.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7E/55/wKioL1b85R3CJ7IhAACD-gfoctw774.jpg "title=" Mysql-chk.jpg "alt=" Wkiol1b85r3cj7ihaacd-gfoctw774.jpg "/>

(If the Chkconfig mysqld on command is not configured, the 2,3,4,5 is all off, i.e. power-on is not self-booting.) )


6, configure MySQL.

MySQL database after installation will only have a root administrator account, but at this time the root account has not set a password for it, the first time the MySQL service started, the database will be some initialization work, in the output of a large string of information, we see a line of information:

/usr/bin/mysqladmin-u root password ' new-password ' //Set password for root account

So we can use this command to set the password for our root account ( Note: This root account is the root account of MySQL, not the root account of Linux)

# mysqladmin-u root password ' root ' //Use this command to set the root account password to root

At this point, we can pass

#mysql-U root-p

command to log into our MySQL database:

650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M02/7E/59/wKiom1b85vjimO0eAAGQb9X6df0793.jpg "style=" float: none; "title=" mysql-lo.jpg "alt=" Wkiom1b85vjimo0eaagqb9x6df0793.jpg "/>



7, at this point, MySQL installation and basic configuration even if completed, you can use MySQL directly.


main configuration file for MySQL database:

1, /etc/my.cnf This is the main configuration file for MySQL


2, /var/lib/mysql database file storage location for MySQL database


3, /var/log Log output storage location for MySQL database


The 4,mysql database uses the TCP/IP protocol, and its open port is 3306 if accessed over the network. can be done by

#netstat-nap | grep 3306

To see if the MySQL port is turned on.

Install MySQL online under Linux CentOS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.