kylin操作系统安装mysql

发布时间 2023-08-22 14:44:37作者: 对我不好

首先坑的是麒麟说自己基于ubuntu。结果包管理工具用的yum。然后yum包里还没有mysql只能自己下载安装。

1.第一种方式直接下MySQL :: Download MySQL Community Server (Archived Versions) 里装好的mysql的tar包,然后解压。解压以后拷贝到/usr/local/mysql目录下 注意如果在别的目录下会没有权限导致报错。

2.修改/etc/my.cnf

#
# This group is read both by the client and the server
# use it for options that affect everything
#
[client-server]

#
# include *.cnf from the config directory
#
!includedir /etc/my.cnf.d

[mysqld]
datadir=/usr/local/mysql8025/data
basedir=/usr/local/mysql8025
socket=/usr/local/mysql8025/data/mysql.sock
user=mysql
port=3306
character-set-server=utf8
symbolic-links=0
skip-grant-tables

[mysql_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[client]
port=3006
socket=/usr/local/mysql8025/data/mysql.sock

3. chown mysql:mysql -R /usr/local/mysql/data/

4. 切到/usr/local/mysql目录下  /bin/mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql --initialize 初始化一下mysqld

5.启动mysqld的指令 /bin/mysqld  user=mysql& 

 

如果下载的是boost版本的mysql源代码需要进行编译。

1.解压了mysql文件以后创建一个build目录

2.CC=/usr/bin/gcc CXX=/usr/bin/g++  cmake .. -DWITH_BOOST=../boost/boost_1_59_0/   -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ 编译了以后再make 编译好了 就可以使用mysqld了 ,其他的步骤和上面一样。