{"id":10846,"date":"2023-12-04T16:49:14","date_gmt":"2023-12-04T08:49:14","guid":{"rendered":"http:\/\/xinyiworld.top\/wordpress_it\/?p=10846"},"modified":"2023-12-06T15:53:41","modified_gmt":"2023-12-06T07:53:41","slug":"debian%e5%b9%b3%e5%8f%b0aarch64%e6%9e%b6%e6%9e%84mysql%e6%97%a0%e6%84%9f%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac%e5%88%b6%e4%bd%9c","status":"publish","type":"post","link":"http:\/\/xinyiworld.top\/wordpress_it\/?p=10846","title":{"rendered":"debian\u5e73\u53f0aarch64\u67b6\u6784MySQL\u65e0\u611f\u5b89\u88c5\u811a\u672c\u5236\u4f5c"},"content":{"rendered":"<p><a href=\"https:\/\/www.jb51.net\/article\/217014.htm\">https:\/\/www.jb51.net\/article\/217014.htm<\/a><\/p>\n<h3>\u57fa\u7840<\/h3>\n<p>1\uff09\u4f9d\u8d56\u5e93\u5b89\u88c5\uff1a<\/p>\n<ul>\n<li>libaio.so.1<br \/>\n<a href=\"https:\/\/blog.csdn.net\/cycxl\/article\/details\/134683513\">https:\/\/blog.csdn.net\/cycxl\/article\/details\/134683513<\/a><br \/>\n<code>apt-get install libaio1 libaio-dev<\/code><\/li>\n<li>error while loading shared libraries: libncurses.so.5: cannot open shared object file<br \/>\n\u627e\u5230libncurses.so.6\u5e93\u7684\u4f4d\u7f6e\uff0c\u7136\u540e\u94fe\u63a5\u5230libncurses.so.5<br \/>\n\u540c\u7406libtinfo.so.5\u4e5f\u9700\u8981\u94fe\u63a5<\/li>\n<\/ul>\n<p>2\uff09\u6587\u4ef6\u6743\u9650\uff1a<\/p>\n<ul>\n<li>\n<p>Could not open file '\/usr\/local\/mysql\/log\/mysqld.log' for error logging: Per<br \/>\n<a href=\"https:\/\/blog.csdn.net\/wdyj517506\/article\/details\/105273227\">https:\/\/blog.csdn.net\/wdyj517506\/article\/details\/105273227<\/a><br \/>\n<code>sudo chown -R mysql:mysql \/usr\/local\/mysql<\/code><\/p>\n<\/li>\n<li>\n<p>mysqld: File \u2018.\/binlog.index\u2018 not found (OS errno 13 - Permission denied)<br \/>\n\u5bf9datadir\u76ee\u5f55\u8981\u8d4b\u4e88\u6743\u9650<br \/>\n<a href=\"https:\/\/blog.csdn.net\/qq_27884227\/article\/details\/132596525\">https:\/\/blog.csdn.net\/qq_27884227\/article\/details\/132596525<\/a><\/p>\n<\/li>\n<\/ul>\n<p>3\uff09\u914d\u7f6e\u6587\u4ef6\uff1a<br \/>\n<a href=\"https:\/\/www.cnblogs.com\/syw20170419\/p\/16187519.html\">https:\/\/www.cnblogs.com\/syw20170419\/p\/16187519.html<\/a><br \/>\n<a href=\"https:\/\/blog.51cto.com\/ludihua\/1542612\">https:\/\/blog.51cto.com\/ludihua\/1542612<\/a><\/p>\n<ul>\n<li>mysqld: [ERROR] Found option without preceding group in config file<br \/>\n<a href=\"https:\/\/blog.51cto.com\/u_16213346\/7196687\">https:\/\/blog.51cto.com\/u_16213346\/7196687<\/a><\/li>\n<\/ul>\n<p>4\uff09bin\u76ee\u5f55\u6587\u4ef6\u8bf4\u660e\uff1a<br \/>\n<a href=\"https:\/\/www.php.cn\/faq\/584217.html\">https:\/\/www.php.cn\/faq\/584217.html<\/a><\/p>\n<p>5\uff09\u5176\u5b83bug:<\/p>\n<ul>\n<li>Failed to start mysql.service: Unit mysql.service is masked<br \/>\n<a href=\"https:\/\/linuxcpp.0voice.com\/?id=111342\">https:\/\/linuxcpp.0voice.com\/?id=111342<\/a><br \/>\n<code>sudo systemctl unmask mysql.service<\/code><\/li>\n<\/ul>\n<h3>\u6b63\u5f0f\u5b89\u88c5<\/h3>\n<p><a href=\"https:\/\/blog.csdn.net\/zhizhengguan\/article\/details\/83342654\">https:\/\/blog.csdn.net\/zhizhengguan\/article\/details\/83342654<\/a>  (x86\u5e73\u53f0)<\/p>\n<p><a href=\"https:\/\/blog.csdn.net\/weixin_29665183\/article\/details\/113137134\">https:\/\/blog.csdn.net\/weixin_29665183\/article\/details\/113137134<\/a> (\u4e0b\u8f7d\u65b9\u6cd5\u548c\u5730\u5740\uff0c\u4f46\u662f\u6ca1\u6709\u627e\u5230linux aarch64\u5305)<\/p>\n<p>\u793e\u533a\u7248\u672c\u4e0b\u8f7d\uff1a<a href=\"https:\/\/downloads.mysql.com\/archives\/community\/\">https:\/\/downloads.mysql.com\/archives\/community\/<\/a><\/p>\n<ul>\n<li>\u5b89\u88c5\u811a\u672c<br \/>\n\u5927\u81f4\u6b65\u9aa4\uff1a<br \/>\n1\uff09\u89e3\u538bmysql\u5305\u5230\/usr\/local\/mysql\u76ee\u5f55<br \/>\n2\uff09\u8d4b\u4e88datadir\u6743\u9650<br \/>\n3\uff09\u5b89\u88c5mysql\u76f8\u5173\u7a0b\u5e8f\u542f\u52a8\u7684\u4f9d\u8d56\u5e93<br \/>\n4\uff09\u521d\u59cb\u5316\u6570\u636e\u5e93\uff0cbin\/mysqld --initialize --user=root\uff0c\u4f1a\u5728\u65e5\u5fd7\u91cc\u751f\u6210\u521d\u59cb\u5316\u5bc6\u7801\u3002<br \/>\n5\uff09\u901a\u8fc7\u670d\u52a1\u542f\u52a8mysqld_safe\uff0c\u4e3b\u8981\u662f\u4e3a\u4e86\u542f\u52a8mysqld<br \/>\n6\uff09\u7136\u540e\u62ff\u7740\u521d\u59cb\u5316\u5bc6\u7801\u901a\u8fc7mysql\u7a0b\u5e8f\u4fee\u6539\u5bc6\u7801\u4e3aroot<\/li>\n<\/ul>\n<p>mysql.service<\/p>\n<pre><code class=\"language-bash\">[Unit]\nDescription=mysql Service\n\n[Service]\nType=simple\nExecStart=\/bin\/bash \/usr\/local\/mysql\/bin\/mysqld_safe --user=root\nRestart=on-failure\nRestartSec=5s\nPrivateTmp=false\nKillMode=process\n\n[Install]\nWantedBy=multi-user.target\n<\/code><\/pre>\n<p>install.sh<\/p>\n<pre><code class=\"language-bash\">#!\/bin\/bash\n\necho_m(){\n  echo &quot;$(date +%F%T)  $1&quot;\n}\n\nif [ &quot;$(whereis php)&quot; = &quot;php:&quot; ]; then\n  echo_m &quot;install php start&quot;\n  apt-get install -y php=2:7.4+76\n  echo_m &quot;install php success&quot;\nfi\n\nif [ &quot;$(whereis php-fpm)&quot; = &quot;php-fpm:&quot; ]; then\n  echo_m &quot;install php-fpm start&quot;\n  apt-get install -y php-fpm=2:7.4+76\n  echo_m &quot;install php-fpm success&quot;\n\n  echo_m &quot;replace www.conf listen port&quot;\n\n  find  \/etc -type f -name www.conf | xargs sed -i &quot;s\/^listen = \\S*\/listen = 9000\/&quot;\n  echo_m &quot;replace www.conf listen port success&quot;\nfi\n\nif [ &quot;$(whereis bmc_nginx)&quot; = &quot;bmc_nginx:&quot; ]; then\n  echo_m &quot;install bmc_nginx start&quot;\n  cd \/opt\/tkroot\/nginx\n  bash install.sh\n  echo_m &quot;install bmc_nginx success&quot;\nfi\n\nmysql_location=&quot;$(whereis mysql)&quot;\nif [[ &quot;$mysql_location&quot; = &quot;mysql:*&quot; || &quot;$mysql_location&quot; =~ &quot;\/etc\/mysql&quot; ]]; then\n  echo_m &quot;install mysql start&quot;\n  MYSQL_ROOT=\/usr\/local\/mysql\n  cd \/opt\/tkroot\/mysql\n  tar xvf mysql-5.7.27-aarch64.tar.gz -C \/usr\/local\/\n  mv \/usr\/local\/mysql-5.7.27-aarch64 $MYSQL_ROOT\n  ln -sf $MYSQL_ROOT\/my.cnf \/etc\/my.cnf\n  cp -rf $MYSQL_ROOT\/extra\/lib* \/usr\/lib64\/\n\n  echo_m &quot;install env libs&quot;\n  apt-get install -y libaio1 libaio-dev\n  ln -s \/usr\/lib\/aarch64-linux-gnu\/libncurses.so.6 \/usr\/lib\/aarch64-linux-gnu\/libncurses.so.5\n  ln -s \/usr\/lib\/aarch64-linux-gnu\/libtinfo.so.6 \/usr\/lib\/aarch64-linux-gnu\/libtinfo.so.5\n  echo_m &quot;install env libs end&quot;\n\n  #my.cnf\n  sed -i &quot;s\/^user = \\S*\/user = root\/&quot; \/etc\/my.cnf\n\n  datadir=$(cat \/etc\/my.cnf | grep &quot;datadir = &quot; | awk &#039;{print $3}&#039;)\n  echo &quot;datadir:$datadir&quot;\n  mkdir -p &quot;$datadir&quot;\n  chmod +777 &quot;$datadir&quot;\n\n  #init data\n  cd $MYSQL_ROOT\n  mkdir logs\n  chown -R root:root $MYSQL_ROOT\n  bin\/mysqld --initialize --user=root\n\n  #create soft link for mysql\n  ln -s \/usr\/local\/mysql\/bin\/mysql \/usr\/bin\/mysql\n\n  # start mysqld first before mysql start\n  TK_ROOT=\/opt\/tkroot\n  echo &quot;cp ${TK_ROOT}\/mysql\/mysql.service \/lib\/systemd\/system\/&quot;\n  cp -f &quot;$TK_ROOT&quot;\/mysql\/mysql.service \/lib\/systemd\/system\/\n  systemctl daemon-reload\n  systemctl start mysql\n  systemctl enable mysql\n\n  #find password\n  # shellcheck disable=SC2002\n  init_password=$(cat $MYSQL_ROOT\/logs\/mysql-error.log | grep &quot;A temporary password is generated for root@localhost:\\S*&quot; | awk &#039;{print $NF}&#039;)\n  echo_m &quot;init_password:$init_password&quot;\n  #set new password\n  # shellcheck disable=SC2016\n\n  #wait mysqld to start\n    mysqld_start_fail=$(ps -e | grep -w mysqld | grep -v grep)\n   if [[ $mysqld_start_fail = &quot;&quot; ]];then\n      mysqld_start_fail=1\n   else\n      mysqld_start_fail=0\n   fi\n   echo_m &quot;mysqld_start_fail:$mysqld_start_fail&quot;\n   while [ $mysqld_start_fail -eq 1 ]\n   do\n     echo_m &quot;wait mysqld start ...&quot;\n     sleep 1\n      mysqld_start_fail=$(ps -e | grep -w mysqld | grep -v grep)\n       if [[ $mysqld_start_fail = &quot;&quot; ]];then\n          mysqld_start_fail=1\n       else\n          mysqld_start_fail=0\n       fi\n   done\n\n   #wait mysqld ready\n   mysql_exec_result=$($MYSQL_ROOT\/bin\/mysql 2&gt;&amp;1)\n   echo &quot;mysql_exec_result:$mysql_exec_result&quot;\n   socket_fail_str=&quot;Can&#039;t connect to local MySQL server through socket&quot;\n      if [[ ${mysql_exec_result} =~ ${socket_fail_str} ]];then\n        connect_fail=1\n      else\n        connect_fail=0\n      fi\n      echo_m &quot;connect_fail:$connect_fail&quot;\n      while [ $connect_fail -eq 1 ];\n      do\n        echo_m &quot;wait mysqld prepared ...&quot;\n        sleep 1\n        mysql_exec_result=$($MYSQL_ROOT\/bin\/mysql 2&gt;&amp;1)\n        echo &quot;mysql_exec_result:$mysql_exec_result&quot;\n        if [[ ${mysql_exec_result} =~ ${socket_fail_str} ]];then\n            connect_fail=1\n        else\n            connect_fail=0\n        fi\n        echo_m &quot;connect_fail:$connect_fail&quot;\n      done\n  # shellcheck disable=SC2016\n  $MYSQL_ROOT\/bin\/mysql -uroot -p&quot;$init_password&quot; --connect-expired-password  -e &quot;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;root&#039;;&quot;\n\n  # create and import db\n  $MYSQL_ROOT\/bin\/mysql -uroot -proot -e &quot;CREATE DATABASE tiktok;&quot;\n  $MYSQL_ROOT\/bin\/mysql -uroot -proot tiktok &lt; \/opt\/tkroot\/tkcloud\/tk.sql\n\n  echo_m &quot;install mysql success&quot;\nfi\n\nif [ &quot;$(whereis php-mysql)&quot; = &quot;php-mysql:&quot; ]; then\n  echo_m &quot;install php-mysql start&quot;\n  apt-get install -y php-mysql=2:7.4+76\n  echo_m &quot;install php-mysql success&quot;\nfi\n\nif [ &quot;$(whereis redis)&quot; = &quot;redis:&quot; ]; then\n  echo_m &quot;install redis start&quot;\n  apt-get install -y redis=5:6.0.16-1+deb11u2\n  echo_m &quot;install redis success&quot;\nfi\n\nif [ &quot;$(whereis php-redis)&quot; = &quot;php-redis:&quot; ]; then\n  echo_m &quot;install php-redis start&quot;\n  apt-get install -y php-redis=5.3.2+4.3.0-2+deb11u1\n  echo_m &quot;install php-redis success&quot;\nfi\n\n# replace  .\/tkcloud\/public\/url.json ip\nurl_json_file=\/opt\/tkroot\/tkcloud\/public\/url.json\n# shellcheck disable=SC2002\nlocal_host_str=$(cat $url_json_file | grep localhost)\necho &quot;local_host_str:$local_host_str&quot;\nif [ $local_host_str != &quot;&quot; ]; then\n   ln -s \/usr\/sbin\/ifconfig \/usr\/bin\n   localIP=$(ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk &#039;{print $2}&#039;|tr -d &quot;addr:&quot;)\n   echo &quot;localIp:$localIP&quot;\n\n   if [ -z $localIP ]; then\n       echo &quot;local ip is empty\uff0c\u7f51\u7edc\u5f02\u5e38\uff0c\/opt\/tkroot\/tkcloud\/public\/url.json replace fail&quot;\n       exit 0\n   fi\n  sed -i &quot;s\/localhost\/$localIP\/&quot; $url_json_file\nfi<\/code><\/pre>\n<button class=\"simplefavorite-button\" data-postid=\"10846\" data-siteid=\"1\" data-groupid=\"1\" data-favoritecount=\"0\" style=\"\">\u6536\u85cf <i class=\"sf-icon-star-empty\"><\/i><\/button>","protected":false},"excerpt":{"rendered":"<p>https:\/\/www.jb51.net\/article\/217014.htm \u57fa\u7840 1\uff09\u4f9d\u8d56\u5e93\u5b89\u88c5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[27],"tags":[],"_links":{"self":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/10846"}],"collection":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10846"}],"version-history":[{"count":17,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/10846\/revisions"}],"predecessor-version":[{"id":10879,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/10846\/revisions\/10879"}],"wp:attachment":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10846"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10846"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10846"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}