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

相关文章

一文详解MySQL如何设置自动备份任务

《一文详解MySQL如何设置自动备份任务》设置自动备份任务可以确保你的数据库定期备份,防止数据丢失,下面我们就来详细介绍一下如何使用Bash脚本和Cron任务在Linux系统上设置MySQL数据库的自... 目录1. 编写备份脚本1.1 创建并编辑备份脚本1.2 给予脚本执行权限2. 设置 Cron 任务2

SQL Server修改数据库名及物理数据文件名操作步骤

《SQLServer修改数据库名及物理数据文件名操作步骤》在SQLServer中重命名数据库是一个常见的操作,但需要确保用户具有足够的权限来执行此操作,:本文主要介绍SQLServer修改数据... 目录一、背景介绍二、操作步骤2.1 设置为单用户模式(断开连接)2.2 修改数据库名称2.3 查找逻辑文件名

SQL Server数据库死锁处理超详细攻略

《SQLServer数据库死锁处理超详细攻略》SQLServer作为主流数据库管理系统,在高并发场景下可能面临死锁问题,影响系统性能和稳定性,这篇文章主要给大家介绍了关于SQLServer数据库死... 目录一、引言二、查询 Sqlserver 中造成死锁的 SPID三、用内置函数查询执行信息1. sp_w

Python UV安装、升级、卸载详细步骤记录

《PythonUV安装、升级、卸载详细步骤记录》:本文主要介绍PythonUV安装、升级、卸载的详细步骤,uv是Astral推出的下一代Python包与项目管理器,主打单一可执行文件、极致性能... 目录安装检查升级设置自动补全卸载UV 命令总结 官方文档详见:https://docs.astral.sh/

Linux脚本(shell)的使用方式

《Linux脚本(shell)的使用方式》:本文主要介绍Linux脚本(shell)的使用方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录概述语法详解数学运算表达式Shell变量变量分类环境变量Shell内部变量自定义变量:定义、赋值自定义变量:引用、修改、删

canal实现mysql数据同步的详细过程

《canal实现mysql数据同步的详细过程》:本文主要介绍canal实现mysql数据同步的详细过程,本文通过实例图文相结合给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的... 目录1、canal下载2、mysql同步用户创建和授权3、canal admin安装和启动4、canal

Nexus安装和启动的实现教程

《Nexus安装和启动的实现教程》:本文主要介绍Nexus安装和启动的实现教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、Nexus下载二、Nexus安装和启动三、关闭Nexus总结一、Nexus下载官方下载链接:DownloadWindows系统根

SQL中JOIN操作的条件使用总结与实践

《SQL中JOIN操作的条件使用总结与实践》在SQL查询中,JOIN操作是多表关联的核心工具,本文将从原理,场景和最佳实践三个方面总结JOIN条件的使用规则,希望可以帮助开发者精准控制查询逻辑... 目录一、ON与WHERE的本质区别二、场景化条件使用规则三、最佳实践建议1.优先使用ON条件2.WHERE用

MySQL存储过程之循环遍历查询的结果集详解

《MySQL存储过程之循环遍历查询的结果集详解》:本文主要介绍MySQL存储过程之循环遍历查询的结果集,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录前言1. 表结构2. 存储过程3. 关于存储过程的SQL补充总结前言近来碰到这样一个问题:在生产上导入的数据发现

MySQL 衍生表(Derived Tables)的使用

《MySQL衍生表(DerivedTables)的使用》本文主要介绍了MySQL衍生表(DerivedTables)的使用,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学... 目录一、衍生表简介1.1 衍生表基本用法1.2 自定义列名1.3 衍生表的局限在SQL的查询语句select