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

相关文章

MySQL8.0设置redo缓存大小的实现

《MySQL8.0设置redo缓存大小的实现》本文主要在MySQL8.0.30及之后版本中使用innodb_redo_log_capacity参数在线更改redo缓存文件大小,下面就来介绍一下,具有一... mysql 8.0.30及之后版本可以使用innodb_redo_log_capacity参数来更改

Python使用国内镜像加速pip安装的方法讲解

《Python使用国内镜像加速pip安装的方法讲解》在Python开发中,pip是一个非常重要的工具,用于安装和管理Python的第三方库,然而,在国内使用pip安装依赖时,往往会因为网络问题而导致速... 目录一、pip 工具简介1. 什么是 pip?2. 什么是 -i 参数?二、国内镜像源的选择三、如何

Linux使用nload监控网络流量的方法

《Linux使用nload监控网络流量的方法》Linux中的nload命令是一个用于实时监控网络流量的工具,它提供了传入和传出流量的可视化表示,帮助用户一目了然地了解网络活动,本文给大家介绍了Linu... 目录简介安装示例用法基础用法指定网络接口限制显示特定流量类型指定刷新率设置流量速率的显示单位监控多个

ElasticSearch+Kibana通过Docker部署到Linux服务器中操作方法

《ElasticSearch+Kibana通过Docker部署到Linux服务器中操作方法》本文介绍了Elasticsearch的基本概念,包括文档和字段、索引和映射,还详细描述了如何通过Docker... 目录1、ElasticSearch概念2、ElasticSearch、Kibana和IK分词器部署

Linux流媒体服务器部署流程

《Linux流媒体服务器部署流程》文章详细介绍了流媒体服务器的部署步骤,包括更新系统、安装依赖组件、编译安装Nginx和RTMP模块、配置Nginx和FFmpeg,以及测试流媒体服务器的搭建... 目录流媒体服务器部署部署安装1.更新系统2.安装依赖组件3.解压4.编译安装(添加RTMP和openssl模块

linux下多个硬盘划分到同一挂载点问题

《linux下多个硬盘划分到同一挂载点问题》在Linux系统中,将多个硬盘划分到同一挂载点需要通过逻辑卷管理(LVM)来实现,首先,需要将物理存储设备(如硬盘分区)创建为物理卷,然后,将这些物理卷组成... 目录linux下多个硬盘划分到同一挂载点需要明确的几个概念硬盘插上默认的是非lvm总结Linux下多

Springboot中分析SQL性能的两种方式详解

《Springboot中分析SQL性能的两种方式详解》文章介绍了SQL性能分析的两种方式:MyBatis-Plus性能分析插件和p6spy框架,MyBatis-Plus插件配置简单,适用于开发和测试环... 目录SQL性能分析的两种方式:功能介绍实现方式:实现步骤:SQL性能分析的两种方式:功能介绍记录

使用 sql-research-assistant进行 SQL 数据库研究的实战指南(代码实现演示)

《使用sql-research-assistant进行SQL数据库研究的实战指南(代码实现演示)》本文介绍了sql-research-assistant工具,该工具基于LangChain框架,集... 目录技术背景介绍核心原理解析代码实现演示安装和配置项目集成LangSmith 配置(可选)启动服务应用场景

oracle DBMS_SQL.PARSE的使用方法和示例

《oracleDBMS_SQL.PARSE的使用方法和示例》DBMS_SQL是Oracle数据库中的一个强大包,用于动态构建和执行SQL语句,DBMS_SQL.PARSE过程解析SQL语句或PL/S... 目录语法示例注意事项DBMS_SQL 是 oracle 数据库中的一个强大包,它允许动态地构建和执行

SQL 中多表查询的常见连接方式详解

《SQL中多表查询的常见连接方式详解》本文介绍SQL中多表查询的常见连接方式,包括内连接(INNERJOIN)、左连接(LEFTJOIN)、右连接(RIGHTJOIN)、全外连接(FULLOUTER... 目录一、连接类型图表(ASCII 形式)二、前置代码(创建示例表)三、连接方式代码示例1. 内连接(I