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

How to install and configure mysql8.0.18 in linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail how to install and configure mysql8.0.18 in linux. Xiaobian thinks it is quite practical, so share it with you as a reference. I hope you can gain something after reading this article.

This article records the linux mysql 8.0.18 installation configuration graphic tutorial, for your reference, the specific content is as follows

1. Official website installation package download address

2. I upload the installation package to the Linux server through xftp here

3. decompression

Decompression command: tar -xvf mysql-8.0.18-linux-glibc2.12-x86_64.tar

Continue to decompress the one you need

Command: tar -xvf mysql-8.0.18-linux-glibc2.12-x86_64.tar.xz

Rename and move to the appropriate path

Rename: mv mysql-8.0.18-linux-glibc2.12-x86_64 mysql

Move:

4. Create the data folder under/usr/local/mysql

# mkdir data

5. Initialize the database, automatically generate passwords to be recorded, etc.

# bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

ps: Encountered a pit in the middle, reported an error when initializing the database

bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

The solution is: yum install libaio-devel. x86_64 The reason is the lack of libaio this thing installation is done

Execute initialization command again

Get the initialization password, need to write it down, will use it later

6. Users who modify/usr/local/mysql current directory

# chown -R root:root ./# chown -R mysql:mysql data

7. Copy my-default.cnf to etc/my.cnf

Specific orders are:

# cd support-files/# touch my-default.cnf# chmod 777 ./ my-default.cnf # cd ../# cp support-files/my-default.cnf /etc/my.cnf

8. After that, configure my.cnf

vim /etc/my.cnf

Content:

[mysqld]# Remove leading # and set to the amount of RAM for the most important data# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.# innodb_buffer_pool_size = 128M# Remove leading # to turn on a very important data integrity option: logging# changes to the binary log between backups.# log_bin# These are commonly set, remove the # and set as required.basedir = /usr/local/mysqldatadir = /usr/local/mysql/datasocket = /tmp/mysql.socklog-error = /usr/local/mysql/data/error.logpid-file = /usr/local/mysql/data/mysql.pidtmpdir = /tmpport = 5186#lower_case_table_names = 1# server_id = .....# socket = .....# lower_case_table_names = 1max_allowed_packet=32Mdefault-authentication-plugin = mysql_native_password#lower_case_file_system = on#lower_case_table_names = 1log_bin_trust_function_creators = ON# Remove leading # to set options mainly useful for reporting servers.# The server defaults are faster for transactions and fast SELECTs.# Adjust sizes as needed, experiment to find the optimal values.# join_buffer_size = 128M# sort_buffer_size = 2M# read_rnd_buffer_size = 2M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

If mysql runs with errors later, you can directly view the error log in the log-error = /usr/local/mysql/data/error.log directory.

The requested URL/data/error.log was not found on this server.

9./usr/local/mysql/support-files

# cd support-files/# cp mysql.server /etc/init.d/mysql # chmod +x /etc/init.d/mysql

10. Registration service

# chkconfig --add mysql

11. See if it works.

12.etc/ld.so.conf To configure the path, otherwise an error is reported

# vim /etc/ld.so.conf

Add the following:

/usr/local/mysql/lib

13. Configure environment variables

# vim /etc/profile# source /etc/profile

Add the following:

#MYSQL ENVIRONMENTexport PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/lib

14. Login requires the password generated above

#Start mysql service [root@localhost bin]# service mysql starting MySQL.Logging to '/usr/local/mysql/data/error.log'... SUCCESS! [root@localhost bin]# #fix mysql password mysql> alter user 'root'@'localhost' identified by '123456';Query OK, 0 rows affected (0.02 sec)mysql>

ps: The second pit, the error occurred during startup. Details are as follows:

Starting MySQL... The server quit without updating PID file [FAILED]cal/mysql/data/mysql.pid).

The error turned over an afternoon, around a circle, the final problem is my.cnf file configuration problem, do not think that the #is commented off, check n times, think there is no wrong, the result is not good, there is no way to find another server my.cnf configuration, copy replacement slightly modified, solve the problem.

It's done! Database connections can be made using visualization tools.

Installation complete.

About "how to install and configure mysql8.0.18 in linux" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.

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