In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "detailed steps of compilation and installation of MySQL5.6.19". In daily operation, I believe many people have doubts about the detailed steps of compilation and installation of MySQL5.6.19. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "detailed steps of compilation and installation of MySQL5.6.19". Next, please follow the editor to study!
Introduction to MySQL compilation and installation environment:
System environment: RedHat6.3_x64
Mysql version: 5.6.19
First, configure yum source.
The easiest way is to copy the two directories in the image file to a directory on the system.
For example, mine, I copy Packages and repodata / media/pak
[root@zhanglin pak] # ls
Packages repodata
Modify the configuration file of yum. By default, the system has a file with the suffix of repos. You can rm it or rename it by mv. Or you can continue to use the default name.
But one thing is to make sure that there is only one file in the yum.repos.d directory that ends with the repos suffix.
[root@zhanglin pak] # cat / etc/yum.repos.d/yum.repos
[rhel-source]
Name=Red Hat Enterprise Linux $releasever-$basearch-Source
Baseurl= file:///media/pak
Enabled=1
Gpgcheck=0
Explanation:
Baseurl (basic path) = file:///media/pak
Enabled=1 (whether to open yum library or not)
Gpgcheck=0 does not detect K detection
Second, install dependency packages.
1. After configuring the Yum source, install the yum tool.
Yum list
2. Install the dependency package:
Yum install-y gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*
Third, add users & groups.
Groupadd mysql
Useradd-r-g mysql mysql
Fourth, install MySQL.
1. Install cmake tools.
Before installing MySQL, make sure that the Linux system has cmake tools installed. As far as I know, most of them don't, especially all kinds of Linux systems after 6. 0.
These are a few simple instructions on how to install cmake tools.
A. Download cmake first, and it is recommended to choose a new version. When many people choose to download a package, they don't know whether to choose the new version or the old version. I suggest to choose a new version, at least full-featured and more compatible.
B. Decompress the cmake package
C and cd enter the decompressed cmake directory.
D, execute. / configure-cmake is just a tool with no parameters, that is, install to the default location of the system, and you don't have to test where it will be installed.
E, make & & make install-it will be installed in a few minutes
2. Install MySQL
A. Extract the MySQL installation package
[root@zhanglin soft] # tar-zxvf mysql-5.6.19.tar.gn
[root@zhanglin mysql-5.6.19] # cmake\
-DCMAKE_INSTALL_PREFIX=/u01/mysql\
-DMYSQL_DATADIR=/u01/mysql/data\
-DDEFAULT_CHARSET=utf8\
-DDEFAULT_COLLATION=utf8_general_ci\
-DEXTRA_CHARSETS=all\
-DENABLED_LOCAL_INFILE=1
Parameter description:
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-installation directory this is the default installation location for MySQL, but I chose / u01/mysql, which I think is convenient and clear to manage.
-DINSTALL_DATADIR=/usr/local/mysql/data-Database storage directory
-DDEFAULT_CHARSET=utf8-use utf8 characters
-DDEFAULT_COLLATION=utf8_general_ci-check character
-DEXTRA_CHARSETS=all-install all extended character sets
-DENABLED_LOCAL_INFILE=1-allow data to be imported locally
[root@zhanglin mysql-5.6.19] # make-this stage takes a long time
[root@zhanglin mysql-5.6.19] # make install
V. initial configuration of MySQL
(1) set directory permissions
[root@zhanglin~] # cd / u01/mysql
[root@zhanglin mysql] # chown-R root:mysql.-set the owner of all files in the current directory to root, and the group to which they belong is mysql
[root@zhanglin mysql] # chown-R mysql:mysql data
(2) set MySQL service:
[root@zhanglin mysql] # cp support-files/my-medium.cnf / etc/my.cnf-add the startup service of mysql to the system service
(3) create the table of the system database:
[root@zhanglin mysql] # cd / u01/mysql
[root@zhanglin mysql] # scripts/mysql_install_db-- user=mysql-- basedir=/u01/mysql-- datadir=/u01/mysql/data-this is required. It initializes the database, otherwise it will prompt a lot of warnings and errors.
(4) set environment variables:
[root@zhanglin~] # vi / root/.bash_profile-add parameters to PATH=$PATH:$HOME/bin as follows:
PATH=$PATH:$HOME/bin:/u01/mysql/bin:/u01/mysql/lib
[root@zhanglin~] # source / root/.bash_profile-use environment variables to take effect
(5) start mysql manually:
[root@zhanglin~] # cd / u01/mysql
[root@zhanglin mysql] #. / bin/mysqld_safe-- user=mysql-start MySQL, but cannot stop
The startup log is written in this file: / u01/mysql/data/zhanglin.err (here all kinds of information prompted by mysql at startup, including error messages, are recorded)
Turn off the MySQL service
[root@zhanglin mysql] # mysqladmin-u root-p shutdown-the root user of MySQL has not yet configured a password, so if you need to enter a password for a null value, you can simply click enter.
(6) another simple way to start mysql (mysql has been added to the system service):
[root@zhanglin~] # service mysql.server start
[root@zhanglin~] # service mysql.server stop
[root@zhanglin~] # service mysql.server restart
If the above command appears: a service not recognized by mysql.server
Maybe mysql has not been added to the system service yet, so you can add it in another way:
[root@zhanglin mysql] # cp support-files/mysql.server / etc/init.d/mysql-add mysql's startup service to the system service
Note: the main thing is to copy the mysql.server to / etc/init.d and name it mysql. In some systems, mysql.server is in / u01/mysql/share/mysql/mysql.server, while in this system, mysql.server is in / u01/mysql/support-files/mysql.server.
Then use # service mysql start to start mysql.
Or
[root@zhanglin mysql] # / etc/init.d/mysql start
[root@zhanglin mysql] # / etc/init.d/mysql stop
[root@zhanglin mysql] # / etc/init.d/mysql restart
(7) change the password of the root user of MySQL and open a remote connection:
[root@zhanglin~] # mysql-u root mysql
Mysql > use mysql
Mysql > desc user
Mysql > GRANT ALL PRIVILEGES ON *. * TO root@ "%" IDENTIFIED BY "xxxxxx";-the ability to add remote connections to root.
Mysql > update user set Password = password ('xxxxxx') where User='root'
Mysql > select Host,User,Password from user where User='root'
Mysql > flush privileges
Mysql > exit
Log in again: mysql-u root-p
If a remote connection cannot be made, turn off the firewall
[root@zhanglin~] # / etc/rc.d/init.d/iptables stop
Now you can log in, build tables, and so on.
At this point, the study of "detailed steps of compiling and installing MySQL5.6.19" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.