Linux(SUSE 12)安装mysql

24 篇文章 0 订阅

安装的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]节点下去了,重启后发现还是老问题,才返现放错地方了

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值