CentOS Study Notes-MySQL installation, centos-mysql

Source: Internet
Author: User
Tags install perl

CentOS Study Notes-MySQL installation, centos-mysql
Install MySQL

MySQL is the most widely used database in Linux. The version installed using the online yum method lags behind several minor versions on the MySQL website. This section tests and installs the new version of MySQL.

Test the machine environment:

VMware Workstation 10 Virtual Machine

Memory: 1 GB

Linux: CentOS MinimalCD 6.5

JAVA: JAVA_HOME =/opt/jdk

Before installing mysql, You need to query the mysql-related software contained in the system.

Rpm-qa | grep-I mysql // grep-I is a case-insensitive query that only displays
Screen Display:
Mysql-libs-5.1.71-1.el6.i686 // It is dependent on several software, where in the mini version postfix software depends on mysql-libs, a lot of recommendations on the network are directly deleted, yum remove mysql-libs or rpm-e -- nodeps mysql-libs-5.1.71-1.el6.i686, always think this is not good.
Find the mysql official information, get the installation method is to use MySQL-shared-compat to replace the mysql-libs-5.1.71-1.el6.i686 with the same version after installing mysql.

Download mysql address: http://dev.mysql.com/downloads/mysql/

# Tar xvf MySQL-5.6.21-1.el6.i686.rpm-bundle.tar Co., MySQL-client-5.6.21-1.el6.i686.rpmMySQL-devel-5.6.21-1.el6.i686.rpmMySQL-shared-5.6.21-1.el6.i686.rpmMySQL-test-5.6.21-1.el6.i686.rpmMySQL-server-5.6.21-1.el6.i686.rpmMySQL-embedded-5.6.21-1.el6.i686.rpm # ls-ltotal 415068-rw-r -- r --. 1 root 210442240 Nov 11 MySQL-5.6.21-1.el6.i686.rpm-bundle.tar-rw-r -- r --. 1 7155 wheel 17813608 Sep 12 MySQL-client-5.6.21-1.el6.i686.rpm-rw-r -- r --. 1 7155 wheel 3131328 Sep 12 MySQL-devel-5.6.21-1.el6.i686.rpm-rw-r -- r --. 1 7155 wheel 83106000 Sep 12 MySQL-embedded-5.6.21-1.el6.i686.rpm-rw-r -- r --. 1 7155 wheel 54611632 Sep 12 MySQL-server-5.6.21-1.el6.i686.rpm-rw-r -- r --. 1 7155 wheel 1878756 Sep 12 MySQL-shared-5.6.21-1.el6.i686.rpm-rw-r -- r --. 1 root 4141488 Nov 18 MySQL-shared-compat-5.6.21-1.el6.i686.rpm-rw-r -- r --. 1 7155 wheel 49887932 Sep 12 MySQL-test-5.6.21-1.el6.i686.rpmInstall MySQL-shared-compat to replace mysql-libs. If you do not replace mysql-libs, you will be prompted that the postfix depends on mysql-libs:

