In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Writing a blog for the first time, after two years of development, find yourself something meaningful to do after work, share some experience in the development process, and take it as your own notes. sometimes you can't remember something you don't need for a long time. Okay, that's it. Let's go on to explain the detailed steps of uninstalling and installing MySQL in Linux environment. This article takes the MySQL of binary package (source code) installation as an example to explain.
Uninstall the MySQL database
1. Check the mysql service and shut down the service process
(1) after logging in to Linux, execute the service mysqld status or service mysql status command to check the MySQL service status, depending on the file name of the mysql script in the boot initialization directory. This is mysqld.
(2) if it is running, execute the service mysqld stop or service mysql stop command to stop the MySQL service, depending on the file name of the mysql script in the boot initialization directory. This is mysqld.
2. Find the installation directory of mysql and delete it completely
(1) execute find /-name mysql to find directories related to mysql
(2) execute rm-rf 'directory' to delete the found directory
3. Delete the mysql configuration file
(1) execute rm-rf / etc/my.cnf command to delete / etc/my.cnf file
(2) execute the rm-rf/etc/init.d/ mysqld command to delete all files related to mysql under / etc/init.d/, generally including mysql files or mysqld files, and execute the rm-rf/etc/init.d/mysql command if there are mysql files.
4. Delete mysql users and user groups
(1) execute the id mysql command to view MySQL users and user groups
(2) execute userdel mysql command to delete MySQL users and user groups
Mysql uninstall is complete at this point!
Second, install the MySQL database
1. Download the mysql installation package
(1) go to the mysql official website to download the compiled binary installation package, and select the desired version on the download page (if there is only the Windows version of the installation package after entering the download list, you can install XSkyWalker browser to download it, XSkyWalker download address: https://www.jb51.net/softs/192435.html), as shown below:
(2) pull the page to the bottom, download Linux- Generic (glibc 2.5) (x86, 64-bit) for 64-bit system and Linux- Generic (glibc 2.5) (x86, 32-bit) for 32-bit system.
2. Upload and extract the mysql installation package
Upload the downloaded mysql installation package mysql-5.6.16-linux-glibc2.5-x86_64.tar.gz to the linux host through the ftp tool (I upload it to the / usr/local/ directory here). Enter the directory where the installation package is located and execute the command: tar-zxvf mysql-5.6.16-linux-glibc2.5-x86_64.tar.gz to extract the installation package.
3. Add system mysql user groups and users
Execute commands: groupadd mysql and useradd-r-g mysql mysql
4. Install mysql database
(1) execute the command: cd / usr/local enter the directory where MySQL software is installed
(2) execute the command: mv mysql-5.6.16-linux-glibc2.5-x86_64 mysql renames the decompressed document price folder to mysql
(3) execute the command: cd / usr/local/mysql enter the mysql installation directory
(4) execute the command: chown-R mysql:mysql. / modify the current directory owner as mysql user
(5) execute the command:. / scripts/mysql_install_db--user=mysql install the database
(6) execute the command: chown-R root:root. / modify the current directory owner as root user
(7) execute the command: chown-R mysql:mysql. / data modify the current data directory owner to be mysql user
At this point the mysql installation is complete
5. Start mysql service and add boot startup mysql service
(1) execute the command: cd / usr/local/mysql/support-files
(2) execute the command cp my-medium.cnf / etc/my.cnf;cp mysql.server/etc/init.d/mysqld to put the startup script in the boot initialization directory. If my-medium.cnf does not exist (version 5.5 does not exist, version 5.6 does not), execute the command cp my-default.cnf/etc/my.cnf;cp mysql.server / etc/init.d/mysqld
(3) modify the contents of / etc/my.cnf and / etc/init.d/mysqld files, and replace all the default configuration paths / usr/local/mysql in the file contents with the installation directory of mysql. Here, the installation directory is / usr/local/mysql, which does not need to be modified. The main thing is to configure the paths of bin and data.
(4) execute the command: service mysqld start starts the mysql service
(5) execute command: ps-ef | when grep mysql sees the mysql service, it indicates that the service was started successfully, as shown in the figure:
6. Modify the root password of mysql. It is empty by default.
Execute the command: / usr/local/mysql/bin/mysqladmin-u rootpassword 123456123456 is the user password, which can be set according to your own needs.
7. Put the mysql client in the default path
Execute the command: ln-s / usr/local/mysql/bin/mysql/usr/local/bin/mysql
Note: it is recommended to use soft chain, do not directly package file copy, to facilitate the system to install multiple versions of mysql
8. Configure mysql remote access
(1) execute the command: / usr/local/mysql/bin/mysql-u root-p, enter the login password and enter mysql
Note that the console will not display the password when entering the password
(2) execute the command: use mysql; note that the semicolon is also part of the command
(3) create a remote login user and authorize it. Execute the command: grant all privilegeson *. * to root @ "%" identified by '123456' WITH GRANT OPTION
The root in the command is the Telnet name, and 123456 is the Telnet user password, which corresponds to the part covered by the red line on the way.
(4) execute command: flush privileges; forcibly refresh permissions
You can now log in to mysql with the set remote username and password on other hosts
OK! Got it!
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.