MySQL安装并配置的步骤,解压压缩包,编译安装,创建所需要的文件,更改文件夹的拥有者和修改配置文件等。
四、安装并配置mysql(1) 解压mysql-5.7.26.tar.gz与boost_1_59_0.tar.gz #tar -xvf mysql-5.7.26.tar.gz | #tar -xvf boost_1_59_0.tar.gz -C /mnt/hg/ | (2) 安装依赖包 #yum install -y cmake gcc gcc-c++ openssl-devel ncurses-devel | (3) 编译安装 #cd mysql-5.7.26 | #cmake \ -DCMAKE_INSTALL_PREFIX=/mnt/hg/mysql-5.7.26 \ -DMYSQL_DATADIR=/mnt/hg/mysql/data \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_unicode_ci \ -DWITH_READLINE=1 \ -DWITH_SSL=system \ -DWITH_EMBEDDED_SERVER=1 \ -DENABLED_LOCAL_INFILE=1 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_DEBUG=0 \ -DWITH_BOOST=/mnt/hg/boost_1_59_0 | #make -j4 && make install | (4) 创建所需要的文件及文件夹 #mkdir -pv /mnt/hg/mysql-last/log | #touch /mnt/hg/mysql-last/log/mariadb.log | #touch /mnt/hg/mysql-last/log/mariadb.pid | (5) 更改mysql-5.7.26文件夹的拥有者和拥有组 #cd /mnt/hg && chown mysql:mysql -R mysql-5.7.26 | (6) mysql初始化操作① 编辑/etc/my.cnf,跳过mysql登录认证vim /etc/my.cnf [mysqld] datadir=/mnt/hg/mysql-last/data #数据存储的地方 socket=/mnt/hg/mysql-last/mysql.sock #sock文件的路径 skip-grant-tables #跳过登录认证 user=mysql explicit_defaults_for_timestamp=true [mysqld_safe] log-error=/mnt/hg/mysql-last/log/mariadb.log #错误日志存放的地方 pid-file=/mnt/hg/mysql-last/log/mariadb.pid |
② 添加mysql命令至PATH变量中vim /etc/profile ####mysql path export PATH=$PATH:/mnt/hg/mysql-last/support-files export PATH=$PATH:/mnt/hg/mysql-last/bin |
重新加载环境变量 ③ 初始化及启动mysql #mysqld --initialize --user=mysql --basedir=/mnt/hg/mysql-last --datadir=/mnt/hg/mysql-last/data | | #ln -s /mnt/hg/mysql-last/mysql.sock /tmp/ | ④ 导入zabbix初始库 #tar -xvf zabbix-4.2.1.tar.gz | #cd zabbix-4.2.1/database/mysql/ | |
在mysql里执行: >use mysql; | >create database zabbix default character set utf8; | >update user set authentication_string = password('hg'), password_expired = 'N', password_last_changed = now() where user = 'root'; | | | | | | ⑤ 恢复需要密码登录mysqlvim /etc/my.cnf 去掉skip-grant-tables
重新启动mysql 添加lib文件 #echo "/mnt/hg/mysql-last/lib" > /etc/ld.so.conf.d/mysql.conf | |
|
-
发表于 2022-07-14 14:46
- 阅读 ( 3940 )
- 分类:zabbix开源软件