# rpm -i MySQL-shared-compat-5.6.21-1.el6.i686.rpm# rpm -qa | grep -i mysqlmysql-libs-5.1.71-1.el6.i686MySQL-shared-compat-5.6.21-1.el6.i686# yum remove mysql-libs
To test the installation of MySQL-server, the following prompt is displayed:
# rpm -ivh --test MySQL-server-5.6.21-1.el6.i686.rpm# yum install perl
Install MySQL-server and MySQL-client:
# rpm -ivh  MySQL-server-5.6.21-1.el6.i686.rpmPreparing...                ########################################### [100%]   1:MySQL-server           ########################################### [100%]………………………………A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !You will find that password in '/root/.mysql_secret'.You must change that password on your first connect,no other statement but 'SET PASSWORD' will be accepted.See the manual for the semantics of the 'password expired' flag.Also, the account for the anonymous user has been removed.In addition, you can run:  /usr/bin/mysql_secure_installation………………………………# rpm -ivh  MySQL-client-5.6.21-1.el6.i686.rpmPreparing...                ########################################### [100%]   1:MySQL-client           ########################################### [100%]
When installing MySQL-server, see the above section to ensure that the newly installed root password is at/root /. in mysql_secret, This is a random password. You need to run/usr/bin/mysql_secure_installation to delete the anonymous user. Of course, it is not recommended to run it with the root user. The rpm package has already created a mysql user. You can use this user:
# More. mysql_secret # The random password set for the root user at Tue Nov 18 22:57:46 2014 (local time): NljqL63OYlGo5cqy <-get The root password for accessing mysql: NljqL63OYlGo5cqy # service mysql startStarting MySQL... SUCCESS! #/Usr/bin/mysql_secure_installation -- user = mysqlNOTE: running all parts of this script is recommended for all MySQL servers in production use! Please read each step carefully! In order to log into MySQL to secure it, we'll need the currentpassword for the root user. if you 've just installed MySQL, andyou haven' t set the root password yet, the password will be blank, so you shoshould just press enter here. enter current password for root (enter for none): <-use the obtained root password NljqL63OYlGo5cqyOK, successfully used password, moving on... setting the root password ensures that nobody Can log into the MySQLroot user without the proper authorisation. You already have a root password set, so you can safely answer 'n'. Change the root password? [Y/n] y <-whether to change the password of the root user, enter y and press enter. We strongly recommend that you change the New password: <-set the password of the root user Re-enter new password: <-enter your Password updated successfully again! Reloading privilege tables... Success! By default, a MySQL installation has an anonymous user, allowing anyoneto log into MySQL without having to have a user account created forthem. this is intended only for testing, and to make the installationgo a bit smoother. you shoshould remove them before moving into aproduction environment. remove anonymous users? [Y/n] y <-whether to delete anonymous users. It is recommended to delete anonymous users in the production environment. Therefore, enter y and press enter... Success! Normally, root shoshould only be allowed to connect from 'localhost'. Thisensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y <-whether to disable remote root login. Select Y/n as needed and press Enter. We recommend that you disable... Success! By default, MySQL comes with a database named 'test' that anyone canaccess. this is also intended only for testing, and shocould be removedbefore moving into a production environment. remove test database and access to it? [Y/n] y <-whether to delete the test database. Enter y and press ENTER-Dropping test database... Success! -Removing privileges on test database ...... Success! Reloading the privilege tables will ensure that all changes made so farwill take effect immediately. Reload privilege tables now? [Y/n] y: whether to reload the permission table. Enter y and press enter... Success! All done! If you 've completed all of the above steps, your MySQLinstallation shoshould now be secure. Thanks for using MySQL! Cleaning up...
So far, MySQL has been installed, and finally check whether MySQL has been added to the boot service:
# Chkconfigauditd 0: off 1: off 2: on 3: on 4: on 5: on 6: offblk-availability 0: off 1: on 2: on 3: on 4: on 5: on 6: offcrond 0: off 1: off 2: on 3: on 4: on 5: on 6: offip6tables 0: off 1: off 2: on 3: on 4: on 5: on 6: offiptables 0: off 1: off 2: on 3: on 4: on 5: on 6: offiscsi 0: off 1: off 2: off 3: on 4: on 5: on 6: offiscsid 0: off 1: off 2: off 3: on 4: on 5: on 6: offlvm2-monitor 0: off 1: on 2: on 3: on 4: on 5: on 6: offmdmonitor 0: off 1: off 2: on 3: on 4: on 5: on 6: offmultipathd 0: off 1: off 2: off 3: off 4: off 5: off 6: offmysql 0: off 1: off 2: on 3: on 4: on 5: on 6: off <-The netconsole 0: off 1: off 2: off 3: off 4: off 5: off 6: offnetfs 0: off 1: off 2: off 3: on 4: on 5: on 6: offnetwork 0: off 1: off 2: on 3: on 4: on 5: on 6: offpostfix 0: off 1: off 2: on 3: on 4: on 5: on 6: offrdisc 0: off 1: off 2: off 3: off 4: off 5: off 6: offrestorecond 0: off 1: off 2: off 3: off 4: off 5: off 6: offrsyslog 0: off 1: off 2: on 3: on 4: on 5: on 6: offsaslauthd 0: off 1: off 2: off 3: off 4: off 5: off 6: offsshd 0: off 1: off 2: on 3: on 4: on 5: on 6: offudev-post 0: off 1: on 2: on 3: on 4: on 5: on 6: off
The directories involved after MySQL installation are as follows:
Directory Contents in the directory
/Usr/bin Client programs and scripts
/Usr/sbin MysqldServer
/Var/lib/mysql Database Log Files
/Usr/share/info Information Format Manual
/Usr/share/man Unix manual page
/Usr/include/mysql Including (title) files
/Usr/lib/mysql Mysql lib package
/Usr/share/mysql Miscellaneous support files, including error messages) character setting files, sample configuration files, SQL database installation
/Usr/share/SQL-Example Benchmark
Now, you can test your 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.