Linux(SUSE 12)安装mysql

2024-06-06 02:08
文章标签 mysql linux 安装 database suse

本文主要是介绍Linux(SUSE 12)安装mysql,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

安装的4个rpm包为

mysql-community-common-5.6.26-2.sles12

mysql-community-libs-5.6.26-2.sles12

mysql-community-common-5.6.26-2.sles12.x86_64.rpm

mysql-community-server-5.6.26-2.sles12.x86_64  

先把java文件夹下的4个包做成源,然后直接zypper in mysql-community-server  就ok了,出现问题ignore就行。


【补充:】

导入sql文件时,先选择数据库,或者创建数据库后,选择该数据库,然后,source /java/test.sql(这是我的sql文件存放位置)


这是全文的安装文本,大家可以用来对照

linux-5t0q:~ # zypper se mysql-community
Loading repository data...
Reading installed packages...

S | Name                   | Summary                                                 | Type   
--+------------------------+---------------------------------------------------------+--------
  | mysql-community-client | MySQL database client applications and tools            | package
  | mysql-community-common | MySQL database common files for server and client libs  | package
  | mysql-community-libs   | Shared libraries for MySQL database client applications | package
  | mysql-community-server | A very fast and reliable SQL database server            | package
linux-5t0q:~ # zypper in mysql-community
Loading repository data...
Reading installed packages...
'mysql-community' not found in package names. Trying capabilities.
No provider of 'mysql-community' found.
Resolving package dependencies...

Nothing to do.
linux-5t0q:~ # zypper in mysql-community-server
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 4 NEW packages are going to be installed:
  mysql-community-client mysql-community-common mysql-community-libs mysql-community-server

The following 4 packages are not supported by their vendor:
  mysql-community-client mysql-community-common mysql-community-libs mysql-community-server

4 new packages to install.
Overall download size: 60.2 MiB. Already cached: 0 B. After the operation, additional 341.2 MiB will be used.
Continue? [y/n/? shows all options] (y): y
Retrieving package mysql-community-common-5.6.26-2.sles12.x86_64                                                                              (1/4), 214.3 KiB (  2.1 MiB unpacked)
mysql-community-common-5.6.26-2.sles12.x86_64.rpm:
    Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
    V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

mysql-community-common-5.6.26-2.sles12.x86_64 (java): Signature verification failed [4-Signatures public key is not available]
Abort, retry, ignore? [a/r/i] (a): i
Retrieving package mysql-community-libs-5.6.26-2.sles12.x86_64                                                                                (2/4),   1.8 MiB (  9.1 MiB unpacked)
mysql-community-libs-5.6.26-2.sles12.x86_64.rpm:
    Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
    V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

mysql-community-libs-5.6.26-2.sles12.x86_64 (java): Signature verification failed [4-Signatures public key is not available]
Abort, retry, ignore? [a/r/i] (a): i
Retrieving package mysql-community-client-5.6.26-2.sles12.x86_64                                                                              (3/4),  15.8 MiB ( 86.9 MiB unpacked)
mysql-community-client-5.6.26-2.sles12.x86_64.rpm:
    Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
    V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

mysql-community-client-5.6.26-2.sles12.x86_64 (java): Signature verification failed [4-Signatures public key is not available]
Abort, retry, ignore? [a/r/i] (a): i
Retrieving package mysql-community-server-5.6.26-2.sles12.x86_64                                                                              (4/4),  42.4 MiB (243.1 MiB unpacked)
mysql-community-server-5.6.26-2.sles12.x86_64.rpm:
    Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
    V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

mysql-community-server-5.6.26-2.sles12.x86_64 (java): Signature verification failed [4-Signatures public key is not available]
Abort, retry, ignore? [a/r/i] (a): i
Checking for file conflicts: ................................................................................................................................................[done]
(1/4) Installing: mysql-community-common-5.6.26-2.sles12 ....................................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/java/mysql-community-common-5.6.26-2.sles12.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY


(2/4) Installing: mysql-community-libs-5.6.26-2.sles12 ......................................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/java/mysql-community-libs-5.6.26-2.sles12.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY


(3/4) Installing: mysql-community-client-5.6.26-2.sles12 ....................................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/java/mysql-community-client-5.6.26-2.sles12.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY


