200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > linux下mysql安装 目录结构 配置

linux下mysql安装 目录结构 配置

时间:2024-06-28 21:31:15

相关推荐

linux下mysql安装 目录结构 配置

数据库|mysql教程

linux,mysql,安装,目录,结构,配置,http,w

数据库-mysql教程

简单小网站源码下载,ubuntu下载网页软件,爬虫馆真实图片,php开发工程师和前端开发师,seo blog 优化lzw

/xiaochaohuashengmi/archive//11/04/2236240.html 1、准备安装程序(官方网站下载) 服务端: MySQL-server-community-5.1.44-1.rhel4.i386.rpm 客户端: MySQL-client-community-5.1.44-1.rhel4.i386.rpm 2、安装(打印信息略) [ro

c 俄罗斯方块 源码,vscode怎么用感叹号,ubuntu查看电源,tomcat程序无法发布,python爬虫灰色,php邮箱群发,光泽网络seo费用是多少lzw

分红直销源码.txt,ubuntu修复启动引导,编写tomcat重启命令行,爬虫浏览记录,一番赏源码 php,江西竞价seolzw

/xiaochaohuashengmi/archive//11/04/2236240.html

1、准备安装程序(官方网站下载)

服务端:MySQL-server-community-5.1.44-1.rhel4.i386.rpm

客户端:MySQL-client-community-5.1.44-1.rhel4.i386.rpm

2、安装(打印信息略)

[root@localhost /]#rpm -ivh MySQL-server-community-5.1.44-1.rhel4.i386.rpm;

[root@localhost /]#rpm -ivh MySQL-client-community-5.1.44-1.rhel4.i386.rpm;

3、查看安装是否成功

[root@localhost /]#netstat -ntpl;

显示3306端口开放表示服务安装成功

4、测试连接

(*修改root密码)

[root@localhost /]#/usr/bin/mysqladmin -u root password ‘xxxxxx’;

[root@localhost /]#mysql -u root -p

Enter password:xxxxxx

出现mysql>表示登陆成功!

5、对mysql用户设置远程访问权限

方法1、改表法:登陆mysql后,更改“mysql”数据库里的“user”表里的“host”项,将“localhost”改“%”

mysql>use mysql;

mysql>update user set host =’%’ where user =’root’;

mysql>select host,user from user;

mysql>FLUSH PRIVILEGES

方法2、授权法:假设允许用户username通过密码password从远程连接到mysql服务器

mysql>GRANT ALL RRIVILEGES ON *.* TO username@’%’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;

mysql>FLUSH PRIVILEGES;

6、安装目录结构

数据库目录:/var/lib/mysql/

配置文件:/usr/share/mysql(mysql.server命令及配置文件)

相关命令:/usr/bin(mysqladmin、mysqldump等命令)(*mysql的一种安全启动方式:/usr/bin/mysqld_safe

–user=root &)

启动脚本:/etc/rc.d/init.d/

7、停止/启动mysql服务

[root@localhost /]#service mysql stop;

[root@localhost /]#service mysql start;

8、修改字符编码

查看字符编码:

[root@localhost /]#show variables like ‘character\_set\_%’;

[root@localhost /]#show variables like ‘collation_%’;

停止mysql服务

将目录/usr/share/mysql下的文件my-f拷贝到/etc/下并改名为f

打开f在[client]和[mysqld]下面均加上default-character-set=utf8,并保存

*mysql5.5 改了字符集设置参数 character-set-server=utf8

重启mysql服务

9、卸载mysql

[root@localhost /]#rpm -qa|grep -i mysql

显示:

MySQL-server-community-5.1.44-1.rhel4.i386.rpm

MySQL-client-community-5.1.44-1.rhel4.i386.rpm

[root@localhost /]#rpm -e MySQL-server-community-5.1.44-1.rhel4.i386.rpm

[root@localhost /]#rpm -e MySQL-client-community-5.1.44-1.rhel4.i386.rpm

删除残余文件

[root@localhost /]#rm -f /etc/f

[root@localhost /]#rm -f /var/lib/mysql

10、复制mysql数据库

源数据库名:source_db 用户名:root

密码:xxxxxx

目标数据库名:target_db 用户名:root

密码:xxxxxx 所在主机:221.218.9.41

shell>mysqldump source_db -uroot -pxxxxxx –opt | mysql target_db -uroot -pxxxxxx -h 221.218.9.41

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。