国产麒麟系统KylinOS Server V10 SP2安装MySQL 8.0.28—二进制包安装
<h1>一: 操作系统环境检查</h1><h2><strong>1.1 首先确认操作系统版本是KylinOS Server V10 SP2</strong></h2>
<p>麒麟操作系统Kylinos Server V10 SP2使用的安装介质是<br> Kylin-Server-10-SP2-x86-Release-Build09-20210524.iso,执行以下命令查看版本:</p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 255, 1)">cat</span> /etc/kylin-release</pre>
</div>
<p><img src="https://img2023.cnblogs.com/blog/1564514/202309/1564514-20230901145246377-805982697.png"></p>
<p> </p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 255, 1)">cat</span> /proc/version</pre>
</div>
<p><img src="https://img2023.cnblogs.com/blog/1564514/202309/1564514-20230901145307531-1901879556.png"></p>
<p> </p>
<h2><strong>1.2 检查系统是否自带MySQL或MariaDB</strong></h2>
<p>通过以下命令检查是否安装:</p>
<div class="cnblogs_code">
<pre>rpm -qa | <span style="color: rgba(0, 0, 255, 1)">grep</span> mariadb</pre>
</div>
<p><img src="https://img2023.cnblogs.com/blog/1564514/202309/1564514-20230901145337980-1494708657.png"></p>
<p> </p>
<p>如果系统已经安装了其它版本的MySQL或者MariaDB则要将其删除,执行以下命令删除:</p>
<div class="cnblogs_code">
<pre>rpm -e {mariadb-server,mariadb,mariadb-errmessage,mariadb-common}</pre>
</div>
<p> 或使用yum卸载</p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 255, 1)">yum</span> remove mysql mysql-server</pre>
</div>
<p> </p>
<h2><strong>1.3 安装mysql运行所必须的依赖包</strong></h2>
<p>mysql 8.0运行依赖如下包,执行以下命令安装:</p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 255, 1)">yum</span> <span style="color: rgba(0, 0, 255, 1)">install</span> -y <span style="color: rgba(0, 0, 255, 1)">perl</span>-Data-Dumper libaio libaio-<span style="color: rgba(0, 0, 0, 1)">devel
</span><span style="color: rgba(0, 0, 255, 1)">yum</span> <span style="color: rgba(0, 0, 255, 1)">install</span> -y ncurses ncurses-devel ncurses-base ncurses-<span style="color: rgba(0, 0, 0, 1)">libs
</span><span style="color: rgba(0, 0, 255, 1)">yum</span> <span style="color: rgba(0, 0, 255, 1)">install</span> -y openssl openssl-devel openssl-<span style="color: rgba(0, 0, 0, 1)">libs
</span><span style="color: rgba(0, 0, 255, 1)">yum</span> <span style="color: rgba(0, 0, 255, 1)">install</span> -y <span style="color: rgba(0, 0, 255, 1)">bzip2</span> <span style="color: rgba(0, 0, 255, 1)">bzip2</span>-<span style="color: rgba(0, 0, 0, 1)">devel
</span><span style="color: rgba(0, 0, 255, 1)">yum</span> <span style="color: rgba(0, 0, 255, 1)">install</span> -y libtirpc libtirpc-<span style="color: rgba(0, 0, 0, 1)">devel
</span><span style="color: rgba(0, 0, 255, 1)">yum</span> <span style="color: rgba(0, 0, 255, 1)">install</span> -y readline readline-devel</pre>
</div>
<p> </p>
<h1>二:准备MySQL安装包</h1>
<p>此文档安装社区版MySQL 8.0.28,此版本可与Kylinos V10 SP2兼容。</p>
<h2><strong>2.1 下载MySQL安装包</strong></h2>
<p>打开MySQL官网下载页面,选择正确的筛选条件</p>
<blockquote>
<p>https://dev.mysql.com/downloads/mysql/</p>
</blockquote>
<ul>
<li>Select Operating System 选择<strong>Linux-Generic</strong>,</li>
<li>Select OS Version 中有两选择,第一个是选择<strong>glibc2.12(X86_64)</strong>,第二个是选择<strong>glibc2.17(X86_64),</strong>二者区别我们放在文章最后讲述。</li>
</ul>
<p><img src="https://img2023.cnblogs.com/blog/1564514/202309/1564514-20230901145423948-1957622113.png"></p>
<p> </p>
<p>此处我们选择glibc_2.17(X86_64)版本:</p>
<p><img src="https://img2023.cnblogs.com/blog/1564514/202309/1564514-20230901145433790-1400088824.png"></p>
<p> </p>
<h2><strong>2.2 上传MySQL二进制包</strong></h2>
<p>将MySQL 8.0.28的二进制包上传到/root/Documents目录并解压,解压后将所得目录移动到/usr/local目录下。</p>
<div class="cnblogs_code">
<pre>cd /root/<span style="color: rgba(0, 0, 0, 1)">Documents
</span><span style="color: rgba(0, 0, 255, 1)">tar</span> xvf mysql-<span style="color: rgba(128, 0, 128, 1)">8.0</span>.<span style="color: rgba(128, 0, 128, 1)">28</span>-linux-glibc2.<span style="color: rgba(128, 0, 128, 1)">17</span>-x86_64-minimal.<span style="color: rgba(0, 0, 255, 1)">tar</span><span style="color: rgba(0, 0, 0, 1)">.xz
</span><span style="color: rgba(0, 0, 255, 1)">mv</span> mysql-<span style="color: rgba(128, 0, 128, 1)">8.0</span>.<span style="color: rgba(128, 0, 128, 1)">28</span>-linux-glibc2.<span style="color: rgba(128, 0, 128, 1)">17</span>-x86_64-minimal/usr/local/mysql-<span style="color: rgba(128, 0, 128, 1)">8.0</span>.<span style="color: rgba(128, 0, 128, 1)">28</span></pre>
</div>
<p> </p>
<h1>三:配置启动MySQL</h1>
<h2><strong>3.1 创建mysql用户</strong></h2>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">groupadd mysql
useradd </span>-M -g mysql -s /sbin/nologin mysql</pre>
</div>
<p> </p>
<h2><strong>3.2 创建数据目录</strong></h2>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 255, 1)">mkdir</span> /data/mysql/{data,log,redo,undo,arch} -<span style="color: rgba(0, 0, 0, 1)">p
</span><span style="color: rgba(0, 0, 255, 1)">chown</span> mysql.mysql /data -R</pre>
</div>
<p><img src="https://img2023.cnblogs.com/blog/1564514/202309/1564514-20230901145507669-2094362553.png"></p>
<p> </p>
<h2><strong>3.3 创建mysql环境变量</strong></h2>
<p>创建mysql目录软连接</p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 255, 1)">ln</span> -s /usr/local/mysql-<span style="color: rgba(128, 0, 128, 1)">8.0</span>.<span style="color: rgba(128, 0, 128, 1)">28</span>/usr/local/<span style="color: rgba(0, 0, 0, 1)">mysql
</span><span style="color: rgba(0, 0, 255, 1)">chown</span> mysql.mysql mysql-<span style="color: rgba(128, 0, 128, 1)">8.0</span>.<span style="color: rgba(128, 0, 128, 1)">28</span> -R</pre>
</div>
<p><img src="https://img2023.cnblogs.com/blog/1564514/202309/1564514-20230901145524380-692756828.png"></p>
<p> </p>
<p>创建mysql环境变量配置文件</p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 255, 1)">echo</span> <span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">MYSQL_HOME=/usr/local/mysql</span><span style="color: rgba(128, 0, 0, 1)">'</span> >>/etc/profile.d/mysql.<span style="color: rgba(0, 0, 255, 1)">sh</span>
<span style="color: rgba(0, 0, 255, 1)">echo</span> <span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">PATH=$PATH:$MYSQL_HOME/bin</span><span style="color: rgba(128, 0, 0, 1)">'</span> >>/etc/profile.d/mysql.<span style="color: rgba(0, 0, 255, 1)">sh</span>
<span style="color: rgba(0, 0, 255, 1)">echo</span> <span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">export PATH</span><span style="color: rgba(128, 0, 0, 1)">'</span> >>/etc/profile.d/mysql.<span style="color: rgba(0, 0, 255, 1)">sh</span><span style="color: rgba(0, 0, 0, 1)">
source</span>/etc/profile.d/mysql.<span style="color: rgba(0, 0, 255, 1)">sh</span></pre>
</div>
<p><img src="https://img2023.cnblogs.com/blog/1564514/202309/1564514-20230901145544681-1986842061.png"></p>
<p> </p>
<h2><strong>3.4 创建my.cnf配置文件</strong></h2>
<p>编辑/etc/my.cnf文件</p>
<div class="cnblogs_code">
<pre>vim /etc/my.cnf</pre>
</div>
<p>输入以下内容到/etc/my.cnf中,此配置将data、redolog、undo、binlog分别置于独立目录。</p>
<div class="cnblogs_code">
<pre><span style="color: rgba(128, 0, 0, 1); font-weight: bold">[</span><span style="color: rgba(128, 0, 0, 1)">mysql</span><span style="color: rgba(128, 0, 0, 1); font-weight: bold">]</span><span style="color: rgba(0, 0, 0, 1)">
socket</span>=<span style="color: rgba(0, 0, 0, 1)">/data/mysql/data/mysqld.sock
</span><span style="color: rgba(128, 0, 0, 1); font-weight: bold">[</span><span style="color: rgba(128, 0, 0, 1)">mysqld</span><span style="color: rgba(128, 0, 0, 1); font-weight: bold">]</span><span style="color: rgba(0, 0, 0, 1)">
###base config###
server-id</span>=210<span style="color: rgba(0, 0, 0, 1)">
basedir</span>=<span style="color: rgba(0, 0, 0, 1)">/usr/local/mysql
datadir</span>=<span style="color: rgba(0, 0, 0, 1)">/data/mysql/data
socket</span>=<span style="color: rgba(0, 0, 0, 1)">/data/mysql/data/mysqld.sock
pid-file</span>=<span style="color: rgba(0, 0, 0, 1)">/data/mysql/data/mysqld.pid
log-error</span>=<span style="color: rgba(0, 0, 0, 1)">/data/mysql/log/mysqld.log
###query config###
join_buffer_size </span>=<span style="color: rgba(0, 0, 0, 1)"> 128M
sort_buffer_size </span>=<span style="color: rgba(0, 0, 0, 1)"> 16M
read_buffer_size </span>=<span style="color: rgba(0, 0, 0, 1)"> 16M
read_rnd_buffer_size </span>=<span style="color: rgba(0, 0, 0, 1)"> 8M
###open table config###
table_open_cache</span>=2000<span style="color: rgba(0, 0, 0, 1)">
table_open_cache_instances</span>=16<span style="color: rgba(0, 0, 0, 1)">
###connection config###
max_connections</span>=2000<span style="color: rgba(0, 0, 0, 1)">
thread_cache_size</span>=200<span style="color: rgba(0, 0, 0, 1)">
###binlog config###
log_bin</span>=<span style="color: rgba(0, 0, 0, 1)">/data/mysql/log/binlog
log_bin_index</span>=<span style="color: rgba(0, 0, 0, 1)">/data/mysql/log/binlog.index
binlog_format</span>=<span style="color: rgba(0, 0, 0, 1)">ROW
max_binlog_size</span>=<span style="color: rgba(0, 0, 0, 1)">1G
binlog_cache_size</span>=<span style="color: rgba(0, 0, 0, 1)">16M
binlog_expire_logs_seconds</span>=604800<span style="color: rgba(0, 0, 0, 1)">
enforce_gtid_consistency</span>=<span style="color: rgba(0, 0, 0, 1)">ON
gtid_mode</span>=<span style="color: rgba(0, 0, 0, 1)">ON
###general log config###
general_log</span>=<span style="color: rgba(0, 0, 0, 1)">OFF
general_log_file</span>=<span style="color: rgba(0, 0, 0, 1)">/data/mysql/log/mysqld.gnl
###slow query config###
log_output</span>=<span style="color: rgba(0, 0, 0, 1)">FILE
long_query_time</span>=1<span style="color: rgba(0, 0, 0, 1)">
slow_query_log</span>=<span style="color: rgba(0, 0, 0, 1)">ON
slow_query_log_file</span>=<span style="color: rgba(0, 0, 0, 1)">/data/mysql/log/mysqld.slow
###innodb redo log config###
innodb_log_file_size</span>=<span style="color: rgba(0, 0, 0, 1)">1G
innodb_log_files_in_group</span>=3<span style="color: rgba(0, 0, 0, 1)">
innodb_log_buffer_size</span>=<span style="color: rgba(0, 0, 0, 1)">16M
innodb_log_group_home_dir</span>=<span style="color: rgba(0, 0, 0, 1)">/data/mysql/redo
innodb_redo_log_archive_dirs</span>=<span style="color: rgba(0, 0, 0, 1)">/data/mysql/arch
###innodb undo log config###
#innodb_max_undo_log_size</span>=<span style="color: rgba(0, 0, 0, 1)">1G
#innodb_undo_tablespaces</span>=2<span style="color: rgba(0, 0, 0, 1)">
innodb_undo_directory</span>=<span style="color: rgba(0, 0, 0, 1)">/data/mysql/undo
###innodb config###
#innodb_data_file_path</span>=<span style="color: rgba(0, 0, 0, 1)">ibdata1:12M:autoextend
#innodb_temp_data_file_path</span>=<span style="color: rgba(0, 0, 0, 1)">ibtmp1:12M:autoextend
#innodb_temp_tablespaces_dir</span>=<span style="color: rgba(0, 0, 0, 1)">./#innodb_temp/
#innodb_autoextend_increment</span>=64<span style="color: rgba(0, 0, 0, 1)">
innodb_buffer_pool_size</span>=<span style="color: rgba(0, 0, 0, 1)">8G
innodb_open_files</span>=10000<span style="color: rgba(0, 0, 0, 1)">
open_files_limit</span>=10000<span style="color: rgba(0, 0, 0, 1)">
character-set-server</span>=<span style="color: rgba(0, 0, 0, 1)">utf8mb4
lower_case_table_names</span>=1</pre>
</div>
<p> </p>
<h2><strong>3.5 初始化mysql</strong></h2>
<div class="cnblogs_code">
<pre>mysqld --defaults-<span style="color: rgba(0, 0, 255, 1)">file</span>=/etc/my.cnf --initialize --user=mysql</pre>
</div>
<p> </p>
<h2><strong>3.6 配置systemctl mysqld服务</strong></h2>
<div class="cnblogs_code">
<pre>vim /usr/lib/systemd/system/mysqld.service</pre>
</div>
<p> </p>
<p>输入如下内容:</p>
<div class="cnblogs_code">
<pre><span style="color: rgba(128, 0, 0, 1); font-weight: bold">[</span><span style="color: rgba(128, 0, 0, 1)">Unit</span><span style="color: rgba(128, 0, 0, 1); font-weight: bold">]</span><span style="color: rgba(0, 0, 0, 1)">
Description</span>=<span style="color: rgba(0, 0, 0, 1)">MySQL Server
Documentation</span>=man:mysqld(8<span style="color: rgba(0, 0, 0, 1)">)
Documentation</span>=<span style="color: rgba(0, 0, 0, 1)">http://dev.mysql.com/doc/refman/en/using-systemd.html
After</span>=<span style="color: rgba(0, 0, 0, 1)">network.target
After</span>=<span style="color: rgba(0, 0, 0, 1)">syslog.target
</span><span style="color: rgba(128, 0, 0, 1); font-weight: bold">[</span><span style="color: rgba(128, 0, 0, 1)">Install</span><span style="color: rgba(128, 0, 0, 1); font-weight: bold">]</span><span style="color: rgba(0, 0, 0, 1)">
WantedBy</span>=<span style="color: rgba(0, 0, 0, 1)">multi-user.target<br>
</span><span style="color: rgba(128, 0, 0, 1); font-weight: bold">[</span><span style="color: rgba(128, 0, 0, 1)">Service</span><span style="color: rgba(128, 0, 0, 1); font-weight: bold">]</span><span style="color: rgba(0, 0, 0, 1)">
User</span>=<span style="color: rgba(0, 0, 0, 1)">mysql
Group</span>=<span style="color: rgba(0, 0, 0, 1)">mysql
Type</span>=<span style="color: rgba(0, 0, 0, 1)">notify
# Disable service start and stop timeout logic of systemd for mysqld service.
TimeoutSec</span>=0<span style="color: rgba(0, 0, 0, 1)">
# Execute pre and post scripts as root
PermissionsStartOnly</span>=<span style="color: rgba(0, 0, 0, 1)">true
# Start main service
ExecStart</span>=<span style="color: rgba(0, 0, 0, 1)">/usr/local/mysql/bin/mysqld $MYSQLD_OPTS
# Use this to switch malloc implementation
EnvironmentFile</span>=<span style="color: rgba(0, 0, 0, 1)">-/etc/sysconfig/mysql
# Sets open_files_limit
LimitNOFILE </span>= 10000<span style="color: rgba(0, 0, 0, 1)">
Restart</span>=<span style="color: rgba(0, 0, 0, 1)">on-failure
RestartPreventExitStatus</span>=1<span style="color: rgba(0, 0, 0, 1)">
# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart.
Environment</span>=MYSQLD_PARENT_PID=1<span style="color: rgba(0, 0, 0, 1)">
PrivateTmp</span>=false</pre>
</div>
<p> </p>
<div class="cnblogs_code">
<pre>vim /usr/lib/systemd/system/mysqld@.service</pre>
</div>
<p>输入如下内容:</p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">
Description</span>=<span style="color: rgba(0, 0, 0, 1)">MySQL Server
Documentation</span>=<span style="color: rgba(0, 0, 255, 1)">man</span>:mysqld(<span style="color: rgba(128, 0, 128, 1)">8</span><span style="color: rgba(0, 0, 0, 1)">)
Documentation</span>=http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">dev.mysql.com/doc/refman/en/using-systemd.html</span>
After=<span style="color: rgba(0, 0, 0, 1)">network.target
After</span>=<span style="color: rgba(0, 0, 0, 1)">syslog.target
WantedBy</span>=multi-<span style="color: rgba(0, 0, 0, 1)">user.target
User</span>=<span style="color: rgba(0, 0, 0, 1)">mysql
Group</span>=<span style="color: rgba(0, 0, 0, 1)">mysql
Type</span>=<span style="color: rgba(0, 0, 0, 1)">notify
# Disable service start and stop timeout logic of systemd </span><span style="color: rgba(0, 0, 255, 1)">for</span><span style="color: rgba(0, 0, 0, 1)"> mysqld service.
TimeoutSec</span>=<span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
# Execute pre and post scripts as root
PermissionsStartOnly</span>=<span style="color: rgba(0, 0, 255, 1)">true</span><span style="color: rgba(0, 0, 0, 1)">
# Start main service
ExecStart</span>=/usr/local/mysql/bin/mysqld --defaults-group-suffix=@%<span style="color: rgba(0, 0, 0, 1)">I $MYSQLD_OPTS
# Use this to switch malloc implementation
EnvironmentFile</span>=-/etc/sysconfig/<span style="color: rgba(0, 0, 0, 1)">mysql
# Sets open_files_limit
LimitNOFILE </span>= <span style="color: rgba(128, 0, 128, 1)">10000</span><span style="color: rgba(0, 0, 0, 1)">
Restart</span>=on-<span style="color: rgba(0, 0, 0, 1)">failure
RestartPreventExitStatus</span>=<span style="color: rgba(128, 0, 128, 1)">1</span><span style="color: rgba(0, 0, 0, 1)">
# Set enviroment variable MYSQLD_PARENT_PID. This is required </span><span style="color: rgba(0, 0, 255, 1)">for</span><span style="color: rgba(0, 0, 0, 1)"> restart.
Environment</span>=MYSQLD_PARENT_PID=<span style="color: rgba(128, 0, 128, 1)">1</span><span style="color: rgba(0, 0, 0, 1)">
PrivateTmp</span>=<span style="color: rgba(0, 0, 255, 1)">false</span></pre>
</div>
<p> </p>
<h2><strong>3.7 启用mysqld服务</strong></h2>
<p>配置并初始化完成后MySQL服务默认并未启动,可以通过以下命令启动:</p>
<div class="cnblogs_code">
<pre>systemctl enable mysqld</pre>
</div>
<p><img src="https://img2023.cnblogs.com/blog/1564514/202309/1564514-20230901150002186-1868878201.png"></p>
<p> </p>
<p>启动mysql服务</p>
<div class="cnblogs_code">
<pre>systemctl start mysqld</pre>
</div>
<p> </p>
<p>查看mysqld服务状态:</p>
<div class="cnblogs_code">
<pre>systemctl status mysqld</pre>
</div>
<p><img src="https://img2023.cnblogs.com/blog/1564514/202309/1564514-20230901150025737-37087721.png"></p>
<p> </p>
<h2><strong>3.8 首次登录mysql</strong></h2>
<p>在MySQL初始化(initialize)完成后会自动为MySQL的root用户生成一个随机初始化密码,并在MySQL的errorlog文件中记录下来,我们要找到它并用它登录MySQL,修改root用户密码后才能执行任何其它操作:</p>
<ul>
<li>找到初始化密码</li>
</ul>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 255, 1)">grep</span> password /data/mysql/log/mysqld.log</pre>
</div>
<p> </p>
<p>下图绿色方框中即为初始化密码</p>
<p><img src="https://img2023.cnblogs.com/blog/1564514/202309/1564514-20230901150056183-284910062.png"></p>
<p> </p>
<ul>
<li>使用上面的初始化密码登录MySQL</li>
</ul>
<div class="cnblogs_code">
<pre>mysql -uroot -p</pre>
</div>
<p><img src="https://img2023.cnblogs.com/blog/1564514/202309/1564514-20230901150116766-2089601916.png"></p>
<p> </p>
<ul>
<li>修改root密码</li>
</ul>
<p>使用初始化密码登录MySQL后只能执行修改密码的操作,其它任何操作是不能执行的,使用以下命令修改密码:</p>
<div class="cnblogs_code">
<pre>mysql> alter user user()identifiedby<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">******</span><span style="color: rgba(128, 0, 0, 1)">'</span>;</pre>
</div>
<p> </p>
<p>密码修改成功后,执行以下命令查看MySQL基本信息:</p>
<div class="cnblogs_code">
<pre>mysql> status</pre>
</div>
<p><img src="https://img2023.cnblogs.com/blog/1564514/202309/1564514-20230901150402148-634193806.png"></p>
<p> </p>
<p><img src="https://img2023.cnblogs.com/blog/1564514/202309/1564514-20230901150409915-597701817.png"></p>
<p> 一切正常,至此安装完成。</p>
<p> </p>
<h1>补充说明</h1>
<ol>
<li><strong>mysql-8.0.28-linux-glibc2.17-x86_64-minimal.tar.xz与mysql-8.0.28-linux-glibc2.12-x86_64.tar.xz两个版本的区别:</strong></li>
</ol>
<ul>
<li>mysql-8.0.28-linux-glibc2.17-x86_64-minimal.tar.xz是最小化编译二进制版本,其中不包括一系列debug所用到的mysqld_debug可执行文件,并且mysqld也不是静态编译,而是动态链接库方式编译的,所以它的体积更小,但需要操作系统中有其运行所需要的2.17的动态链接库。</li>
<li>mysql-8.0.28-linux-glibc2.12-x86_64.tar.xz是完整编译的二进制版本,其中包括debug所需的mysqld_debug可执行文件,并且mysqld是静态编译,而非动态链接库方式编译的,所以它的体积更大,但不需要操作系统提供动态链接库即可运行。</li>
</ul>
<p>之所以选择glibc2.17版本,是因为此本体积更小巧。</p>
<p>centos7以及之后的操作系统一般都同时支持了glibc2.12与glibc2.17,甚至到centos8系列已经可以支持到glibc2.28,比如我们用的麒麟服务器版V10 SP2就提供了最低2.2.5到最高2.28各个版本的支持。</p>
<ul>
<li><strong>查看系统支持的GLIBC库列表,可以执行如下命令:</strong></li>
</ul>
<div class="cnblogs_code">
<pre>strings /usr/lib64/libc.so.<span style="color: rgba(128, 0, 128, 1)">6</span> | <span style="color: rgba(0, 0, 255, 1)">grep</span> GLIBC</pre>
</div>
<p><img src="https://img2023.cnblogs.com/blog/1564514/202309/1564514-20230901150444009-1020768297.png"></p>
<p> </p>
<ul>
<li><strong>查看系统当前运行的GLIBC版本,可以执行如下命令:</strong></li>
</ul>
<div class="cnblogs_code">
<pre>ldd --version</pre>
</div>
<p><img src="https://img2023.cnblogs.com/blog/1564514/202309/1564514-20230901150513520-1521267994.png"></p>
<p> </p>
<h1>后记</h1>
<p>在麒麟V10系统上安装时由于glibc版本选高了,导致初始化异常 error while loading shared libraries: libcrypto.so.3: ELF load command alignment not page-aligned。</p>
<p>麒麟v10 Linux只能安装 <span class="cnblogs_code">mysql-<span style="color: rgba(128, 0, 128, 1)">8.0</span>.<span style="color: rgba(128, 0, 128, 1)">34</span>-linux-glibc2.<span style="color: rgba(128, 0, 128, 1)">17</span>-aarch64.<span style="color: rgba(0, 0, 255, 1)">tar</span>.gz(glibc2.<span style="color: rgba(128, 0, 128, 1)">17</span>,ARM,<span style="color: rgba(128, 0, 128, 1)">64</span>)</span> ,<em id="__mceDel">如果使用 <span class="cnblogs_code">mysql-<span style="color: rgba(128, 0, 128, 1)">8.0</span>.<span style="color: rgba(128, 0, 128, 1)">34</span>-linux-glibc2.<span style="color: rgba(128, 0, 128, 1)">28</span>-aarch64.<span style="color: rgba(0, 0, 255, 1)">tar</span>.gz(glibc2.<span style="color: rgba(128, 0, 128, 1)">28</span>,ARM,<span style="color: rgba(128, 0, 128, 1)">64</span>)</span> </em><em id="__mceDel"><em id="__mceDel"><em id="__mceDel"><em id="__mceDel"><em id="__mceDel"><em id="__mceDel">就会在初始化时报异常</em></em></em></em></em></em></p>
<p> </p>
转自: https://blog.csdn.net/kanon_lgt/article/details/123810486
<div data-cke-filler-webkit="end" data-cke-temp="1">参考资料: Linux系统mysql8源码安装(适用任何linux,包括麒麟v10) - web服务相关 - ssword </div><br><br>
来源:https://www.cnblogs.com/masahiro/p/17671963.html
頁:
[1]