[转帖]**MySQL最简单原始安装和配置  【切换目录的错误】_MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 1537 | 回复: 0   主题: [转帖]**MySQL最简单原始安装和配置  【切换目录的错误】        下一篇 
qq_黑人的
注册用户
等级:新兵
经验:16
发帖:5
精华:0
注册:2016-9-26
状态:离线
发送短消息息给qq_黑人的 加好友    发送短消息息给qq_黑人的 发消息
发表于: IP:您无权察看 2018-8-14 14:12:04 | [全部帖] [楼主帖] 楼主

-rw-rw-rw- 1 root root
24176228 Apr
1 19:00 mysql-community-client-5.7.11-1.el6.x86_64.rpm
-rw-rw-rw- 1 root root
333480 Apr
1 19:05 mysql-community-common-5.7.11-1.el6.x86_64.rpm
-rw-rw-rw- 1 root root
3854020 Apr
1 19:00 mysql-community-devel-5.7.11-1.el6.x86_64.rpm
-rw-rw-rw- 1 root root
2237704 Apr
1 19:46 mysql-community-libs-5.7.11-1.el6.x86_64.rpm
-rw-rw-rw- 1 root root
1722544 Apr
1 19:01 mysql-community-libs-compat-5.7.11-1.el6.x86_64.rpm
-rw-rw-rw- 1 root root 141256272 Apr
1 18:53 mysql-community-server-5.7.11-1.el6.x86_64.rpm
[root@ibm01 aaa]#
[root@ibm01 aaa]# rpm -qa|grep sql
sqlite-3.6.20-1.el6_7.2.x86_64
qt-sqlite-4.6.2-28.el6_5.x86_64
[root@ibm01 aaa]#
[root@ibm01 aaa]# rpm -ivh *rpm
warning: mysql-community-client-5.7.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...
########################################### [100%]
1:mysql-community-common ########################################### [ 17%]
2:mysql-community-libs
########################################### [ 33%]
3:mysql-community-client ########################################### [ 50%]
4:mysql-community-server ########################################### [ 67%]
5:mysql-community-devel
########################################### [ 83%]
6:mysql-community-libs-co########################################### [100%]
[root@ibm01 aaa]#
[root@ibm01 aaa]# rpm -qa|grep sql
sqlite-3.6.20-1.el6_7.2.x86_64
qt-sqlite-4.6.2-28.el6_5.x86_64
mysql-community-libs-5.7.11-1.el6.x86_64
mysql-community-devel-5.7.11-1.el6.x86_64
mysql-community-server-5.7.11-1.el6.x86_64
mysql-community-libs-compat-5.7.11-1.el6.x86_64
mysql-community-common-5.7.11-1.el6.x86_64
mysql-community-client-5.7.11-1.el6.x86_64
[root@ibm01 aaa]# chkconfig --list|grep mysql
mysqld
0:off
1:off
2:off
3:on
4:on
5:on
6:off
[root@ibm01 aaa]#
[root@ibm01 aaa]#
[root@ibm01 aaa]# service mysqld status
mysqld is stopped
[root@ibm01 aaa]# service mysqld start
Initializing MySQL database:
[
OK
Installing validate password plugin:
[
OK
Starting mysqld:
[
OK
[root@ibm01 aaa]# mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@ibm01 aaa]#
[root@ibm01 aaa]# cd /var
[root@ibm01 var]# ls
[root@ibm01 log]#
[root@ibm01 log]# cat mysqld.log|grep password
2016-07-14T07:31:28.593208Z 1 [Note] A temporary password is generated for root@localhost: Yk%ggyVqd4g/
2016-07-14T07:31:32.550193Z 0 [Note] Execution of init_file '/var/lib/mysql/install-validate-password-plugin.QyKQYV.sql' started.
2016-07-14T07:31:32.560557Z 0 [Note] Execution of init_file '/var/lib/mysql/install-validate-password-plugin.QyKQYV.sql' ended.
2016-07-14T07:31:34.411089Z 0 [Note] Shutting down plugin 'sha256_password'
2016-07-14T07:31:34.411092Z 0 [Note] Shutting down plugin 'mysql_native_password'
2016-07-14T07:31:36.205275Z 2 [Note] Access denied for user 'UNKNOWN_MYSQL_USER'@'localhost' (using password: NO)
2016-07-14T07:34:53.150740Z 3 [Note] Access denied for user 'root'@'localhost' (using password: NO)
[root@ibm01 log]#


改个密码也这么曲折

****************************************

至少运行了 10条命令

[root@ibm01 log]#
[root@ibm01 log]# mysql -uroot -pYk%ggyVqd4g/
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.
Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.11
.....................
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql>
alter user 'root'@'localhost' identified by 'root';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql>
mysql> use mysql
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql>
alter user 'root'@'localhost' identified by 'root123456';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> use mysql
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql>
alter user 'root'@'localhost' identified by 'root123!';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql>
mysql>
alter user 'root'@'localhost' identified by 'Root1234';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql>
mysql>
alter user 'root'@'localhost' identified by 'Root1234!';
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql>
flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like '%dir%';
+-----------------------------------------+----------------------------+
| Variable_name
| Value
+-----------------------------------------+----------------------------+
| basedir
| /usr
| binlog_direct_non_transactional_updates | OFF
| character_sets_dir
| /usr/share/mysql/charsets/ |
| datadir
| /var/lib/mysql/
| ignore_db_dirs
|
| innodb_data_home_dir
|
| innodb_log_group_home_dir
| ./
| innodb_max_dirty_pages_pct
| 75.000000
| innodb_max_dirty_pages_pct_lwm
| 0.000000
| innodb_tmpdir
|
mysql -uroot -pRoot1234!
[root@ibm01 log]# cd /var/lib/mysql
[root@ibm01 mysql]# ls -al
total 110668
drwxr-x--x
6 mysql mysql
4096 Jul 14 17:35 .
drwxr-xr-x. 41 root
root
4096 Jul 14 15:16 ..
-rw-r-----
1 mysql mysql
56 Jul 14 15:31 auto.cnf
-rw-------
1 mysql mysql
1675 Jul 14 15:31 ca-key.pem
-rw-r--r--
1 mysql mysql
1074 Jul 14 15:31 ca.pem
-rw-r--r--
1 mysql mysql
1078 Jul 14 15:31 client-cert.pem
-rw-------
1 mysql mysql
1679 Jul 14 15:31 client-key.pem
-rw-r-----
1 mysql mysql
326 Jul 14 16:13 ib_buffer_pool
drwxr-x---
2 mysql mysql
4096 Jul 14 17:22 tx
[root@ibm01 mysql]# cd /var/log
[root@ibm01 log]# ls -al
total 3356
drwx------.
2 root
root
4096 May 12 03:29 httpd
-rw-r--r--.
1 root
root
145708 Jul 14 18:55 lastlog
-rw-------
1 root
root
44814 Jul 14 15:15 maillog
-rw-------.
1 root
root
2552 Jun 21 08:27 maillog-20160621
-rw-------
1 root
root
1563 Jun 29 17:51 maillog-20160629
-rw-------
1 root
root
0 Jun 29 18:27 maillog-20160703
-rw-------
1 root
root
687 Jul 13 19:21 maillog-20160713
-rw-------
1 root
root
144 Jul 13 20:42 messages
-rw-------.
1 root
root
717453 Jun 21 08:28 messages-20160621
-rw-------
1 root
root
496901 Jun 29 18:21 messages-20160629
-rw-------
1 root
root
144 Jun 29 18:27 messages-20160703
-rw-------
1 root
root
189607 Jul 13 19:37 messages-20160713
-rw-r-----
1 mysql mysql
0 Jul 14 18:37 mysqld.log
-rw-r-----
1 mysql mysql
24198 Jul 14 16:29 mysqld.log.11


切换数据库文件位置排除错误:

*******************************
cd  /var/lib/mysql


记得带 -p

cp * -R -p  /efs/ibm01/db/mysql
chown  mysql.mysql     /efs/ibm01/db/mysql


检查 文件格式: ANSI 

*******************************
[root@ibm01 etc]#
[root@ibm01 etc]# service mysqld start
my_print_defaults: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
my_print_defaults: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
my_print_defaults: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
my_print_defaults: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
MySQL Daemon failed to start.
Starting mysqld:
[FAILED]
[root@ibm01 etc]#
********************************************************


启动服务失败,报my.cnf  
line1 有错误  
,第一行就有错误, 怎么想!查看文件头了。

[root@ibm01 etc]# cat my.cnf


锘縖mysqld_safe]

pid-file=/efs/ibm01/db/mysql/run/mysqld.pid
[root@ibm01 etc]# cat
my-gpfs.cnf


锘?###

####
[root@ibm01 etc]# service mysqld start
MySQL Daemon failed to start.
Starting mysqld:  [FAILED]
********************************************************


mysqld启动失败

且/var/log/mysqld.log 里面是空  
0字节,

mysql 目录的 hostname.err 文件也没有生成,似乎无从下手的赶脚

从根本开始吧。

[root@ibm01 etc]# which mysqld_safe
/usr/bin/mysqld_safe
[root@ibm01 etc]#
mysqld_safe
2016-07-14T08:37:40.638251Z mysqld_safe Logging to '/efs/ibm01/db/mysql/log/alert.log'.
touch: cannot touch `/efs/ibm01/db/mysql/log/alert.log':
No such file or directory
chmod: cannot access `/efs/ibm01/db/mysql/log/alert.log': No such file or directory
touch: cannot touch `/efs/ibm01/db/mysql/log/alert.log': No such file or directory
chown: cannot access `/efs/ibm01/db/mysql/log/alert.log': No such file or directory
2016-07-14T08:37:40.666186Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/bin/mysqld_safe: line 135: /efs/ibm01/db/mysql/log/alert.log: No such file or directory
#漏掉log 目录
*********************
mkdir  -p  /efs/ibm01/db/mysql/log
chown  mysql.mysql     /efs/ibm01/db/mysql/log
2016-07-14T08:39:26.184581Z 0 [Note] Plugin 'FEDERATED' is disabled.
2016-07-14T08:39:26.231633Z 0 [Warning] InnoDB: Cannot open table mysql/plugin from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.
mysqld: Table 'mysql.plugin' doesn't exist
2016-07-14T08:39:26.231802Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2016-07-14T08:39:26.243966Z 0 [ERROR] unknown variable 'key_buffer=20M'
2016-07-14T08:39:26.244022Z 0 [ERROR]
Aborting
2016-07-14T08:39:26.244046Z 0 [Note] Binlog end
2016-07-14T08:39:26.244536Z 0 [Note] Shutting down plugin 'ngram'
2016-07-14T08:39:26.244689Z 0 [Note] Shutting down plugin 'ARCHIVE'
********************************************************


这次mysqld.log 有错误信息,注意Aborting的位置,屏蔽参数,检查最近的一个ERROR

另外一个是可以忽略的!

 Can't open the mysql.plugin table.
******************************************************************


莫名其妙的 Table 'mysql.servers' doesn't exist

******************************************************************
2016-07-14T08:43:46.020993Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2016-07-14T08:43:46.138014Z 0 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
2016-07-14T09:21:24.939792Z 5 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist


可能性:

检查了目录下文件 
 servers.frm   servers.ibd都是存在的

请检查cnf里面路径是否正确!!!修正后没问题

这两个参数

innodb_data_home_dir
datadir
root@(none) 05:17:36>show variables
like '%home%';
+---------------------------+---------------------------+
| Variable_name
| Value
+---------------------------+---------------------------+
| innodb_data_home_dir
| /efs/ibm01/db/mysql/mysql |
| innodb_log_group_home_dir | /efs/ibm01/db/mysql/mysql |
+---------------------------+---------------------------+
[root@ibm01 etc]#
mysqld_safe --user=mysql   --datadir=/efs/ibm01/db/mysql
2016-07-14T09:48:26.543424Z mysqld_safe Logging to '/efs/ibm01/db/mysql/log/alert.log'.
2016-07-14T09:48:26.564189Z mysqld_safe Starting mysqld daemon with databases from /efs/ibm01/db/mysql


检查cnf 发现

datadir=/efs/ibm01/db/mysql
innodb_data_home_dir=/efs/ibm01/db/mysql/mysql
innodb_log_group_home_dir=/efs/ibm01/db/mysql/mysql
root@mysql 06:10:41>
root@mysql 06:10:41>flush privileges;
Query OK, 0 rows affected (0.01 sec)
root@mysql 06:10:50>
root@mysql 06:10:51>
root@mysql 06:10:51>desc servers
-> ;
+-------------+----------+------+-----+---------+-------+
| Field       | Type     | Null | Key | Default | Extra |
+-------------+----------+------+-----+---------+-------+
| Server_name | char(64) | NO   | PRI |         |       |
| Host        | char(64) | NO   |     |         |       |
| Db
| char(64) | NO
|
|
|
| Username
| char(64) | NO
|
|
|
| Password
| char(64) | NO
|
|
|
| Port
| int(4)
| NO
|
| 0
|
| Socket
| char(64) | NO
|
|
|
| Wrapper
| char(64) | NO
|
|
|
| Owner
| char(64) | NO
|
|
|
+-------------+----------+------+-----+---------+-------+
9 rows in set (0.00 sec)
root@mysql 06:10:56>


正确的主目录 datadir 下应该是这些

********************************************
[root@ibm01 log]# cd /efs/ibm01/db/mysql
[root@ibm01 mysql]# ls -al
total 434280
drwxr-x--x 7 mysql mysql
8192 Jul 14 18:37 .
drwxr-xr-x 3 root
root
512 Jul 14 16:03 ..
-rw-r----- 1 mysql mysql
56 Jul 14 15:31 auto.cnf
-rw------- 1 mysql mysql
1675 Jul 14 15:31 ca-key.pem
-rw-r--r-- 1 mysql mysql
1074 Jul 14 15:31 ca.pem
-rw-r--r-- 1 mysql mysql
1078 Jul 14 15:31 client-cert.pem
-rw------- 1 mysql mysql
1679 Jul 14 15:31 client-key.pem
-rw-r----- 1 mysql mysql
289 Jul 14 18:37 ib_buffer_pool
-rw-r----- 1 mysql mysql
12582912 Jul 14 18:37 ibdata1
-rw-r----- 1 mysql mysql 104857600 Jul 14 18:37 ib_logfile0
-rw-r----- 1 mysql mysql 104857600 Jul 14 17:57 ib_logfile1
-rw-r----- 1 mysql mysql 104857600 Jul 14 17:57 ib_logfile2
-rw-r----- 1 mysql mysql 104857600 Jul 14 17:57 ib_logfile3
-rw-r----- 1 mysql mysql
12582912 Jul 14 18:37 ibtmp1
drwxr-xr-x 2 mysql mysql
8192 Jul 14 18:37 log
drwxr-x--x 2 mysql mysql
8192 Jul 14 17:53 mysql
-rw-rw---- 1 root
root
6 Jul 14 18:37 mysqld_safe.pid
drwxr-x--- 2 mysql mysql
8192 Jul 14 15:31 performance_schema
-rw------- 1 mysql mysql
1679 Jul 14 15:31 private_key.pem
-rw-r--r-- 1 mysql mysql
451 Jul 14 15:31 public_key.pem
drwxr-xr-x 2 mysql root
512 Jul 14 18:37 run
-rw-r--r-- 1 mysql mysql
1078 Jul 14 15:31 server-cert.pem
-rw------- 1 mysql mysql
1675 Jul 14 15:31 server-key.pem
drwxr-x--- 2 mysql mysql
8192 Jul 14 15:31 sys
[root@ibm01 mysql]# cat
auto.cnf
[auto]
server-uuid=fa5ef7c1-4994-11e6-8c6a-000c29b0c80d
[root@ibm01 mysql]#




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论