(4/4) Installing: mysql-community-server-5.6.26-2.sles12 ....................................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/java/mysql-community-server-5.6.26-2.sles12.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY


linux-5t0q:~ # /etc/init.d/
after.local     boot.local      dbus            inputattach     openct          raw             rc2.d/          rc5.d/          rpmconfigcheck  snmptrapd       
boot.apparmor   boot.udev       halt.local      ipmi            pcscd           rc0.d/          rc3.d/          rc6.d/          slpd            
boot.d/         cifs            init.d/         jexec           postfix         rc1.d/          rc4.d/          rcS.d/          snmpd           
linux-5t0q:~ # mysql
mysql                       mysql_find_rows             mysql_tzinfo_to_sql         mysqladmin                  mysqld-debug                mysqlhotcopy
mysql-systemd-start         mysql_fix_extensions        mysql_upgrade               mysqlbinlog                 mysqld_multi                mysqlimport
mysql_config                mysql_install_db            mysql_waitpid               mysqlbug                    mysqld_safe                 mysqlshow
mysql_config_editor         mysql_plugin                mysql_zap                   mysqlcheck                  mysqldump                   mysqlslap
mysql_convert_table_format  mysql_secure_installation   mysqlaccess                 mysqld                      mysqldumpslow               mysqltest
linux-5t0q:~ # mysql
mysql                       mysql_find_rows             mysql_tzinfo_to_sql         mysqladmin                  mysqld-debug                mysqlhotcopy
mysql-systemd-start         mysql_fix_extensions        mysql_upgrade               mysqlbinlog                 mysqld_multi                mysqlimport
mysql_config                mysql_install_db            mysql_waitpid               mysqlbug                    mysqld_safe                 mysqlshow
mysql_config_editor         mysql_plugin                mysql_zap                   mysqlcheck                  mysqldump                   mysqlslap
mysql_convert_table_format  mysql_secure_installation   mysqlaccess                 mysqld                      mysqldumpslow               mysqltest
linux-5t0q:~ # mysqld
2016-02-25 22:13:36 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-02-25 22:13:36 0 [Note] mysqld (mysqld 5.6.26) starting as process 2524 ...
2016-02-25 22:13:36 2524 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

2016-02-25 22:13:36 2524 [ERROR] Aborting

2016-02-25 22:13:36 2524 [Note] Binlog end
2016-02-25 22:13:36 2524 [Note] mysqld: Shutdown complete

linux-5t0q:~ # mysqld
2016-02-25 22:13:50 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-02-25 22:13:50 0 [Note] mysqld (mysqld 5.6.26) starting as process 2525 ...
2016-02-25 22:13:50 2525 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

2016-02-25 22:13:50 2525 [ERROR] Aborting

2016-02-25 22:13:50 2525 [Note] Binlog end
2016-02-25 22:13:50 2525 [Note] mysqld: Shutdown complete

linux-5t0q:~ # vim /var/log/mysql/mysqld.log
.bash_history      .gnupg/            .oracle_jre_usage/ .viminfo           bin/               
.dbus/             .local/            .rnd               autoinst.xml       inst-sys/          
linux-5t0q:~ # vim /var/log/mysql/mysqld.log
linux-5t0q:~ # vim /var/log/mysql/mysqld.log
.bash_history      .gnupg/            .oracle_jre_usage/ .viminfo           bin/               
.dbus/             .local/            .rnd               autoinst.xml       inst-sys/          
linux-5t0q:~ # systemctl start mysql
linux-5t0q:~ # ps -elf | grep mysql
4 S mysql     2665     1  0  80   0 -  2952 wait   22:14 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe
0 S mysql     2818  2665  1  80   0 - 173406 SyS_po 22:14 ?       00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysql/mysqld.log --pid-file=/var/run/mysql/mysqld.pid --socket=/var/lib/mysql/mysql.sock
0 S root      2844  2405  0  80   0 -  2309 pipe_w 22:14 pts/1    00:00:00 grep --color=auto mysql
linux-5t0q:~ # mysql
mysql                       mysql_find_rows             mysql_tzinfo_to_sql         mysqladmin                  mysqld-debug                mysqlhotcopy
mysql-systemd-start         mysql_fix_extensions        mysql_upgrade               mysqlbinlog                 mysqld_multi                mysqlimport
mysql_config                mysql_install_db            mysql_waitpid               mysqlbug                    mysqld_safe                 mysqlshow
mysql_config_editor         mysql_plugin                mysql_zap                   mysqlcheck                  mysqldump                   mysqlslap
mysql_convert_table_format  mysql_secure_installation   mysqlaccess                 mysqld                      mysqldumpslow               mysqltest
linux-5t0q:~ # mysql
mysql                       mysql_find_rows             mysql_tzinfo_to_sql         mysqladmin                  mysqld-debug                mysqlhotcopy
mysql-systemd-start         mysql_fix_extensions        mysql_upgrade               mysqlbinlog                 mysqld_multi                mysqlimport
mysql_config                mysql_install_db            mysql_waitpid               mysqlbug                    mysqld_safe                 mysqlshow
mysql_config_editor         mysql_plugin                mysql_zap                   mysqlcheck                  mysqldump                   mysqlslap
mysql_convert_table_format  mysql_secure_installation   mysqlaccess                 mysqld                      mysqldumpslow               mysqltest
linux-5t0q:~ # mysql_secure_installation



NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] n
 ... skipping.

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
 ... skipping.

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!




All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


Cleaning up...
linux-5t0q:~ # mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.6.26 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> \q
Bye
linux-5t0q:~ # systemctl status mysql
mysql.service - MySQL Community Server
   Loaded: loaded (/usr/lib/systemd/system/mysql.service; enabled)
   Active: active (running) since Thu 2016-02-25 22:14:25 EST; 2h 27min ago
  Process: 2666 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS)
  Process: 2610 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 2665 (mysqld_safe)
   CGroup: /system.slice/mysql.service
           ├─2665 /bin/sh /usr/bin/mysqld_safe
           └─2818 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysql/mysqld.log --pid-file=/var/run/mysql/...

Feb 25 22:14:24 linux-5t0q mysql-systemd-start[2610]: The latest information about MySQL is available on the web at
Feb 25 22:14:24 linux-5t0q mysql-systemd-start[2610]: http://www.mysql.com
Feb 25 22:14:24 linux-5t0q mysql-systemd-start[2610]: Support MySQL by buying support/licenses at http://shop.mysql.com
Feb 25 22:14:24 linux-5t0q mysql-systemd-start[2610]: Note: new default config file not created.
Feb 25 22:14:24 linux-5t0q mysql-systemd-start[2610]: Please make sure your config file is current
Feb 25 22:14:24 linux-5t0q mysql-systemd-start[2610]: WARNING: Default config file /etc/my.cnf exists on the system
Feb 25 22:14:24 linux-5t0q mysql-systemd-start[2610]: This file will be read by default by the MySQL server
Feb 25 22:14:24 linux-5t0q mysql-systemd-start[2610]: If you do not want to use this, either remove it, or use the
Feb 25 22:14:24 linux-5t0q mysqld_safe[2665]: 160225 22:14:24 mysqld_safe Logging to '/var/log/mysql/mysqld.log'.
Feb 25 22:14:24 linux-5t0q mysqld_safe[2665]: 160225 22:14:24 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
linux-5t0q:~ #


最后需要刷新远程登录的权限:

1. GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
2.FLUSH PRIVILEGES;

才能实现远程登录。


2016.10.25补充

按照这种方法搭建好数据库后,设置的root用户密码为root,我通过javaweb应用远程访问该数据库时,提示:

mysql Access denied for user root@(xxx.xx我访问数据库的本机IP)

反正就是访问不了。

然后我把root密码修改为123456,就能正常访问了。不确定原因出在我的代码里的安全机制,还是处在mysql的安全机制。

mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;

总之改密之后问题就解决了


2016.10.25补充

这个方法生产的mysql默认是不忽略表名大小写的

因此需要增加以下操作

1、用root登录,修改 /etc/my.cnf;
2、在[mysqld]节点下,加入一行: lower_case_table_names=1
3、重启MySQL即可;

注意:只能加到[mysqld]节点下,不要加到任意一行或最后一行。。。。。我刚才加到[mysql_safe]节点下去了,重启后发现还是老问题,才返现放错地方了

