In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly gives you a brief talk about the implementation and construction of Wmware MySQL 5.7.16. You can check the relevant professional terms on the Internet or find some related books to supplement them. Here, we will not dabble in, go straight to the topic, and hope to bring you some practical help.
1. Implementation background
Install Mysql database mysql 5.7.
Implementation process:
Install the CentOS 6.7 system on the new CVM and create the MySQL database
1.1 Software environment
Database software:
Mysql-5.7.16-linux-glibc2.5-x86_64.tar
Operating system:
Linux CentOS 6.7 x86_64
1.2 Database environment
Database instance name: mysql
2. Installation of stand-alone database
2.1 installation package
Mysql installation package
Centos image package
2.2 installation process
Software installation process:
First, check whether the Mysql database has been built before installation, and delete it if so.
Check command: rpm-qa | grep mysql
Delete command:
Normal delete mode: rpm-e mysql
Strong delete mode: rpm-e-nodeps mysql
Second, decompress and install the binary package, after decompression, there are the following two packages
Tar-xvf mysql-5.7.16-linux-glibc2.5-x86_64.tar
Mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz
Mysql-test-5.7.11-linux-glibc2.5-x86_64.tar.gz
Perform rm-rf mysql-test-5.7.11-linux-glibc2.5-x86_64.tar.gz operation
All you need is the mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz package.
Establishing users and directories
Delete the previous users and groups, otherwise the user mysql will be established later, and the group mysql will report an error.
# userdel mysql
# groupdel mysql
Create the directory / home/mysql, and then install mysql under this directory.
# mkdir / home/mysql
# mkdir-p / home/mysql/data
# groupadd mysql
# useradd-r-g mysql-d / home/mysql mysql
Change the permissions of mysql: chown mysql:mysql / home/mysql-R
Note: after modification, go to the home directory to check whether the directories related to mysql are mysql:mysql permissions. If not, you need to modify them manually.
4. The preparation environment has been installed, and the installation of the mysql environment has been completed.
Extract the previously obtained mysql-5.7.16-linux-glibc2.5-x86_64.tar to the / home/mysql directory
# tar zxvf mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz-C / home/mysql
At this point, the extracted file (mysql-5.7.11-linux-glibc2.5-x86_64) obtained under / home/mysql is placed in the home directory of mysql and the name is changed:
# mv mysql-5.7.11-linux-glibc2.5-x86_64 / home/mysql/mysql
After that, you can use / home/mysql/mysql to find the installation directory of mysql
Note that if there is no data directory under the mysql directory, create one manually. (see step 3 of the installation process)
V. Directory permission setting
Set mysql and all directory owners and groups under it to mysql:
# cd / home/mysql/mysql
# chown mysql:mysql-R.
VI. Initialization
# / home/mysql/mysql/bin/mysqld-initialize-user=mysql-datadir=/home/mysql/data-basedir=/home/mysql/mysql
The following message appears after successful initialization:
201x-xx-xxT07:10:13.583130Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use-explicit_defaults_for_timestamp server option (see documentation for more details).
201x-xx-xx T07:10:13.976219Z 0 [Warning] InnoDB: New log files created, LSN=45790
201x-xx-xx T07:10:14.085666Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
201x-xx-xx T07:10:14.161899Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 1fa941f9-effd-11e5-b67d-000c2958cdc8.
201x-xx-xx T07:10:14.165534Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
201x-xx-xx T07:10:14.168555Z 1 [Note] A temporary password is generated for root@localhost:
Bs4*2#Y%B4T0-initial password, remember to save
VII. Configuration
Rename the my-default.cnf under mysql/support-files to my.cnf, copy it to / etc (or test under {mysql}, and then make a soft link to / etc):
# cp / home/mysql/mysql/support-files/my-default.cnf / etc/my.cnf
Cp: overwrite `/ etc/my.cnf'? Yes
# vi / etc/my.cnf
Modify or add key configurations in my.cnf:
[mysqld]
Basedir = / home/mysql/mysql
Datadir = / home/mysql/data
Port = 3306
Socket = / tmp/mysql.sock
[client]
Socket = / tmp/mysql.sock
Sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES (it is recommended to ignore it, the landlord has commented here)
Note that the tmp directory does not exist, create it.
Set up mysql to run and boot with the service.
Copy cd / home/mysql/mysql/support-files/mysql.server to / etc/init.d/mysql and set run permissions
# cp / home/mysql/mysql/support-files/mysql.server / etc/init.d/mysql
# chmod + x / etc/init.d/mysql
Register mysql as a boot service
# chkconfig-add mysql on
Of course, you can also turn the service on and off manually:
# / etc/init.d/mysql start
# / etc/init.d/mysql stop
# / etc/init.d/mysql start
3. Verification test
3.1 enter the test
# / home/mysql/mysql/bin/mysql-uroot-p
At this point, a password is required, which is the password generated during the previous initialization.
After being connected, mysql requires that the password of root be changed before any operation can be done.
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
Mysql > alter user 'root'@'localhost' identified by' password'
3.2 check to see if mysql is running
Ps-ef | grep mysqld
Netstat-lnp | grep-I mysql
Expansion
Function: do not need to enter the mysql home directory every time to execute the command to enter the mysql database, this extended knowledge is to add environment variables
Modify the bashrc file. Buddies who don't know where the file is in the library file can be found through "find /-name bashrc".
Add: export PATH=/home/mysql/mysql/bin:$PATH to the last line of the file
Make the environment variable effective: source ~ / .bashrc
Wmware MySQL 5.7.16 implementation and construction analysis will first tell you here, for other related issues you want to know can continue to pay attention to the industry information. Our section will capture some industry news and professional knowledge to share with you every day.
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.