In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. Extract the installation file
1.1 decompression
Tar-zxvf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
Rename mysql-5.6.39-linux-glibc2.12-x86_64 to mysql
Mv mysql-5.6.39-linux-glibc2.12-x86_64 mysql
1.3 copy the extracted mysql directory
Mv mysql / usr/local/
two。 Add users and user groups
2.1 add user Group
Groupadd mysql
2.2 add user mysql to user group mysql
Useradd-g mysql mysql
3. Installation
3.1 change directory to / usr/local/mysql/
[root@hadoop01 ~] # cd / usr/local/mysql/
3.2 create a data folder
[root@hadoop01 mysql] # mkdir. / data/mysql
3.3 modify file permissions
[root@hadoop01 mysql] # chown-R mysql:mysql. /
3.4 install and specify the user and data folder location
[root@hadoop01 mysql] # / scripts/mysql_install_db-- user=mysql-- datadir=/usr/local/mysql/data/mysql
3.5 copy mysql into the service auto-startup
[root@hadoop01 mysql] # cp support-files/mysql.server / etc/init.d/mysqld
3.6 modify the permission to 755, that is, root can execute
[root@hadoop01 mysql] # chmod 755 / etc/init.d/mysqld
3.7 copy the configuration file to etc, because the default startup is to load the configuration file under etc first.
[root@hadoop01 mysql] # cp support-files/my-default.cnf / etc/my.cnf
3.8 modify startup script
[root@hadoop01 mysql] # vi / etc/init.d/mysqld
3.9 modifications:
Basedir=/usr/local/mysql/
Datadir=/usr/local/mysql/data/mysql
3.10 set the server-side coding of msyql database
[root@hadoop01 mysql] # vi / etc/my.cnf
# add an item under [mysqld]: (note: only adding character-set-server=utf8 project code does not work, you need to add init-connect='SET NAMES utf8' item at the same time to take effect)
Character-set-server=utf8
Init-connect='SET NAMES utf8'
MySQL under # Linux is case-sensitive by default. You can make MySQL not case-sensitive by setting it as follows. In Windows, this option is 1.
Lower_case_table_names=1
3.11 add the environment variable and edit / etc/profile so you can use the mysql command anywhere
[root@hadoop01 mysql] # vi / etc/profile
PATH=$PATH:/usr/local/mysql/bin:
# for the changes to take effect immediately, you need to execute the following code
[root@hadoop01 mysql] # source / etc/profile
3.12 start the service
# start mysql
# service mysqld start
# turn off mysql
# service mysqld stop
# restart mysql
# service mysqld restart
# check the running status
# service mysqld status
[root@hadoop01 mysql] # service mysqld start
3.13 when the test connection mysql was installed for the first time, no password was set for root, so you can log in directly.
[root@hadoop01] # mysql-u root
3.14. Set root password
Mysql > UPDATE user SET password=PASSWORD ('newpassword') where USER='root'
Mysql > GRANT ALL PRIVILEGES ON *. * TO 'root'@'%' IDENTIFIED BY' newpassword' WITH GRANT OPTION; # set remote ip connectable
Mysql > FLUSH PRIVILEGES; # remember this sentence, otherwise if you close the previous terminal, the original error will occur again.
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.