Linux5下安装MySQL过程记录
磨砺技术珠矶,践行数据之道,追求卓越价值
回到上一级页面: PostgreSQL杂记页 回到顶级页面:PostgreSQL索引页
[作者 高健@博客园 luckyjackgao@gmail.com]
1)下载:
在mysql的网站上,下载 mysql-5.6.13-linux-glibc2.5-x86_64.tar.gz
比如拷贝到 /soft/mysql5/ 目录下。
2)解压:
[root@server local]#cd /usr/local
[root@server local]#tar zxvf /soft/mysql5/mysql-5.6.13-linux-glibc2.5-x86_64.tar.gz
3)建立软链接:
[root@server local]#ln -s mysql-5.6.13-linux-glibc2.5-x86_64 mysql
查看:
[root@server local]# ls -lrt mysql
lrwxrwxrwx 1 root root 36 9月 12 13:22 mysql -> ./mysql-5.6.13-linux-glibc2.5-x86_64
[root@server local]#
4)建立mysql相关的用户和组:
[root@server local]#groupadd mysql
[root@server local]#useradd -r -g mysql mysql
5)生成数据库:
[root@server local]# cd mysql
[root@server local]# chown -R mysql .
[root@server local]#chgrp -R mysql .
[root@server local]# scripts/mysql_install_db --user=mysql
[root@server local]# chown -R root .
[root@server local]# chown -R mysql data
6)拷贝必要的文件(此为可选步骤):
[root@server local]#cp support-files/mysql.server /etc/init.d/mysql.server
7)启动数据库:
[root@server local]bin/mysqld_safe --user=mysql &
8)访问数据库:
[root@server ~]# mysql --user=mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.13 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+
2 rows in set (0.00 sec)
mysql> quit
Bye
[root@server ~]#
9)关闭数据库时,发现无法关闭数据库,于是强制关闭进程,然后退出。
10)设置权限:
重新启动数据库(带 --skip-grant-tables参数):
[root@server ~]# mysqld_safe --skip-grant-tables &
[1] 3140
[root@server ~]# 130912 14:49:51 mysqld_safe Logging to '/usr/local/mysql/data/server.gao.err'.
130912 14:49:51 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
设置root用户的口令(被要求Enter password的时候,直接按回车键就过去了):
[root@server ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.13 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, 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> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set password=password("abcdef") where user='root' and host='localhost';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@server ~]#
为了验证是否可以正常关闭,再次重新启动来看一下:
[root@server ~]# mysqld_safe --skip-grant-tables
130912 14:57:36 mysqld_safe Logging to '/usr/local/mysql/data/server.gao.err'.
130912 14:57:36 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
[root@server ~]#
然后运行:
[root@server ~]# mysqladmin -uroot shutdown
[root@server ~]#
成功关闭。
下一次,完全正常启动,看能否关闭:
[root@server ~]# mysqld_safe
130912 15:01:26 mysqld_safe Logging to '/usr/local/mysql/data/server.gao.err'.
130912 15:01:26 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
[root@server ~]# mysqladmin -uroot -p shutdown
Enter password:
[root@server ~]#
关闭成功了。
[作者 高健@博客园 luckyjackgao@gmail.com]
回到上一级页面: PostgreSQL杂记页 回到顶级页面:PostgreSQL索引页
磨砺技术珠矶,践行数据之道,追求卓越价值
相关文章
- 安装mysql-python
- Linux下,如何给PHP安装pdo_mysql扩展
- 【Mysql安装】Mac下安装mysql
- ubuntu MySQL安装和设置
- mysql修改本地主机连接
- Mysql:Error Code 1235,This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME 错误解决
- MySQL超时参数以及相关数据集成、DataX数据同步案例分享
- Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’
- MySQL运维---源码安装
- MySQL中的char和varchar&mysql中varchar能存多少汉字、数字,以及varchar(100)和varchar(10)的区别
- docker安装mysql及相关配置、运行细节和常见报错解决方案
- mysql 让id字段 以1000 形式开头
- MySQL - count(字段)、count(主键)、count(1)、count(*)的区别
- 一文了解MySQL的Buffer Pool
- 2022年最新最详细的MYSQL数据库安装(详细图解过程、毕成功)
- db2,oracle,mysql ,sqlserver限制返回的行数
- [mysqldumpslow 报错] Died at /usr/local/mysql/bin/mysqldumpslow line 161, <> chunk 236.
- MySQL Windows ZIP 免费安装和启动设置
- 如何测试mysql是否安装成功
- 实践理解Mysql事务隔离级别之可重复读
- mysql 查看 脏页_MySQL:刷脏页
- mysql 终止 存储过程
- Mysql之安全清理mysql-slow.log
- MySql高级----Linux下的mysql的安装与初始化配置
- MySQL安装后第一次修改密码
- Linux初始环境下安装MySQL数据库