In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how to install MySQL under the Linux system". In the daily operation, I believe that many people have doubts about how to install MySQL under the Linux system. The editor consulted all kinds of materials and sorted out a simple and easy-to-use method of operation. I hope it will be helpful to answer the questions of "how to install MySQL under the Linux system". Next, please follow the editor to study!
Download mysql
Second, set up the directory of users and mysql
1. Set up a mysql group
Enter command: groupaddmysql
2. Set up mysql users and put them into mysql group
Enter the command: useradd-r-g mysql mysql
3. Set the password for mysql users
Enter command: passwdmysql
3. Decompress mysql
1. Move the downloaded mysql package to the Linux virtual machine
2. Copy a copy of the tar package to the / usr/local directory
Enter the command: mv / software/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz / usr/local
3. Decompression
Enter command: cd / usr/local
Enter command: tar xzvfmysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
4. Change the name of the extracted file to mysql
Enter command: mv mysql-5.7.17-linux-glibc2.5-x86_64 mysql
Fourth, configure the relevant startup configuration files
1. Copy my_default.cnf to / etc/my.cnf (read automatically when mysql starts)
Enter command: cpmy-default.cnf / etc/my.cnf
2. Solve the problem of garbled code
Enter command: vi / etc/my.cnf
Change:
[mysql]
Default-character-set=utf8
[mysqld]
Default-storage-engine=INNODB
Character_set_server=utf8
3. Copy mysql.server to / etc/init.d/
Enter command: cp mysql.server / etc/init.d/mysql
4. Modify the / etc/init.d/mysql parameter to give 2 directory locations
Enter command: vi / etc/init.d/mysql
Change: basedir=/usr/local/mysql
Datadir=/usr/local/mysql/data
5. Give the directory / usr/local/mysql change owner
Chown-R user name: group name / usr/local/mysql/
Enter the command: chown-R mysql:mysql / usr/local/mysql/
Initialize the database of mysql
1. Initialize the database
First of all, go to the mysql/bin directory.
Old version of the command: mysql_install_db
New version of the command:. / mysqld-- initialize-- user=mysql-- basedir=/usr/local/mysql-- datadir=/usr/local/mysql/data
Generate a data directory, indicating that the database has been initialized successfully
A temporary password will be generated here (save and remember, it will be used later)
2. Encrypt the database
Enter the command:. / mysql_ssl_rsa_setup--datadir=/usr/local/mysql/data
3. Start mysql
Enter the command:. / mysqld_safe--user=mysql &
& symbol: throws the current process to the background
6. Enter the client
1. Log in
Enter the command:. / mysql-uroot-p
Then enter your temporary password
2. Change the password
Enter the command: set password=password ('your password')
7. Window remotely accesses mysql of Linux virtual machine
1. First, turn off the firewall so that window can connect.
Enter command: systemctlstop firewalld.service
2. Authorize window
Enter the command: grant all privileges on *. * to root@'%' identified by '123456'
3. Window remote connection
Enter the command: mysql-hIP address-uroot-p123456
8. Set the boot to start the mysql service automatically
1. Add service mysql
Enter the command: chkconfig-- add mysql
2. Set the service to boot automatically.
Enter command: chkconfig mysql on
9. Set path environment variable
Enter command: vi / etc/profile
Set the environment variable: export PATH=$JAVA_HOME/bin:/usr/local/mysql/bin:$PATH
After configuring the environment variables, we no longer have to go to the / usr/local/mysql/bin directory to log in. We can now log in to mysql in any directory.
At this point, the study on "how to install MySQL under the Linux system" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.