In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
How to install mysql in centos7? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
one。 Uninstall the old version
Use the following command to check if MySQL Server is installed
Rpm-qa | grep mysql
If so, uninstall it with the following command
Rpm-e mysql / / normal delete mode rpm-e-- nodeps mysql / / forcefully delete mode. If you use the above command to delete other dependent files, you can use this command to delete them.
Two: install MySQL
1. Installation dependency
Yum-y install make gcc-c++ cmake bison-devel ncurses-devel
two。 Get the source code (it is recommended to download http://mirrors.sohu.com/mysql... from the image of sohu
Mysql5.7 needs the boost library. It is difficult to find a suitable version on the Internet. It is recommended to download the mysql version with the boost library directly.
Wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-boost-5.7.24.tar.gztar xvf mysql-boost-5.7.24.tar.gzcd mysql-5.7.24
3. Compilation and installation
Cmake\-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\-DMYSQL_DATADIR=/usr/local/mysql/data\-DSYSCONFDIR=/usr/local/mysql/etc\-DWITH_MYISAM_STORAGE_ENGINE=1\-DWITH_INNOBASE_STORAGE_ENGINE=1\-DWITH_MEMORY_STORAGE_ENGINE=1\-DWITH_READLINE=1\-DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock\-DMYSQL_TCP_PORT=3306\-DENABLED_LOCAL_INFILE=1\-DWITH_PARTITION_STORAGE_ENGINE=1\-DEXTRA_CHARSETS=all\-DDEFAULT _ CHARSET=utf8\-DDEFAULT_COLLATION=utf8_general_ci\-DDOWNLOAD_BOOST=1-DWITH_BOOST=./boostmake & & make install
The compiled parameters can be referred to http://dev.mysql.com/doc/refm....
Three: configure MySQL
Use the following command to see if there are any mysql users and user groups
Cat / etc/passwd # View user list cat / etc/group # View user group list
If not, create it.
Groupadd mysqluseradd-g mysql mysql
Modify / usr/local/mysql permissions
Chown-R mysql:mysql / usr/local/mysqlmysql5.7.18 will no longer provide the default mysql configuration file Here we find a simple configuration on the Internet, vi / etc/my.cnf and then write the content [client] port = 3306default-character-set=utf8 [mysqld] # General configuration option basedir = / usr/local/mysqldatadir = / usr/local/mysql/dataport = 3306character-set-server=utf8default_storage_engine = InnoDBsql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER NO_ENGINE_SUBSTITUTION configuration service script cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysqlchkconfig mysql on # add to boot startup item service mysql start # Startup mysql add the mysql executable to the path directory, vi / etc/profilePATH=/usr/local/mysql/bin:$PATHexport PATH
Then execute source / etc/profile
Four: initialize mysql
1. Execute the initialization script (the last line of successful initialization will generate a mysql root password. Note that, or you can initialize an account with an empty password with. / mysqld-- initialize--insecure)
Cd / usr/local/mysql/bin./mysqld-initialize-user=mysql-basedir=/usr/local/mysql-datadir=/usr/local/mysql/data...2019-04-11T14:34:15.922856Z 1 [Note] A temporary password is generated for root@localhost: / rTmud (Th6Yy
two。 Firewall opens port 3306
Add ports to Firewalld as follows:
Firewall-cmd-- zone=public-- add-port=3306/tcp-- permanentfirewall-cmd-- reload's answer to the question on how to install mysql in centos7 is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to solve, you can follow the industry information channel for more related knowledge.
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.