Centos install MySQL

Source: Internet
Author: User
Tags mysql in mysql command line

Installation and configuration of MySQL in CentOS "Go"

Installing databases in Linux the first version of the preferred Mysql,mysql database is distributed on Linux systems, and other options can be postgresql,oracle, etc.

To install MySQL database on Linux, we can download the MySQL database rpm package on its official website, Http://dev.mysql.com/downloads/mysql/5.6.html#downloads, You can download the corresponding database files according to your own operating system.

Here I am the installation of MySQL database through Yum, this way to install, can be related to MySQL some services, jar packages are installed for us, more convenient

See if you have your own MySQL database in your system

[Email protected] ~]# Rpm-qa | grep mysql//This command will check if the MySQL database is already installed on the operating system

Through this command to see if the system is already installed MySQL, you can see my system is relatively clean, not install any version of MySQL, if your system has installed, you can choose to uninstall

[[email protected] ~]# rpm-e mysql//normal delete mode [[email protected] ~]# rpm-e--nodeps MySQL//brute force Delete mode, if you use the above command to delete, prompted to have dependent on the other File, the command can be used to forcefully delete the

Two. Install MySQL using the yum command

[email protected] ~]# Yum List | grep MySQL

We can view the version of MySQL available for download on Yum by command

The database is then installed with the following command

[email protected] ~]# yum install-y mysql-server MySQL Mysql-deve

After waiting for some time, the output:

Indicates that the installation has been successful! Use the following command to view version information for the installed database

[Email protected] ~]# Rpm-qi mysql-server

Three. Initialization of MySQL database and related configuration

After we install the MySQL database, we will find a mysqld service, this is our database service, we can start our MySQL service by entering the service mysqld Start command.

Note : If we are starting the MySQL service for the first time, the MySQL server will first initialize the configuration, such as:

At this point we will see that the first time you start the MySQL server will prompt a lot of information, the purpose is to initialize the MySQL database, when we restart the MySQL service again, will not prompt so much information

When we use MySQL database, we have to start the Mysqld service first, we can through Chkconfig--list | grep mysqld command to see if the MySQL service is booting automatically, if found Mysqld service does not start automatically, we can of course through the Chkconfig mysqld on command to set it to boot, so do not have to manually start each time

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:

We'll set the root user password as root based on this command.

At this point we can log in to our MySQL database via the mysql-u root-p command.

Four. mysql's main configuration information

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

2. Storage location of database files for/var/lib/mysql MySQL Database

Mysql,test is the two database that comes with MySQL database

Now let's go to MySQL command line to create a database try

3./var/log MySQL database log output storage location

Where mysqld.log This file is the log information that is stored in our operation with the MySQL database, we can get a lot of information by viewing the log file.

We all know that the MySQL database binding port number is 3306, so we can use the NETSTAT-ANP command to see if the Linux system is listening to 3306 this port number:

Finally, let's learn some common commands for Linux under MySQL:

can refer to http://www.xxlinux.com/article/development/database/20121106/18532.html

Not to be continued ...

Centos install MySQL

Related Article

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.