这篇关于Linux(SUSE 12)安装mysql的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1034791

相关文章

python管理工具之conda安装部署及使用详解

《python管理工具之conda安装部署及使用详解》这篇文章详细介绍了如何安装和使用conda来管理Python环境,它涵盖了从安装部署、镜像源配置到具体的conda使用方法,包括创建、激活、安装包... 目录pytpshheraerUhon管理工具:conda部署+使用一、安装部署1、 下载2、 安装3

Mysql虚拟列的使用场景

《Mysql虚拟列的使用场景》MySQL虚拟列是一种在查询时动态生成的特殊列,它不占用存储空间,可以提高查询效率和数据处理便利性,本文给大家介绍Mysql虚拟列的相关知识,感兴趣的朋友一起看看吧... 目录1. 介绍mysql虚拟列1.1 定义和作用1.2 虚拟列与普通列的区别2. MySQL虚拟列的类型2

mysql数据库分区的使用

《mysql数据库分区的使用》MySQL分区技术通过将大表分割成多个较小片段,提高查询性能、管理效率和数据存储效率,本文就来介绍一下mysql数据库分区的使用,感兴趣的可以了解一下... 目录【一】分区的基本概念【1】物理存储与逻辑分割【2】查询性能提升【3】数据管理与维护【4】扩展性与并行处理【二】分区的

Linux使用fdisk进行磁盘的相关操作

《Linux使用fdisk进行磁盘的相关操作》fdisk命令是Linux中用于管理磁盘分区的强大文本实用程序,这篇文章主要为大家详细介绍了如何使用fdisk进行磁盘的相关操作,需要的可以了解下... 目录简介基本语法示例用法列出所有分区查看指定磁盘的区分管理指定的磁盘进入交互式模式创建一个新的分区删除一个存

MySQL中时区参数time_zone解读

《MySQL中时区参数time_zone解读》MySQL时区参数time_zone用于控制系统函数和字段的DEFAULTCURRENT_TIMESTAMP属性,修改时区可能会影响timestamp类型... 目录前言1.时区参数影响2.如何设置3.字段类型选择总结前言mysql 时区参数 time_zon

Python MySQL如何通过Binlog获取变更记录恢复数据

《PythonMySQL如何通过Binlog获取变更记录恢复数据》本文介绍了如何使用Python和pymysqlreplication库通过MySQL的二进制日志(Binlog)获取数据库的变更记录... 目录python mysql通过Binlog获取变更记录恢复数据1.安装pymysqlreplicat

Linux使用dd命令来复制和转换数据的操作方法

《Linux使用dd命令来复制和转换数据的操作方法》Linux中的dd命令是一个功能强大的数据复制和转换实用程序,它以较低级别运行,通常用于创建可启动的USB驱动器、克隆磁盘和生成随机数据等任务,本文... 目录简介功能和能力语法常用选项示例用法基础用法创建可启动www.chinasem.cn的 USB 驱动

使用SQL语言查询多个Excel表格的操作方法

《使用SQL语言查询多个Excel表格的操作方法》本文介绍了如何使用SQL语言查询多个Excel表格,通过将所有Excel表格放入一个.xlsx文件中,并使用pandas和pandasql库进行读取和... 目录如何用SQL语言查询多个Excel表格如何使用sql查询excel内容1. 简介2. 实现思路3

高效管理你的Linux系统: Debian操作系统常用命令指南

《高效管理你的Linux系统:Debian操作系统常用命令指南》在Debian操作系统中,了解和掌握常用命令对于提高工作效率和系统管理至关重要,本文将详细介绍Debian的常用命令,帮助读者更好地使... Debian是一个流行的linux发行版,它以其稳定性、强大的软件包管理和丰富的社区资源而闻名。在使用

龙蜥操作系统Anolis OS-23.x安装配置图解教程(保姆级)

《龙蜥操作系统AnolisOS-23.x安装配置图解教程(保姆级)》:本文主要介绍了安装和配置AnolisOS23.2系统,包括分区、软件选择、设置root密码、网络配置、主机名设置和禁用SELinux的步骤,详细内容请阅读本文,希望能对你有所帮助... ‌AnolisOS‌是由阿里云推出的开源操作系统,旨