预先排雷
二进制安装mysq初始化出现:
FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:Data::Dumper
解决方法 :安装autoconf库 yum -y install autoconf
二进制安装mysql初始化出现:
Installing MySQL system tables.../usr/local/mysql/bin/mysqld: error while loading shared
原因:缺少libaio库文件
解决方法:yum install libaio* -y
./support-files/mysql.server start 报错:
原因:缺少文件,以及mysql用户权限
解决方法:
mkdir /var/log/mariadb
touch /var/log/mariadb/mariadb.log
如果没创建用户组先根据下面安装流程创建用户组
chown -R mysql:mysql /var/log/mariadb
再次启动
./support-files/mysql.server start报错:
Starting MySQL.210527 10:25:52 mysqld_safe Directory '/var/lib/mysql' for UNIX socket file don't exists.
启动MySQL服务时,会优先在/etc/目录下查找my.cnf
但是我的安装路径为/usr/local/mysql,相关配置也在此目录下
解决方法:
重命名/etc/my.cnf或者删除/etc/my.cnf
rm -f /etc/my.cnf
再次启动
安装流程
把安装包下载到 /usr/local/目录下,解压并重命名
tar -zxvf mysql-5.6.49-linux-glibc2.12-x86_64.tar.gz
rm -rf mysql-5.6.49-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.6.49-linux-glibc2.12-x86_64/ mysql创建用户组,如果之前创建过则跳过此步骤
groupadd mysql
useradd -r -g mysql mysql
groups mysql修改mysql目录拥有者为刚建立的mysql用户
cd mysql/
chown -R mysql:mysql ./初始化mysql
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data修改mysql目录拥有者为root用户,修改data目录拥有者为mysql
chown -R root:root ./ && chown -R mysql:mysql data启动mysql
./support-files/mysql.server start根据提示,配置root密码
./bin/mysqladmin -u root password 'xxxxxx'
./bin/mysqladmin -u root -h yourhostname password 'xxxxxx'登录mysql服务,开启远程登陆,刷新权限
./bin/mysql -hnode236 -uroot -p'xxxxxx'
grant all privileges on . to root@'%' identified by 'xxxxxx';
flush privileges;如果是在阿里云上部署的,记得配置下安全组规则,放开3306端口
本地使用navicat登录mysql看看能否连通
安装流程参考:
https://www.cnblogs.com/wangpeng00700/p/13539856.html
网友评论