安装mysql 之前一直使用rpm包安装,但安装后一直安装不成功mysql for python,所以尝试用source编译安装。 准备 下载mysql source http://dev.mysql.com/downloads 并使用tar, gunzip解压。 添加用户及用户组 groupadd mysql useradd -g mysql mysql
编译安装 进入到解压mysql source目录 ./configure --prefix=/usr/local/mysql make make install 编译时出错:configure: error: No curses/termcap library found 解决方法: ./configure --with-named-curses-libs=/usr/lib/libncursesw.so.5 --prefix=/usr/local/mysql 安装后发现不支持gbk 解决方法:./configure --prefix=/usr/local/mysql --with--charset=gbk --with-extra-charsets="gbk gb2312 big5 utf8" --with-named- curses-libs=/usr/lib/libncursesw.so.5 将mysql加入到系统变量path中
将/usr/local/mysql/bin 加入到path中,这样在shell里就可以运行mysql相关的命令。在/etc/profile中加入:MYSQL_HOME=/usr/local/mysql PATH=$MYSQL_HOME/bin:$PATH export PATH
建立数据 mysql_install_db --user=mysql --datadir=/home/mysql
配置: cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf 并修改配置
将mysql加入系统服务: cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld chkconfig --add mysqld
启动mysql service mysqld start/stop/restart
相关资源:RHEL Linux 离线安装MySQL8详细步骤(包含源包链接).txt
