suse12安装mysql8.16
1、查看操作系统类型:
linux-test:~ # cat /proc/version Linux version 4.12.14-94.41-default (geeko@buildhost) (gcc version 4.8.5 (SUSE Linux) ) #1 SMP Wed Oct 31 12:25:04 UTC 2018 (3090901) linux-test:~ # cat /etc/issue Welcome to SUSE Linux Enterprise Server 12 SP4 (x86_64) - Kernel (l).
2、下载mysql安装包
https://dev.mysql.com/downloads/mysql/
3、选择对应的操作系统及安装包
4、卸载旧的数据库
参考:
5、创建安装包存放目录
linux-test:~ # mkdir /soft/
6、用ftp工具上传软件到 /soft,上传完成后如下
linux-test:/soft # ls mysql-8.0.16-2.sles12.x86_64.rpm-bundle.tar
7、解压安装包
linux-test:/soft # tar -xvf mysql-8.0.16-2.sles12.x86_64.rpm-bundle.tar mysql-community-common-8.0.16-2.sles12.x86_64.rpm mysql-community-client-8.0.16-2.sles12.x86_64.rpm mysql-community-devel-8.0.16-2.sles12.x86_64.rpm mysql-community-server-8.0.16-2.sles12.x86_64.rpm mysql-community-libs-8.0.16-2.sles12.x86_64.rpm mysql-community-test-8.0.16-2.sles12.x86_64.rpm
8、依次安装rpm包
rpm -ivh mysql-community-common-8.0.16-2.sles12.x86_64.rpm rpm -ivh mysql-community-libs-8.0.16-2.sles12.x86_64.rpm rpm -ivh mysql-community-client-8.0.16-2.sles12.x86_64.rpm rpm -ivh mysql-community-server-8.0.16-2.sles12.x86_64.rpm
9、修改数据库参数
linux-test:/soft # vi /etc/my.cnf
去掉配置文件中的"default-authentication-plugin=mysql_native_password"的注释符号(#)
并追加参数
#端口
port=6612 #表名不区分大小写,对大小写不敏感
lower_case_table_names=1
10、查下数据库状态(Stopped)
linux-test:/soft # systemctl status mysql.service 或者 systemctl status mysql
● mysql.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysql.service; enabled; vendor preset: disabled) Active: inactive (dead) since Thu 2019-05-30 11:39:48 CST; 3h 55min ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Main PID: 1277 (code=exited, status=0/SUCCESS) Status: "SERVER_SHUTTING_DOWN" May 30 11:32:18 linux-test systemd[1]: Starting MySQL Server... May 30 11:32:26 linux-test systemd[1]: Started MySQL Server. May 30 11:39:46 linux-test systemd[1]: Stopping MySQL Server... May 30 11:39:48 linux-test systemd[1]: Stopped MySQL Server. linux-test:/soft #
11、启动数据库
linux-test:/soft # systemctl start mysql
或者
linux-test:/soft # systemctl start mysql.service
12、再次查看数据库状态(Started)
linux-test:~ # systemctl status mysql 或者 linux-test:~ # systemctl status mysql.service ● mysql.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysql.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2019-05-30 15:38:08 CST; 43s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 4072 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS) Main PID: 4093 (mysqld) Status: "SERVER_OPERATING" Tasks: 38 (limit: 512) CGroup: /system.slice/mysql.service └─4093 /usr/sbin/mysqld May 30 15:38:07 linux-test systemd[1]: Starting MySQL Server... May 30 15:38:08 linux-test systemd[1]: Started MySQL Server.
13、查看初始化密码
启动数据库后,MySQL会给我们在/var/log/mysqld.log下,为root用户生成了一个初始化密码
linux-test:~ # grep 'temporary password' /var/log/mysql/mysqld.log 2019-05-15T15:10:45.423765Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: odd5hp4i?rLj
14、登录数据库
linux-test:~ # mysql -uroot -p
Enter password:
输入:odd5hp4i?rLj