In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Let's learn about the simple method of installing mysql under centos7. I believe you will benefit a lot after reading it. I hope this short article is what you want.
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
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/mysql
Mysql5.7.18 no longer provides the default mysql configuration file. Here we find a simple configuration on the Internet.
Vi / etc/my.cnf and then write something
[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_pISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Configure service script
Cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysqlchkconfig mysql on # added to boot startup item service mysql start # launch mysql
Add the mysql execution file to the path directory, vi / etc/profile
PATH=/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-permanent
Firewall-cmd-reload
After reading this article on how to install mysql under centos7, many readers will want to know more about it. For more industry information, you can follow our industry information section.
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.