In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to build the mysql environment under linux. I hope you will gain a lot after reading this article. Let's discuss it together.
The method to build the mysql environment under linux: first download the Linux version of MySQL and extract the file; then add users and set permissions; then initialize the database and install the SSL service; finally, start the service and log in using the root account.
How to build a mysql environment under linux:
1) download the Linux version of MySQL.
2) warning
If you previously installed MySQL using an operating system native package management system, such as Yum or APT, you may encounter problems when installing with native binaries. Make sure that your previous MySQL installation has been completely removed (using your package management system), and that any other files, such as older versions of data files, have also been deleted. You should also check the configuration files, such as the / etc/my.cnf or / etc/mysql directories, and delete them.
For information on replacing third-party packages with official MySQL packages, refer to the relevant APT or Yum guides.
MySQL relies on the libaio library. If the library is not installed locally, the data directory initialization and subsequent server startup steps will fail. If necessary, install using the appropriate package manager. For example, on Yum-based systems:
Shell > yum search libaio # search for infoshell > yum install libaio # install library
Or, on APT-based systems:
Shell > apt-cache search libaio # search for infoshell > apt-get install libaio1 # install library
3) unzip the file
To install the binary distribution of compressed tar files, unzip it at the installation location of your choice (usually / usr/local/mysql). This creates the directory shown in the following table.
There are generally two compression methods: command line and direct decompression with the system's own.
You can extract the downloaded package directly to the local file; of course, the command line is completely feasible:
After unpacking, move the package to the / usr/local directory on the system and name it mysql
Tar-zxvf mysql-8.0.11-linux-glibc2.12-x86_64.tar.gzmv mysql-8.0.11-linux-glibc2.12-x86_64 / usr/local/mysql
4) add users and set permissions (enter the following commands in order to configure the database)
Groupadd mysqluseradd-r-g mysql- s / bin/false mysqlcd / usr/localcd mysqlmkdir mysql-fileschown mysql:mysql mysql-fileschmod 750mysql-files
5) initialize the database
Bin/mysqld-initialize-user=mysql
You can see that the system randomly assigns a password to root users, as shown in the figure. This password should be remembered and can be changed after customization.
6) install the SSL service (usually the distribution will help you install it in advance)
Install openssl before executing the installation command, otherwise an error will be reported
Apt install opensslbin/mysql_ssl_rsa_setup
7) copy service files
Cp support-files/mysql.server / etc/init.d/mysql.server
8) start the service
& means to run in the background. After executing the command, the terminal will be stuck in a location, and then click Enter, as shown in the figure.
9) sign in using your root account
Bin/mysql-uroot-p
10) change the root user password
Using random login for the first time does not work, so we need to change the password as follows
(1). Plan 1: restrict local login
ALTER USER 'root'@'localhost' IDENTIFIED BY' New password; flush privileges
(2) Scheme 2: you can log in with a third-party client with any IP.
ALTER USER 'root'@'localhost' IDENTIFIED BY' password 'PASSWORD EXPIRE NEVER; # modify root password and encryption method use mysql; # switch to mysql library update user set host='%' where user =' root'; # change the IP that can be logged in to any IPALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY' password; # change the root user password again so that they can access flush privileges at any IP # Refresh permissions after reading this article, I believe you have some understanding of how to build a mysql environment under linux. If you want to know more about it, welcome to follow the industry information channel. Thank you for reading!
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: 260
*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.