- 浏览: 356589 次
文章分类
最新评论
-
lord_is_layuping:
...
PYQT4 + Python2.6 + eric4-4.2.2a的安装全过程 -
597272095:
3Q
Oracle客户端PL/SQL 中文乱码解决 -
lpluck08:
如果不是在git本地版本目录中执行的话,会有问题。到本地版本目 ...
git 中文文件名 乱码 mac -
aiove:
-API
分享到: 阿撒旦发撒旦发速度飞洒发
iOS开发开源项目推荐 -
Wallian_hua:
感谢,楼主的详细分析,对我的启发很大。。我也正在研究这方面的技 ...
[ZT]简单OCR实现原理
当前的数据库种类比较多,有MS-SQL,Oracle,MYSQL,POSTGRESQL等,而MYSQL在LAMP架构中的份量是举足轻重的,下面就来介绍下Centos5下MySQL的安装和基本配置。
使用yum安装MySQL(在LAMP架构中,开始安装mysql之前应该先安装apache和php)
[root@centos5 /]# yum -y install mysql-server
Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
* base: centos.candishosting.com.cn
* updates: mirror.khlug.org
* addons: centos.candishosting.com.cn
* extras: centos.candishosting.com.cn
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package mysql-server.i386 0:5.0.45-7.el5 set to be updated
--> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15) for package: mysql-server
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server
--> Processing Dependency: libmysqlclient_r.so.15(libmysqlclient_15) for package: mysql-server
--> Processing Dependency: libmysqlclient_r.so.15 for package: mysql-server
--> Processing Dependency: mysql = 5.0.45-7.el5 for package: mysql-server
--> Processing Dependency: libmysqlclient.so.15 for package: mysql-server
--> Running transaction check
---> Package perl-DBD-MySQL.i386 0:3.0007-1.fc6 set to be updated
---> Package mysql.i386 0:5.0.45-7.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
mysql-server i386 5.0.45-7.el5 base 9.7 M
Installing for dependencies:
mysql i386 5.0.45-7.el5 base 4.1 M
perl-DBD-MySQL i386 3.0007-1.fc6 base 147 k
Transaction Summary
=============================================================================
Install 3 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 14 M
Downloading Packages:
(1/3): mysql-5.0.45-7.el5 100% |=========================| 4.1 MB 02:57
(2/3): mysql-server-5.0.4 100% |=========================| 9.7 MB 07:19
(3/3): perl-DBD-MySQL-3.0 100% |=========================| 147 kB 00:07
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: mysql ######################### [1/3]
Installing: perl-DBD-MySQL ######################### [2/3]
Installing: mysql-server ######################### [3/3]
Installed: mysql-server.i386 0:5.0.45-7.el5
Dependency Installed: mysql.i386 0:5.0.45-7.el5 perl-DBD-MySQL.i386 0:3.0007-1.fc6
Complete!
安装PHP访问MySQL数据库的工具“php-mysql”
[root@centos5 ~]# yum -y install php-mysql
Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
* base: centos.candishosting.com.cn
* updates: mirror.khlug.org
* addons: centos.candishosting.com.cn
* extras: centos.candishosting.com.cn
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package php-mysql.i386 0:5.1.6-20.el5_2.1 set to be updated
--> Processing Dependency: php-pdo for package: php-mysql
--> Running transaction check
---> Package php-pdo.i386 0:5.1.6-20.el5_2.1 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
php-mysql i386 5.1.6-20.el5_2.1 updates 84 k
Installing for dependencies:
php-pdo i386 5.1.6-20.el5_2.1 updates 62 k
Transaction Summary
=============================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 146 k
Downloading Packages:
(1/2): php-pdo-5.1.6-20.e 100% |=========================| 62 kB 00:20
(2/2): php-mysql-5.1.6-20 100% |=========================| 84 kB 00:11
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: php-pdo ######################### [1/2]
Installing: php-mysql ######################### [2/2]
Installed: php-mysql.i386 0:5.1.6-20.el5_2.1
Dependency Installed: php-pdo.i386 0:5.1.6-20.el5_2.1
Complete!
[root@centos5 ~]# vi /etc/my.cnf (编辑mysql配置文件)
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
default-character-set = utf8 (添加这一行,让MySQL的默认编码为UTF-8)
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[mysql]
default-character-set = utf8 (添加这一行,设置mysql在安全模式启动后的默认编码为UTF-8)
[root@centos5 ~]# chkconfig mysqld on (设置mysql在开机后自动启动)
[root@centos5 ~]# chkconfig --list mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@centos5 ~]# /etc/rc.d/init.d/mysqld start (启动mysql服务)
Initializing MySQL database: Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
(在这里系统提示可以使用mysqladmin为root,localhost和root,centos5设置密码,centos5是我的主机名,可使用这个命令的时候系统却报错了!)
/usr/bin/mysqladmin -u root -h centos5 password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at
http://shop.mysql.com
[ OK ]
Starting MySQL: [ OK ]
[root@centos5 /]# netstat -ntpl |grep mysqld
tcp 0 0 0.0.0.0:3306
0.0.0.0:*
LIST EN 8168/mysqld
[root@centos5 /]# mysql -u root -p (正如前面提到的报错,在这里是因为root这个mysql用户已经有非空的密码存在了。)
Enter password:
ERROR 1045 (28000): Access denied for user
'root'@'localhost'
(using password: NO)
(在这里我在Internet上搜索到了一个解决的办法)
[root@centos5 /]# /etc/rc.d/init.d/mysqld stop (先停止mysql服务)
Stopping MySQL: [ OK ]
[root@centos5 /]# mysqld_safe
--user=mysql --skip-grant-tables
--skip-networking&(重新启动mysql服务的时候加上这些参数,这些参数具体代表了什么,我也不明白,大概是设置启动服务的
时候跳过验证密码的表和网络吧!)
[1] 8850
Starting mysqld daemon with databases from /var/lib/mysql
[root@centos5 /]# /etc/rc.d/init.d/mysqld status
mysqld (pid 8902) is running...
[root@centos5 /]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.45 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> (果然这次不用输入密码就可以进来了,也没有什么报错信息)
mysql> select user,host,password from mysql.user; (查看系用户表,果然localhost,root真的有密码,其他的两个都没有,如果用另外两个root用户登陆应该就不会出现之前的问题了)
+------+-----------+------------------+
| user | host | password |
+------+-----------+------------------+
| root | localhost | 7a3310dc39c1d3df |
| root | centos5 | |
| root | 127.0.0.1 | |
+------+-----------+------------------+
3 rows in set (0.01 sec)
mysql> UPDATE user SET Password=PASSWORD('123') where USER='root'; (接下来当然要修改下密码啦,这里就简单的设置成123)
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> show databases; (查看下当前的数据库)
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.01 sec)
[root@centos5 /]# /etc/rc.d/init.d/mysqld stop (停止mysql服务)
STOPPING server from pid file /var/run/mysqld/mysqld.pid
090201 09:23:00 mysqld ended
Stopping MySQL: [ OK ]
[1]+ Done mysqld_safe --user=mysql --skip-grant-tables --skip-networking
[root@centos5 /]# /etc/rc.d/init.d/mysqld start (以正常的方式启动服务)
Starting MySQL: [ OK ]
[root@centos5 /]# mysql -u root -p (输入密码123登陆)
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.45 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> select user,host from mysql.user; (查看用户,并删除另外的两个root用户)
+------+-----------+
| user | host |
+------+-----------+
| root | 127.0.0.1 |
| root | centos5 |
| root | localhost |
+------+-----------+
3 rows in set (0.00 sec)
mysql> delete from mysql.user where user='root' and host='127.0.0.1';
Query OK, 0 rows affected (0.01 sec)
mysql> delete from mysql.user where user='root' and host='centos5';
Query OK, 1 row affected (0.01 sec)
mysql> select user,host from mysql.user;
+------+-----------+
| user | host |
+------+-----------+
| root | localhost |
+------+-----------+
1 row in set (0.00 sec)
mysql> exit
Bye
重新启动一次HTTP服务,让php-mysql反映到HTTP服务中
[root@centos5 /]# /etc/rc.d/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;
grant all on depot_development.* to 'david'@'localhost' identified by 'lovelove';
发表评论
-
最强大脑第六期饶舜涵和倪梓强 他们的大脑是天生的么?
2014-02-15 01:39 2907刚看了 最强大脑第6期, 里面有两个人我比较关注 饶舜 ... -
宏碁 Acer AS4738ZG-P622G32Mncc 驱动
2011-06-13 22:37 1538主板 Intel 主板驱动 9.1.1.102 ... -
git 中文文件名 乱码 mac
2011-06-10 18:32 3598git 默认中文文件名是 xx% 是因为 对0x80以上的字 ... -
必看电影
2010-09-03 11:50 1662moxue32 提名的电影是《 ... -
jQuery.validate使用必备
2010-09-01 19:34 1213jQuery.validate使用必备 ... -
centos 雅黑
2010-04-07 15:39 1621#所有操作均在root权限下进行 1、到xp或者vi ... -
【转】西厢计划原理
2010-03-19 10:28 20558转 http://blog.youxu.info/2010 ... -
不需要让青少年有判断力和批判力
2010-01-21 13:14 1485“不需要让青少年有判断力和批判力。只要给他们汽车、摩托车、美丽 ... -
putty中文乱码问题解决
2010-01-20 21:16 1401用putty从windows xp连接ubuntu serve ... -
vi backspace
2010-01-16 14:07 1031vi ~/.vimrc set backspace=i ... -
如何做SVN迁移
2009-07-31 10:43 1502如何做SVN 迁移 ... -
pdf 免费 转换网站
2009-04-26 13:46 11977在dig网站上看到一个在线转换pdf的网站,现在收集整理如下: ... -
ruby 遍历文件夹 所有文件
2009-04-03 17:00 7420def traverse_dir(file_path) i ... -
ruby watir 整理
2009-03-18 23:54 58085. 异常对象识别(Watir应用解决方案) Watir基于处 ... -
大姐~~~假钞不是这么做的
2009-01-06 22:20 1124大姐~~~假钞不是这么做的 楼主发帖 一妇女拿假钞去买早 ... -
JPEG 原理详细实例分析及其在嵌入式 Linux 中的应用 developerWorks
2008-11-17 01:44 1650JPEG 原理详细实例分析及其在嵌入式 Linux 中 ... -
Bmp 标准
2008-11-13 16:44 2200工具软件:工具软件:H ... -
JPEG文件格式简单分析
2008-10-27 23:19 3082摘要: 这篇文章大体上介绍了 JPEG 文件的结构信息以及它 ... -
JPEG格式 标准 规范 二进制
2008-10-27 23:14 7281JPEG格式 微处理机中的存放顺序有正序(big end ...
相关推荐
CentOS 7 安装 MySQL
tar -zxvf mysql8.tar.gz解压后,文件夹里包含mysql8安装的依赖文件,perl rpm文件和mysql rpm文件,直接执行脚本mysql8.sh install安装或者mysql8.sh uninstall卸载,基本上是一键安装或者卸载了,只包含了安装,不...
脚步可以带版本参数执行./mysql7install.sh 5.7.29,如不带参赛默认安装5.7.30。本脚步具有一定自动调优功能,可以自动跟进机器资源完整部分参数调优,可供中型企业使用。这不能删除,也不能替换上传内容有点蛋疼呀...
在centos如何安装MySQL 1.Rpm -qa | grep mysql -------查看是否安装了mysql 2.Yum -y install mysql----卸载无关组件 新手博主上传,请见谅
CentOS7安装MySQL教程https://www.cnblogs.com/bigbrotherer/p/7241845.html wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm yum -y install mysql57-community-release-el7-10....
默认centos使用yum install安装的mysql版本很低,需要更新远程mysql仓库 适用于RedHat7/Centos7/Oracle Linux7
2,创建目录/data/mysql #mkdir -p /data/mysql 3,修改脚本内容,将“MYSQL='mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz'” 改成对应的镜像名 4,sudo ln -s /usr/lib64/libncurses.so.6.1 /usr/lib64/libncurses...
在CentOS 7上安装MySQL可以按照以下步骤进行: 打开终端并以root用户身份登录服务器。 使用以下命令更新系统软件包: yum update 安装MySQL的软件存储库。执行以下命令导入MySQL存储库的RPM包: rpm -Uvh ...
CentOS7安装mysql yum方式 1.下载 wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm 4.本地安装yum源 yum localinstall mysql57-community-release-el7-11.noarch.rpm 5.检测是否已经...
2.使用root执行脚本,命令最好是source install-dbsql.sh,否则mysql命令无法在最后生效 3.请确保端口3306(可更改)没有被占用,安全要求默认端口3306不可启用 4.请尽量确保yum源可用 5.暂时不支持centos和redhat 版本...
本文为大家分享了centOS下安装mysql5.7详细步骤,供大家参考,具体内容如下 第一步: 第一句检测系统是否自带安装mysql,若有执行第二句删除系统自带的mysql及其依赖。...yum localinstall mysql-community-rele
CentOS安装Mysql> 使用yum进行安装配置yum源yum -y install mysql-serverCentOS 7的yum源中貌似没有正常安装M
3、./rpminstall_msyql.sh运行自动安装mysql57 4、数据库初始化: 为了保证数据库目录为与文件的所有者为 mysql 登陆用户,如果你是以 root 身份运行 mysql 服务,需要执行下面的命令初始化 mysqld --initialize --...
yum install mysql mysql-server mysql-libs mysql-server 关于mysql各个包的功能是: “mysqlfor the client tools,mysql-serverfor the server and associated tools, andmysql-libsfor the libraries. The ...
mysql8一键化安装脚本 1 可以自由安装在任何目录下(直接回车默认安装在/auto),而且所有的东西都在此目录下,不会出现在其他目录中 2 内置可以在存储过程中执行Linux命令插件 3 安装完成后,cd /auto/mysql/support-...
在CentOS中,执行sudo yum install mysql命令,不会安装mysql数据库,而是会安装MariaDB。 关于MySQL和MariaDB的关系,请参考百度百科。 在CentOS里安装MySQL要复杂一些,具体过程如下。 从mysql官网下载mysql仓库,...
1.下载mysql官方rpm # 下载地址 https://dev.mysql.com/downloads/ # 选择 MySQL Yum Repository ...yum -y install mysql57-community-release-el7-10.noarch.rpm yum -y install mysql-community-server 3.启动Mysq
安装 保证你的用户有权限 安装 没有 切换 root su root (su的意思:swich user) # rpm -ivh http://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpm ...# yum install mysql-community-server
centos6.4下安装mysql5.7.18的具体步骤,分享给大家。 1、首先检查是否已经安装过mysql,查找mysql相关软件rpm包 #rpm -qa | grep mysql 2、将所有与mysql相关的东西删除 #yum -y remove mysql-libs-5.1.66-2.el6_...
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql #生成mysql系统数据库 ln -s /usr/local/mysql/my.cnf /etc/my.cnf #添加到/etc目录的软连接 cp ./support-files/...