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

相关文章

Linux换行符的使用方法详解

《Linux换行符的使用方法详解》本文介绍了Linux中常用的换行符LF及其在文件中的表示,展示了如何使用sed命令替换换行符,并列举了与换行符处理相关的Linux命令,通过代码讲解的非常详细,需要的... 目录简介检测文件中的换行符使用 cat -A 查看换行符使用 od -c 检查字符换行符格式转换将

Linux系统配置NAT网络模式的详细步骤(附图文)

《Linux系统配置NAT网络模式的详细步骤(附图文)》本文详细指导如何在VMware环境下配置NAT网络模式,包括设置主机和虚拟机的IP地址、网关,以及针对Linux和Windows系统的具体步骤,... 目录一、配置NAT网络模式二、设置虚拟机交换机网关2.1 打开虚拟机2.2 管理员授权2.3 设置子

Linux系统中卸载与安装JDK的详细教程

《Linux系统中卸载与安装JDK的详细教程》本文详细介绍了如何在Linux系统中通过Xshell和Xftp工具连接与传输文件,然后进行JDK的安装与卸载,安装步骤包括连接Linux、传输JDK安装包... 目录1、卸载1.1 linux删除自带的JDK1.2 Linux上卸载自己安装的JDK2、安装2.1

MySQL双主搭建+keepalived高可用的实现

《MySQL双主搭建+keepalived高可用的实现》本文主要介绍了MySQL双主搭建+keepalived高可用的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,... 目录一、测试环境准备二、主从搭建1.创建复制用户2.创建复制关系3.开启复制,确认复制是否成功4.同

MyBatis 动态 SQL 优化之标签的实战与技巧(常见用法)

《MyBatis动态SQL优化之标签的实战与技巧(常见用法)》本文通过详细的示例和实际应用场景,介绍了如何有效利用这些标签来优化MyBatis配置,提升开发效率,确保SQL的高效执行和安全性,感... 目录动态SQL详解一、动态SQL的核心概念1.1 什么是动态SQL?1.2 动态SQL的优点1.3 动态S

Mysql表的简单操作(基本技能)

《Mysql表的简单操作(基本技能)》在数据库中,表的操作主要包括表的创建、查看、修改、删除等,了解如何操作这些表是数据库管理和开发的基本技能,本文给大家介绍Mysql表的简单操作,感兴趣的朋友一起看... 目录3.1 创建表 3.2 查看表结构3.3 修改表3.4 实践案例:修改表在数据库中,表的操作主要

Linux卸载自带jdk并安装新jdk版本的图文教程

《Linux卸载自带jdk并安装新jdk版本的图文教程》在Linux系统中,有时需要卸载预装的OpenJDK并安装特定版本的JDK,例如JDK1.8,所以本文给大家详细介绍了Linux卸载自带jdk并... 目录Ⅰ、卸载自带jdkⅡ、安装新版jdkⅠ、卸载自带jdk1、输入命令查看旧jdkrpm -qa

Linux samba共享慢的原因及解决方案

《Linuxsamba共享慢的原因及解决方案》:本文主要介绍Linuxsamba共享慢的原因及解决方案,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux samba共享慢原因及解决问题表现原因解决办法总结Linandroidux samba共享慢原因及解决

mysql出现ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost‘ (10061)的解决方法

《mysql出现ERROR2003(HY000):Can‘tconnecttoMySQLserveron‘localhost‘(10061)的解决方法》本文主要介绍了mysql出现... 目录前言:第一步:第二步:第三步:总结:前言:当你想通过命令窗口想打开mysql时候发现提http://www.cpp

MySQL大表数据的分区与分库分表的实现

《MySQL大表数据的分区与分库分表的实现》数据库的分区和分库分表是两种常用的技术方案,本文主要介绍了MySQL大表数据的分区与分库分表的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有... 目录1. mysql大表数据的分区1.1 什么是分区?1.2 分区的类型1.3 分区的优点1.4 分