In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Preface
Linux in the most widely used database is MySQL, this article will give you a detailed introduction on the Linux installation of MySql 5.7.21 steps, the article will be introduced in great detail, for everyone's study or work has a certain reference learning value, the following words do not say much, let's take a look at the detailed introduction.
One: download the latest mysql package mysql-5.7.21-linux-glibc2.12-x86_64 from the MySQL official website
Official download address: https://dev.mysql.com/downloads/mysql/
Download address: https://www.jb51.net/softs/38849.html
Second: decompress the mysql package in linux / usr/local/ and rename it to mysql
Cd / usr/local/tar-xzvf mysql compressed package name
Three: create a user group mysql, create a user mysql and add it to the user group mysql, and grant read and write permissions
Groupadd mysql-create a mysql user group group
Useradd-r-g mysql mysql-create a mysql user and add it to the mysql user group
Chown-R mysql mysql/-- assign mysql directory access to the myql user
Chgrp-R mysql mysql/-the user group that changes the mysql directory belongs to the mysql group
Note:
Chmod command
Used to change the access permissions of a file or directory. Users use it to control access to files or directories.
Chgrp command
Change the group to which the file or directory belongs.
-R processes all files in the specified directory and its subdirectories
Four: create a configuration file to save and exit
Vim / etc/my.cnf# copy the following content [client] port = 3306socket = / tmp/ mysql.sock [mysqld] character_set_server=utf8init_connect='SET NAMES utf8'basedir=/usr/local/mysqldatadir=/usr/local/mysql/datasocket=/tmp/mysql.socklog-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid# is case-insensitive lower_case_table_names = 1sqlcards modewritten STRICTRANSRANSTABLES NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTIONmax_connections=5000default-time_zone ='+ 8VR 00'
Five: initialize the database
# install this thing first, otherwise initialization may report an error yum install libaio# manually edit the log file without writing anything, just save and exit cd / var/log/vim mysqld.log:wqchmod 777 mysqld.logchown mysql:mysql mysqld.log/usr/local/mysql/bin/mysqld-- initialize-- user=mysql-- basedir=/usr/local/mysql-- datadir=/usr/local/mysql/data-- lc_messages_dir=/usr/local/mysql/share-- lc_messages=en_US
Six: check the initial password
Cat / var/log/mysqld.log
Last line: root@localhost: here is the initial password
Seven: start the service, enter mysql, change the initial password, and run the remote connection
# if prompted that the password must be changed to perform the operation, perform the following operations: set password=password ('new password'); flush privileges;UPDATE `mysql`.`user`SET `Host` ='%', `User` = 'root' WHERE (`Host` =' localhost') AND (`User` = 'root') # then do the following to start the mysql service, and set the relevant permissions cd / var/run/mkdir mysqldchmod 777 mysqldcd mysqldvim mysqld.pidchmod 777 mysqld.pidchown mysql:mysql mysqld.pid / usr/local/mysql/support-files/mysql.server start/usr/local/mysql/bin/mysql-uroot-p the initial password you see above # the following is the sql statement use mysql after entering the database UPDATE `mysql`.`user`SET `Host` ='%', `User` = 'root', `Process_ priv` =' YQing, `Insert_ priv` = 'YQing, `Index_ priv` =' YQing, `Delete_ priv` = 'YQing, `Create_ priv` =' YQing, `Drop_ priv` = 'YQing, `Reload_ priv` =' YQing, `Process_ priv` = 'YQing, `File_ priv` =' YQing, `Grant_ priv` = 'YQing, `References_ priv` =' YQing, `Index_ priv` = 'YQing, `Alter_ priv` =' YQing, `Show_db_ priv` = 'YQing, Super_ priv` `Create_routine_ priv` = 'Show_view_ priv`, `Create_routine_ priv` =' Create_routine_ priv`, `Alter_routine_ priv` = 'YQing, `Create_user_ priv` =' YQing, `Create_user_ priv` = 'YQing, `Create_tablespace_ priv` =' YQing, `ssl_ type `='', `ssl_ cipher` ='', `x509issuer` ='' `x509 _ connect` ='', `max_ updates` ='0#, `max_ connections` ='0#, `max_user_ connections` ='0#, `plugin` = 'mysql_native_password', `authentication_ string` =' * 6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9regions, `password_last_ changed` = '2017-11-20 max_ 41VR 07mm, `password_ lifetime` = NULL, `account_ locked` =' N' WHERE (`User` = 'root') Flush privileges
Eight: start up automatically
Cd / usr/local/mysql/support-filescp mysql.server / etc/init.d/mysqldchkconfig-- add mysqld
Nine: start / stop the service using the service mysqld command
Su-mysqlservice mysqld start/stop/restart remote user establishes grant all privileges on *. * to 'new username' @% 'identified by' new password'; flush privileges; adds system path vim / etc/profileexport PATH=/usr/local/mysql/bin:$PATHsource / etc/profile
Use navicat to enter user password connection mysql completed successfully!
Summary
The above is the whole content of this article, I hope that the content of this article has a certain reference and learning value for your study or work, if you have any questions, you can leave a message and exchange, thank you for your support.
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.