CentOS Learning Note--mysql installation

Source: Internet
Author: User

MySQL Installation

The most widely used database in Linux is MySQL, which is installed in the online Yum version behind several small versions of the MySQL website, and this section personally tests the installation of the new version of MySQL.

Test machine Environment:

VMware Workstation 10 virtual machines

Memory: 1G

Linux version: CentOS MINIMALCD 6.5

Java:java_home=/opt/jdk

Before you install MySQL, you need to query the system for MySQL-related software.

Rpm-qa | Grep-i MySQL  //grep-i is not divided into uppercase and lowercase character query, as long as it contains MySQL display
Screen display:
mysql-libs-5.1.71-1.el6.i686  //It is dependent on several software, in which the mini version of Postfix software relies on mysql-Libs, many suggestions on the network are directly deleted, yum remove MySQL -libs or rpm-e--nodeps mysql-libs-5.1.71-1.el6.i686, always feel this is not good.
Find MySQL official information, get the installation method is to replace mysql-libs-5.1.71-1.el6.i686 with Mysql-shared-compat with the same version after installing MySQL.

Download MySQL Address: http://dev.mysql.com/downloads/mysql/

CentOS is the Redhatlinux series, so choose Redhatlinux (see Red Line place), the webpage will automatically become redhatlinux about MySQL download:

Need to download 2 content, One is Mysql-5.6.21-1.el6.i686.rpm-bundle.tar, this is a collection of several programs, and the other is mysql-shared-compat-5.6.21-1.el6.i686.rpm, which is a package including MySQL Shared library of 3.23 and MySQL 4.0. If you installed the app to dynamically connect MySQL 3.23, but you want to upgrade to Ysql 4.0 instead of breaking the library's dependencies, install the package instead of installing mysql-shared. This installation package is included from MySQL 4.0.13.

Upload 2 files to CentOS and unzip the Mysql-5.6.21-1.el6.i686.rpm-bundle.tar.

