In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces several common ways to install mysql database, the contents of the article are carefully selected and edited by the author, with a certain pertinence, the reference significance for everyone is still relatively great, the following with the author to understand several common ways to install mysql database.
There are three common ways to install MySQL:
Rpm package form
Universal binary form
Source code compilation
1pr rpm packet form
(1) provided by the operating system publisher
(2) official (updated version, fixed more common BUG) www.mysql.com/downloads provided by MySQL
Introduction to rpm package types in MySQL:
MySQL-client client component
MySQL-debuginfo debugs the components of MySQL
MySQL-devel wants to install PHP and other MySQL-dependent component packages for MySQL compilation.
Embedded version of MySQL-embedded MySQL
MySQL-server shared library
MySQL-shared shared library
In order to be compatible with older versions of shared libraries, MySQL-shared-dompat
Test component of MySQL-test MySQL (online processing function)
Installation method:
First of all, you can download the corresponding version of the rpm package from the installation CD or to the website of mysql as follows:
MySQL-server-community-5.5.28-1.rhel5.i386.rpm
MySQL-client-community-5.5.28-1.rhel5.i386.rpm
Then we can use the rpm command to install:
Rpm-ivh MySQL-server-community-5.5.28-1.rhel5.i386.rpm
Rpm-ivh MySQL-client-community-5.5.28-1.rhel5.i386.rpm
One more point to add:
-h use the symbol # to show the progress of installation
-v report on each step of the operation
2, general binary package
(1) the new user runs the process in a secure manner:
?
123groupadd-r mysqluseradd-g mysql-r-s / sbin/nologin-M-d / mydata/data mysqlchown-R mysql:mysql / mydata/data
(2) install and initialize mysql-5.5.28
First of all, download the mysql version of the platform to the local, here is the 32-bit platform, so the choice is mysql-5.5.28-linux2.6-i686.tar.gz
?
1234567tar xf mysql-5.5.28-linux2.6-i686.tar.gz-C / usr/local cd / usr/local/ ln-sv mysql-5.5.28-linux2.6-i686 mysql cd mysql chown-R mysql:mysql. Scripts/mysql_install_db-user=mysql-datadir=/mydata/data chown-R root.
(3) provide the main configuration file for mysql:
?
12cd / usr/local/mysqlcp support-files/my-large.cnf / etc/my.cnf
(4) modify the configuration file:
Modify the value of thread_concurrency in this file to multiply the number of your CPU by 2. For example, use the following line here:
Thread_concurrency = 2
You also need to add the location of the mysql data file as specified in the following line:
Datadir = / mydata/data
(5) provide sysv service scripts for mysql:
?
12cd / usr/local/mysql cp support-files/mysql.server / etc/rc.d/init.d/mysqld
(6) add to the list of services:
?
12chkconfig-add mysqldchkconfig mysqld on
(7) then you can start the service test and use it.
?
1service mysqld start
3, source code compilation
(the installation and compilation method has changed a little, and the configuration process has not changed much, so the steps will not be described in detail later.)
If you want to compile and install MySQL on the Red Hat system of Series 5.0, you must use a cross-platform compiler cmake.
So:
(1) install cmake first
Make is required to install cmake
?
12345tar xf cmake-...tar.gzcd cmake-.../bootstrap uses this script to detect the compilation environment makemake install
(2) compile and install mysql-5.5.28
Using cmake to compile mysql-5.5.28, the way the options have changed is briefly introduced.
Cmake specifies compilation options in a different way than make, which is implemented as follows:
Cmake.
Cmake. -LH or ccmake. Find relevant options that can be used
Options commonly used when specifying the installation path for installation files:
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql specifies the installation path
-DMYSQL_DATADIR=/data/mysql data installation path
-installation path of the DSYSCONFDIR=/etc configuration file
Because MySQL supports many storage engines, the default compiled storage engines include: csv, myisam, myisammrg, and heap. To install other storage engines, you can use compilation options similar to the following:
-DWITH_INNOBASE_STORAGE_ENGINE=1 installs the INNOBASE storage engine
-DWITH_ARCHIVE_STORAGE_ENGINE=1 installs the ARCHIVE storage engine
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 installs the BLACKHOLE storage engine
-DWITH_FEDERATED_STORAGE_ENGINE=1 installs the FEDERATED storage engine
To explicitly specify that a storage engine is not compiled, you can use options similar to the following:
-DWITHOUT__STORAGE_ENGINE=1
For example:
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 does not enable or compile the EXAMPLE storage engine
-DWITHOUT_FEDERATED_STORAGE_ENGINE=1
-DWITHOUT_PARTITION_STORAGE_ENGINE=1
If you want to compile into other features, such as SSL, you can use options like the following to compile with or without a library:
-DWITH_READLINE=1
-DWITH_SSL=system means to use the built-in SSL library on the system
-DWITH_ZLIB=system
-DWITH_LIBWRAP=0
Other common options:
-DMYSQL_TCP_PORT=3306 sets the default port's
-location of sockets for DMYSQL_UNIX_ADDR=/tmp/mysql.sock MySQL inter-process communication
-whether DENABLED_LOCAL_INFILE=1 starts the local LOCAL_INFILE
-what additional character sets are supported by DEXTRA_CHARSETS=all
-DDEFAULT_CHARSET=utf8 default character set
-DDEFAULT_COLLATION=utf8_general_ci default character set collation
-whether DWITH_DEBUG=0 starts the DEBUG function
-whether DENABLE_PROFILING=1 enables performance analysis
If you want to clean up the files generated by the previous compilation, you need to use the following command:
Make clean
Rm CMakeCache.txt
Compilation and installation
?
12345678910111213tar xf mysql-5.5.28.tar.gz cd mysql-5.5.28 groupadd-r mysql useradd-g-r mysql mysql mkdir-pv / data/mydata chown-R mysql:mysql / data/mydata cmake. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_DATADIR=/data/mydata-DSYSCONFDIR=/etc-DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_ARCHIVE_STORAGE_ENGINE=1-DWITH_BLACKHOLE_STORAGE_ENGINE=1-DWITH_READLINE=1-DWITH_SSL=system-DWITH_ZLIB=system-DWITH_LIBWRAP=0-DMYSQL_UNIX_ADDR=/tmp/mysql.sock-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci make make install cd / usr/local/mysql chown-R: mysql. Change the dependency group scripts/mysql_install_db-- user=mysql-- datadir=/data/mydata/ specified data storage location cp support-files/my-large.cnf / etc/my.cnf create configuration file
Edit configuration file
Vim / etc/my.cnf
Add the location of the mysql data file as specified in the following line:
Datadir = / mydata/data
Create execution scripts and start services
?
12345cp support-files/mysql.server / etc/rc.d/init.d/mysqld replication script chmod + x / etc/rc.d/init.d/mysqld execute permissions chkconfig-add mysql added to the list of services service mysqld start startup service bin/mysql startup mysql
After reading the above about several common ways to install mysql database, many readers must have some understanding. If you need to get more industry knowledge and information, you can continue to follow our industry information column.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.