Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Install MySQL under JEESZ distributed architecture 3--CentOs (environment preparation)

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Disclaimer: because the running environment is based on the Linux system, you need to do some preliminary environment preparation before doing this framework.

Many instances of MySQL are installed under CentOs. Because the blog serves as the native tutorial of the framework, detailed installation records are made here. I have downloaded MySQL and uploaded it to the specified directory through ssh. Here, I will explain the installation process directly.

1. Preparatory work

Linux installs the mysql service in two ways:

1) Source code installation, the advantage is that the installation package is relatively small, only more than ten M, the disadvantage is that the installation depends on many libraries, the installation and compilation time is long, and the installation steps are complex and easy to make mistakes.

2) using officially compiled binaries to install, the advantage is that the installation speed is fast, the installation steps are simple, and the disadvantage is that the installation package is very large, about 300m. Here's how linux installs mysql using an officially compiled binary package.

Mysql-5.6.17-linux-glibc2.5-i686.tar.gz (32-bit Linux)

Mysql-5.6.17-linux-glibc2.5-x86_64.tar.gz (64 bit Linux)

Linux system, either 32-bit or 64-bit

two。 Installation steps

1) download the mysql-compiled binary installation package from the mysql official website. On the download page Select Platform: select linux-generic, then pull to the bottom of the page. Download Linux-Generic (glibc 2.5) (x86, 64-bit) for 64-bit systems and Linux-Generic (glibc 2.5) (x86, 32-bit) for 32-bit systems.

2) decompress the 32-bit installation package:

Enter the directory where the installation package is located and execute the command: tar mysql-5.6.17-linux-glibc2.5-i686.tar.gz

3) copy the extracted mysql directory to the local software directory of the system:

Execute the command: cp mysql-5.6.17-linux-glibc2.5-i686/usr/local/mysql-r

Note: do not add / at the end of the directory

Add system mysql groups and mysql users:

Execute commands: groupadd mysql and useradd-r-g mysql mysql

Install the database:

Enter the directory to install the mysql software: execute the command cd / usr/local/mysql

Change the current directory owner to mysql user: execute the command chown-R mysql:mysql. /

Install the database: execute the command. / scripts/mysql_install_db--user=mysql

Change the current directory owner to root user: execute the command chown-R root:root. /

Change the current data directory owner to mysql user: execute the command chown-R mysql:mysql data

At this point, the database is installed.

4) start mysql service and add boot startup mysql service:

Add boot boot: execute the command cp support-files/mysql.server/etc/init.d/mysql and put the startup script in the boot initialization directory

Start the mysql service: execute the command service mysql start

Execute command: ps-ef | when grep mysql sees the mysql service, it indicates that it started successfully, as shown in the figure.

Modify the root user password of mysql. The initial root password is empty:

Execute the command:. / bin/mysqladmin-u root password 'password'

Put the mysql client in the default path:

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

3. Open a remote connection

By default, you cannot use the client to connect remotely. The help.docx provided by Aliyun contains the setting instructions, and the mysql password is stored by default.

Log in first: mysql-uroot-p

Enter password

Usemysql # Open mysql database

# setting host to% means that any ip can connect to mysql. Of course, you can also specify host as an ip

Update user set host='%' where user='root'and host='localhost'

Flushprivileges; # refresh the permissions table to make the configuration effective

Then we can connect to our mysql remotely.

If you want to close the remote connection and restore the default setting of mysql (local connection only), you can do the following:

Usemysql # Open mysql database

# setting host to localhost means you can only connect to mysql locally

Update user set host='localhost' whereuser='root'

Flushprivileges; # refresh the permissions table to make the configuration effective

Note: you can also add a remote connection user whose user name is jeesz, password is jeesz, and permission is% (which means any ip can connect). The command reference is as follows:

Grant all on *. * to 'jeesz'@'%' identifiedby' jeesz'

Flush privileges

For more details, please click on the source address to get:

Http:// × × / technology

Interested friends can go to the ball to share the learning skills: 2042849237

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report