#Tar xvf mysql-5.6.21-1.el6.i686.rpm-bundle.tarMysql-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 root 210442240 Nov 11:12 mysql-5.6.21-1.el6.i686.rpm-Bundle.tar-rw-r--r--. 1 7155 wheel 17813608 Sep 16:25 mysql-client-5.6.21-1. el6.i686.rpm-rw-r--r--. 1 7155 wheel 3131328 Sep 16:25 mysql-devel-5.6.21-1. el6.i686.rpm-rw-r--r--. 1 7155 wheel 83106000 Sep 16:25 mysql-embedded-5.6.21-1. el6.i686.rpm-rw-r--r--. 1 7155 wheel 54611632 Sep 16:26 mysql-server-5.6.21-1. el6.i686.rpm-rw-r--r--. 1 7155 wheel 1878756 Sep 16:27 mysql-shared-5.6.21-1. el6.i686.rpm-rw-r--r--. 1 root root 4141488 Nov 14:42 mysql-shared-compat-5.6.21-1. el6.i686.rpm-rw-r--r--. 1 7155 wheel 49887932 Sep 16:27 mysql-test-5.6.21-1.el6.i686.rpm
Install Mysql-shared-compat replace Mysql-libs, if not replaced, when deleting mysql-libs, you will be prompted Postfix to rely 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
Test Mysql-server installation, prompting for Perl to be installed:
# RPM-IVH--test mysql-server-5.6.21-1.el6.i686.rpm # Yum Install Perl
Install Mysql-server,mysql-client:
#RPM-IVH mysql-server-5.6.21-1.el6.i686.rpmPreparing ...########################################### [100%]1:mysql-server########################################### [100%]................... ......... A RANDOM PASSWORD has BEEN SET forThe MySQL root USER!You'll find that passwordinch'/root/. Mysql_secret '. You must change this password on your first connect,no other statement but ' SET password ' would be accepted. See the manual forThe semantics of the ' password expired ' flag. Also, the account forThe anonymous user has been removed.inchaddition, you can run:/usr/bin/mysql_secure_installation ........ ....................#RPM-IVH mysql-client-5.6.21-1.el6.i686.rpmPreparing ...########################################### [100%]1:mysql-client########################################### [100%]
In the installation mysql-server, see the above paragraph, the effect is the new installation of the root password in/root/.mysql_secret, which is a random password, you need to run/usr/bin/mysql_secure_installation , delete the anonymous user. Of course, the root user is not recommended to run, the RPM package has been built a MySQL user, you can use this user:
#More . Mysql_secret#The random password set for the root user at Tue Nov 22:57:46 (Local tIME): nljql63oylgo5cqy <– get root access to MySQL password: nljql63oylgo5cqy#service MySQL startStarting MySQL ... success!#/usr/bin/mysql_secure_installation--user=mysqlNote:running all PARTS of this SCRIPT is RECOMMENDED forAll MySQL SERVERSinchPRODUCTION use! Please READ each STEP carefully!inchorder to log into MySQL to secure it, we ll need the CurrentPassword forThe root user.IfYou ' ve just installed MySQL, Andyou Haven ' t set the root password yet, the password would be a blank,so you should just Press ENTER here. Enter Current Password forRoot (enter forNone): <– uses the root password you just got 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 has a root password set so that you can safely answer ' n '. Change the root password? [y/N] y <– whether to replace the root user password, enter y and return, it is strongly recommended to replace the new password: <– set the root user's password re-Enter new password: <– Enter the password you set again password updated successfully!Reloading Privilege tables ..... Success! bydefault, a MySQL installation has a anonymous user, allowing Anyoneto log into MySQL without had to had a user account C reated forthem. this was intended only fortesting, and to make the Installationgo a bit smoother. You should remove them before moving into aproduction environment. Remove Anonymous Users? [y/N] Y <– whether to delete anonymous users, production environment is recommended to delete, so enter Y and return ... Success!normally, Root should only is allowed to connect from ' localhost '. Thisensures that someone cannot guess at the root of password from the network. Disallow Root Login remotely? [y/n] Y <– whether to prohibit root telnet, choose according to their own needs y/N and enter, recommended forbidden ... Success! bydefault, MySQL comes with a database named ' test ' that anyone canaccess. This was also intended only fortesting, and should is 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 return-Dropping test database ... Success! -removing privileges on test database ... Success!reloading the privilege tables would ensure that all changes made so farwill take effect immediately. Reload Privilege Tables now? [y/N] y to reload the permission table, enter Y and return ... Success! All done!IfYou've completed all of the above steps and your mysqlinstallation should now is secure. Thanks forUsing mysql!Cleaning up ...
At this point, MySQL has been installed, and finally see if 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: Offcrond0:off 1:off 2:on 3:on 4:on 5:on 6: Offip6tables0:off 1:off 2:on 3:on 4:on 5:on 6: Offiptables0:off 1:off 2:on 3:on 4:on 5:on 6: Offiscsi0:off 1:off 2:off 3:on 4:on 5:on 6: Offiscsid0: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: Offmdmonitor0:off 1:off 2:on 3:on 4:on 5:on 6: Offmultipathd0:off 1:off 2:off 3:off 4:off 5:off 6: Offmysql0:off 1:off 2:on 3:on 4:on 5:on 6:off <-See this OK, netconsole.0:off 1:off 2:off 3:off 4:off 5:off 6: Offnetfs0:off 1:off 2:off 3:on 4:on 5:on 6: Offnetwork0:off 1:off 2:on 3:on 4:on 5:on 6: Offpostfix0:off 1:off 2:on 3:on 4:on 5:on 6: Offrdisc0:off 1:off 2:off 3:off 4:off 5:off 6: Offrestorecond0:off 1:off 2:off 3:off 4:off 5:off 6: Offrsyslog0:off 1:off 2:on 3:on 4:on 5:on 6: Offsaslauthd0:off 1:off 2:off 3:off 4:off 5:off 6: Offsshd0: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 following directories are involved in MySQL installation:
Directory Content in the Catalog
/usr/bin Client programs and Scripts
/usr/sbin Mysqld Server
/var/lib/mysql Log files for the database
/usr/share/info Information Format Brochure
/usr/share/man Unix manual page
/usr/include/mysql Include (title) the file
/usr/lib/mysql The Lib package for MySQL
/usr/share/mysql Miscellaneous support files, including error messages) character set file, sample configuration file, SQL database installation
/usr/share/sql-bench Benchmark
Now it's ready to test your MySQL.

CentOS Learning Note--mysql installation

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.