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--
The installation information on the Internet is uneven, there are holes everywhere, it took me a lot of effort to install it, and then tidied myself up, recorded the installation process, and shared it with friends in need.
1. First, go to Mysql's official website to download Mysql5.7.23.
Download address
Official installation documentation
2. Upload files
Use the xftp tool to upload mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz to the server, and then use the command to check if there is a default database.
Rpm-qa | grep mysql
If so, use the command to uninstall
Full name of MySQL that rpm-e already exists
3. Add user groups to specifically manage mysql to improve security
Create a mysql folder under the / usr/local directory, add user groups and users, and switch the groups and users to which the mysql folder belongs to the user groups and users that you just added
[root@localhost local] # mkdir mysql [root@localhost local] # groupadd mysql [root@localhost local] # useradd-r-g mysql-s / bin/false mysql [root@localhost local] # [root@localhost local] # chown-R mysql:mysql mysql # chown-R "permission" or "name": group folder name
The add user group step is not required to be skipped
Then unzip the uploaded mysql file and move it to the / usr/local/mysql folder
Tar-xvf mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz-C / usr/local mv mysql-5.7.23-linux-glibc2.12-x86_64/* / usr/local/mysql
Configure the service of mysql, copy the mysql.server under support-files to / etc/init.d/ and give it a name
[root@localhost mysql] # cp support-files/mysql.server / etc/init.d/mysql
Then modify the parameters of / etc/init.d/mysql
Vi / etc/init.d/mysql
Modify
Basedir=/usr/local/mysql
Datadir=/usr/local/mysql/data
Then configure the configuration file of mysql. In other versions of mysql, there is a default configuration file under support-files, but the 5.7.23 version does not. You need to prepare it yourself. Here is a simple basic configuration. Create a new my.cnf under / etc/. Some may prompt that it already exists, because the default database configuration file is also there, so you can directly overwrite it.
Touch my.cnf
The my.cnf content is as follows
# * * DO NOT EDIT THIS FILE. It's a template which will be copied to the# * * default location during install, and will be replaced if you# * upgrade to a newer version of MySQL. [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
Then change to the bin directory of mysql and execute the following command to initialize the database
[root@localhost bin] # / mysqld-- initialize-- user=mysql-- basedir=/usr/local/mysql-- datadir=/usr/local/mysql/data
After the execution, the default password will be automatically generated. In the execution record, copy it out.
Start the mysql service through the command, and the message "start successfully" will be prompted below
Service mysql start
4. Log in
[root@localhost bin] #. / mysql-uroot-pEnter password: enter the default temporary password
After the login is successful, change the password
Mysql > set password=password ('new password')
For ease of use of the Mysql command, configure the environment variables of mysql
[root@localhost bin] # vi / etc/profile
Make the environment variable effective
[root@localhost bin] # source / etc/profile
There is no need to log in to mysql under bin that switches to mysql.
5. Enable remote login
If the firewall is on, then we need to open the port before we can log in remotely, use the following command to open the designated port, and then restart the firewall
[root@localhost local] # firewall-cmd-- zone=public-- add-port=3306/tcp-- permanent [root@localhost local] # firewall-cmd-reload
Set up remote login for mysql
Mysql > grant all privileges on *. * to root@'%' identified by 'your password'; mysql > flush privileges
6. Set self-boot.
This step is not necessary and does not affect use, but CentOS is generally used as a server, so the MySQL server should be self-started at random
First check the list of self-booting services
[root@localhost local] # chkconfig-- list
Then add the mysql service and set up self-startup
[root@localhost local] # chkconfig-- add mysql [root@localhost local] # chkconfig mysql on
Then use the above command to look at the list of self-starting services again, and you will see that 2-5 of mysql are on (some show on), indicating that the mysql service will start automatically as the machine starts.
The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.
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.