suse安装mysql
ACSolo  post at 3 years ago 7.4k 1 0

  •   下载安装包:wget https://cdn.mysql.com//archives/mysql-5.7/mysql-boost-5.7.22.tar.gz
  •   安装依赖包:zypper install ncurses-devel
  •  解压:

tar -zxf mysql-boost-5.7.22.tar.gz -C /usr/local/
cd /usr/local/  &&   mv mysql-5.7.22  mysql
mkdir /usr/local/mysql/mydata
mkdir /usr/local/mysql/conf
useradd -s /sbin/nologin -M mysql

chown -R mysql:mysql /usr/local/mysql*

  • 编译安装:依赖先安装cmake和gcc,进入mysql目录后执行

linux-et5g:/usr/local/mysql #cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
 -DMYSQL_DATADIR=/usr/local/mysql/mydata  \
 -DSYSCONFDIR=/usr/local/mysql/conf \
 -DMYSQL_USER=mysql \
 -DWITH_INNODB_MEMCACHED=ON \
 -DWITH_INNOBASE_STORAGE_ENGINE=1 \
 -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
 -DMYSQL_TCP_PORT=3306 -DEXTRA_CHARSETS=all \
 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci \
 -DWITH_DEBUG=0 -DMYSQL_MAINTAINER_MODE=0 \
 -DWITH_SSL:STRING=bundled -DWITH_ZLIB:STRING=bundled \
 -DWITH_SYSTEMD=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=./boost
 

 linux-et5g:/usr/local/mysql #make && make install

  • 初始化mysql

   root@ubuntu:/usr/local/mysql/bin# vim /etc/my.cnf

 [mysqld]

bind-address=0.0.0.0
port=3306
user=mysql
basedir=/usr/local/mysql
datadir=/usr/local/mysql/mydata
socket=/tmp/mysql.sock
log-error=/usr/local/mysql/mysql.err
pid-file=/usr/local/mysql/mysql.pid
#character config
character_set_server=utf8mb4
symbolic-links=0
explicit_defaults_for_timestamp=true

   root@ubuntu:/usr/local/mysql/bin#./mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/mydata/ --user=mysql --initialize

查看密码

cat /usr/local/mysql/mysql.err

启动mysql,并更改root 密码
先将mysql.server放置到/etc/init.d/mysql中

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
启动!!!
systemctl daemon-reload
service mysql start
 
ps -ef|grep mysql


     https://blog.csdn.net/qq_37598011/article/details/93489404

Comments ( 1 )