目录
1、常用命令总结
2、rpm下载安装(最快捷方式)
2.1、卸载mariadb
2.2、安装依赖
2.3、下载rpm文件
2.3.1下载地址
2.3.2下载整合版Bundle
2.3.3下载四个文件
2.4、执行命令安装
2.5、安装目录如下
2.6、查看mysql运行状态,并重启
2.7、重置密码
3、tar安装
卸载:mariadb
3.1、下载安装包
3.2、上传到服务器
3.3、解压到当前文件夹/usr/local/
3.4、创建data路径
3.5、创建mysql用户组
3.6、授权用户组
3.7、初始化脚本,5.7中 这个过时了(这里不采用)
3.8、更改mysql安装文件夹mysql/的权限
3.9、初始化mysql
3.9.1执行如果出现错误,可能缺少这个依赖:yum install libaio
3.10、修改Mysql配置文件,并将配置文件放到/etc/init.d/目录下面
3.10.1将当前配置文件加入到启动/etc/init.d/mysqld
3.11、加入开启自启动,启动mysql。(这个用不用都行)
3.12、添加my.cnf
3.13、mysql添加到环境变量中
3.14、启动mysql服务
14.1 如果不只是在 /usr/local/mysql路径下面可能会报错,那么执行下面操作,软连接
3.15、登录
3.16、修改密码命令:
1.rpm卸载: rpm -e --nodeps mysql-community-common-8.0.19-1.el7.x86_64
rpm查找: rpm -qa | grep mariadb
2.yum卸载:yum remove xx
3.服务重启操作命令:systemctl restart mysqld
查看状态: systemctl status mysqld
centos6.5mysql的服务操作命令:service mysql start/stop
4.关闭防火墙 :systemctl stop firewalld.service
开机禁止启动防火墙:systemctl disable firewalld.service
具体根据实际情况,缺啥安装啥,这个也没细总结过
下载地址是:
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-server-5.7.30-1.el7.x86_64.rpm
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-server-5.7.30-1.el7.x86_64.rpm
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-common-5.7.30-1.el7.x86_64.rpm
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-libs-5.7.30-1.el7.x86_64.rpm
sudo rpm -ivh mysql-community-common-5.7.30-1.el7.x86_64.rpm
sudo rpm -ivh mysql-community-libs-5.7.30-1.el7.x86_64.rpm
sudo rpm -ivh mysql-community-client-5.7.30-1.el7.x86_64.rpm
sudo rpm -ivh mysql-community-server-5.7.30-1.el7.x86_64.rpm
chown -R mysql:mysql /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql/data
/usr/local/mysql/bin/mysql_install_db --user=mysql
[root@ip-100 bin]# /usr/local/mysql/bin/mysql_install_db --user=mysql
2020-01-16 01:23:59 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2020-01-16 01:23:59 [ERROR] The data directory needs to be specified.
[root@ip-100 mysql]# /usr/local/mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize
2020-01-15T17:31:33.818233Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-01-15T17:31:34.417755Z 0 [Warning] InnoDB: New log files created, LSN=45790
2020-01-15T17:31:34.510250Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2020-01-15T17:31:34.759518Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: e0788195-37bc-11ea-a2a6-000c29cf0c82.
2020-01-15T17:31:34.765729Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-01-15T17:31:35.831655Z 0 [Warning] CA certificate ca.pem is self signed.
2020-01-15T17:31:36.283878Z 1 [Note] A temporary password is generated for root@localhost: spPwujtd1z%X
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
Starting MySQL.Logging to '/data/mysql/SZY.err'.
2018-07-02T10:09:03.779928Z mysqld_safe The file /usr/local/mysql/bin/mysqld
does not exist or is not executable. Please cd to the mysql installation
directory and restart this script from there as follows:
./bin/mysqld_safe&
See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more information
ERROR! The server quit without updating PID file (/software/mysql/mysqld.pid).