首页 > 数据库 > MySQL > 正文

mysql学习-安置

2024-07-24 12:34:53
字体:
来源:转载
供稿:网友
       mysql学习-安置:

  一、mysql安装包解压,注意下载的mysql包必须与操作系统版本需求一致。
  [root@node1 soft]# ls
  mysql-5.7.11-1.el5.i686.rpm-bundle.tar
  [root@node1 soft]# ls -l
  total 600552
  -rw-r--r-- 1 root root 614359040 Feb 18 12:02 mysql-5.7.11-1.el5.i686.rpm-bundle.tar
  [root@node1 soft]# tar -xvf mysql-5.7.11-1.el5.i686.rpm-bundle.tar
  mysql-community-libs-5.7.11-1.el5.i686.rpm
  mysql-community-common-5.7.11-1.el5.i686.rpm
  mysql-community-libs-compat-5.7.11-1.el5.i686.rpm
  mysql-community-server-5.7.11-1.el5.i686.rpm
  mysql-5.7.11-1.el5.i686.rpm
  mysql-community-test-5.7.11-1.el5.i686.rpm
  mysql-community-devel-5.7.11-1.el5.i686.rpm
  mysql-community-client-5.7.11-1.el5.i686.rpm
  mysql-community-embedded-5.7.11-1.el5.i686.rpm
  mysql-community-embedded-devel-5.7.11-1.el5.i686.rpm
  二、安装mysql
  [root@node1 soft]# rpm -ivh mysql-community-server-5.7.11-1.el5.i686.rpm
  warning: mysql-community-server-5.7.11-1.el5.i686.rpm: Header V3 DSA signature: NOKEY, key ID
 
 
  5072e1f5
  error: Failed dependencies:
          mysql-community-client = 5.7.11-1.el5 is needed by mysql-community-server-5.7.11-1.el5.i686
          mysql-community-common = 5.7.11-1.el5 is needed by mysql-community-server-5.7.11-

  --mysql会自动添加mysql用户
  [root@node1 soft]# id mysql
  uid=27(mysql) gid=27(mysql) groups=27(mysql)
  [root@node1 soft]# ls -l
  total 1201144
  -rw-r--r-- 1 7155 wheel     40516 Feb  2 17:27 mysql-5.7.11-1.el5.i686.rpm
  -rw-r--r-- 1 root root  614359040 Feb 18 12:02 mysql-5.7.11-1.el5.i686.rpm-bundle.tar
  -rw-r--r-- 1 7155 wheel  32644512 Feb  2 17:31 mysql-community-client-5.7.11-1.el5.i686.rpm
  -rw-r--r-- 1 7155 wheel    825859 Feb  2 17:31 mysql-community-common-5.7.11-1.el5.i686.rpm
  -rw-r--r-- 1 7155 wheel   5402990 Feb  2 17:31 mysql-community-devel-5.7.11-1.el5.i686.rpm
  -rw-r--r-- 1 7155 wheel  53512687 Feb  2 17:31 mysql-community-embedded-5.7.11-1.el5.i686.rpm
  -rw-r--r-- 1 7155 wheel 168617172 Feb  2 17:31 mysql-community-embedded-devel-5.7.11-
 
  1.el5.i686.rpm
  -rw-r--r-- 1 7155 wheel   2968131 Feb  2 17:32 mysql-community-libs-5.7.11-1.el5.i686.rpm
  -rw-r--r-- 1 7155 wheel   2172050 Feb  2 17:32 mysql-community-libs-compat-5.7.11-1.el5.i686.rpm
  -rw-r--r-- 1 7155 wheel 209431525 Feb  2 17:33 mysql-community-server-5.7.11-1.el5.i686.rpm
  -rw-r--r-- 1 7155 wheel 138730825 Feb  2 17:34 mysql-community-test-5.7.11-1.el5.i686.rpm

  三、使用mysql安全登陆,修改root账号密码

  [root@node1 ~]# mysqld_safe --skip--tables &
  [1] 5379
  [root@node1 ~]# Usage: grep [OPTION]... PATTERN [FILE]...
  Try `grep --help' for more information.
  grep: write error: Broken pipe
  2016-02-29T19:40:08.792329Z mysqld_safe Logging to '/var/log/mysqld.log'.
  2016-02-29T19:40:08.861817Z mysqld_safe A mysqld process already exists

  [root@node1 ~]# mysql -u root mysql
  Reading table information for completion of table and column names
  You can turn off this feature to get a quicker startup with -A

  mysql> select rurrent_user;
  ERROR 1054 (42S22): Unknown error 1054
  mysql>
  mysql> use mysql
  Database changed
  mysql>
  mysql>
  mysql> update mysql.user set authentication_string=password('root') where user='root';
  Query OK, 0 rows affected, 1 warning (0.00 sec)

(编辑:武林网)

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表