In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. Install MySQL on Linux
Installation steps:
1) decompress the tar.gz file
Shell > tar-zxvf mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz
2) initialize the default database (mysql, performace_schema, sys, information_schema)
The structure under the / home/bes/jinuo/mysql directory is as follows:
/ home/bes/jinuo/mysql / mysql-5.7.9-glibc2.5-x86_64 / bin / docs / include / lib / man / share / support-files / test / ins1 / my-default.cnf
Copy the support-files directory to the directory where you want to make the mysql instance, and edit it as follows:
[mysqld] basedir=/home/bes/jinuo/mysql/mysql-5.7.9-linux-glibc2.5-x86_64datadir=/home/bes/jinuo/mysql/test/ins1/datadirport=36001server_id=36001socket=/home/bes/jinuo/mysql/test/ins1/mysql.socklog-error=/home/bes/jinuo/mysql/test/mysqld.logexplicit_defaults_for_timestamp=truecharacter-set-server=utf8collation-server=utf8_general_ciskip-host-cachesql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
Then initialize by executing the following command:
Ordinary users can directly execute the following commands:
Shell > bin/mysql_install_db # Before MySQL 5.7.6shell > bin/mysqld-- initialize # MySQL 5.7.6 and up
If you are operating root users of each household to create mysql instances, you need to specify which user to create the instance for when creating the instance.
That is, if you are a regular user hello, you can use the above command to create your own instance directly.
If you want the root user to create an instance for you, you need to add the-- user=hello parameter to the above command.
Root users: shell > mysqld-- defaults-file=/your/mysql/cnf/path-- initialize-insecure-- user=username > mysqld-- defaults-=/your/mysql/cnf/path-- initialize-insecure
During initialization, a temporary password is created for the mysql root user. The location of the temporary password can be found as follows:
MySQL 5.6.x: A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER! You will find that password in'/ root/.mysql_secret'.You must change that password on your first connect,no other statement but 'SET PASSWORD' will be accepted.See the manual for the semantics of the' password expired' flag.Also, the account for the anonymous user has been removed.
MySQL 5.7.x: if initialization uses-- initialize:# tail-N1 / home/bes/jinuo/mysql/test/ins1/mysqld.log2016-12-11T07:47:58.199154Z 1 [Note] A temporary password is generated for root@localhost: wzgds/:Kf2,g, if initialization uses-- initialize-insecure:
# tail-N1 / var/log/mysql/error.log
2016-12-11T07:51:28.506142Z 1 [Warning] root@localhost is created with an empty password! Please consider switching off the-initialize-insecure option
Therefore, if it is a version above 5.7, it is recommended to use the-- initialize-insecure method to create an instance. This allows you to use mysqladmin directly to change the root password. See 4).
3) start the database
Start MySQL Server:
Shelll > / home/bes/jinuo/mysql/mysql-5.7.9-linux-glibc2.5-x86_64/bin/mysqld-- defaults-file=/home/bes/jinuo/mysql/test/ins1/my-default.cnf &
4) change the password if you know the password
Mysqladmin provides a set of mysql administrative commands, one of which is the password command, which is used to change the password. The premise of using mysqladmin to change the password is that you know the password, because it internally uses the existing login to mysql server, and then changes the password.
You can use the mysqladmin command directly to change the password. For example, change the root password from the empty password after installation to 12345678
Mysqladmin-u root-- socket=/home/bes/mysql/mysql.sock password 12345678
If you want to change the password from 12345678 to 123456 during use:
Mysqladmin-u root-p 12345678-- socket=/home/bes/mysql/mysql.sock password 123456
Change the passwords of other users in the same way.
5) Grant permissions to root
Mysql > grant all on *. * to 'root'@'%' identified by' yourRootPassword';2, stand-alone multi-instance installation
If you want to install multiple mysql instances on one machine, you only need to repeat 2) 3) 4) 5) in 1.
3. Modify root password and authorization if you don't know root password.
This method is suitable for situations where you have a root password but do not know the root password.
A: stop MySQL Server
B: bypass authorization check to start MySQL Server
Shell > / home/bes/jinuo/mysql/mysql-5.7.9-linux-glibc2.5-x86_64/bin/mysqld-defaults-file=/home/bes/jinuo/mysql/test/ins1/my-default.cnf-skip-grant-tables &
C: the root user logs in to mysql server and switches to the mysql library
Shell > / home/bes/jinuo/mysql/mysql-5.7.9-linux-glibc2.5-x86_64/bin/mysql-- socket=/home/bes/jinuo/mysql/test/ins1/mysql.sock-uroot-pmysql > use mysql
D: modify the password of the root user:
Mysql > update mysql.user set authentication_string = password ('mypassword') where user =' root';mysql > flush privileges;mysql > quit
E: stop mysql server and start normally.
The mode of normal startup has been mentioned in the previous 3).
F: after logging in to root, adjust the authorization:
Shell > / home/bes/jinuo/mysql/mysql-5.7.9-linux-glibc2.5-x86_64/bin/mysql-- socket=/home/bes/jinuo/mysql/test/ins1/mysql.sock-uroot-pEnter Passwordmysql > grant all on *. * to 'root'@'%' identified by' yourRootPassword'
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.