首页 > P2P > p2p-编译发布流程、mysql常用命令
2015三月1

p2p-编译发布流程、mysql常用命令

[隐藏]

1.mysql搭建

1.下载mysql安装包 2.解压到自定义目录,如D:\\mysql 3.复制以下配置到my.ini保存

1
2
3
4
5
6
7
8
9
10
11
12
[client]
port=3306
default-character-set=utf8
 
[mysqld]
port=3306
character_set_server=utf8
 
basedir = D:/mysql/
datadir = D:/mysql/data/
 
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

4.增加环境变量,在系统变量path中增加d:\mysql\bin

5.mysqld –install MySQL –defaults-file="d:\mysql\my.ini" 

6.启动mysql 命令:net start MySQL

一般如果报错,就直接在任务管理器中kill掉mysqld.exe进程,或删除data下的所有log文件

再进控制面板–管理工具–服务中找到mysql,打开属性查看可执行文件的路径是否正确:

1.png

像我这,发现路径是在bin下,就把my.ini放在bin下就OK了

一般以上就能正常运行


2.mysql用于QT

1.直接打开qt的安装目录:

C:\Qt\4.7.1\src\plugins\sqldrivers\mysql,使用vs插件qt菜单,打开.pro工程,编译debug和release                                                     2.把mysql的lib下的libmysql.dlllibmysqld.dll复制到C:\Qt\4.7.1\bin下,这样

1
2
3
4
5
6
7
8
9
10
11
SqlDatabase db=QSqlDatabase::addDatabase("QMYSQL");
    db.setHostName("localhost");
    db.setDatabaseName("test");
    db.setUserName("root");
    db.setPassword("123456");
    if(!db.open()) {
        QMessageBox::critical(0, QObject::tr("Database Error"), \
            db.lastError().text());
        return false;
    }
    return true;

通过,不然会报driver not loaded错误


3.Mysql在服务端打开注意点

1.启动mysql服务

service mysql start

设置为开机自启动

chkconfig mysql on

如提示ERROR!The serverquit without updating PID file

则杀进程

ps aux|grep mysql*

查看进程id

然后kill 进程id    

2.登陆

mysql
mysql -uroot -p12346

3.提权

grant all privileges on *.* to root@'%' identified by '123456';

4.刷新

flush privileges;//mysql 新设置用户或更改密码后需用flush privileges刷新MySQL的系统权限相关表,否则会出现拒绝访问

5.让linux防火墙放过mysql

iptables -L

-F: FLASH,清空规则链


4.Mysql常用命令

1.连接MySQL

格式: mysql -h 主机地址 -u用户名 -p用户密码

例1:连接到本机上的 MySQL。

hadoop@ubuntu:~$ mysql -uroot -pmysql;

例2:连接到远程主机上的 MYSQL。

hadoop@ubuntu:~$ mysql -h 192.168.52.1 -uroot -p123456;

注意:命令后加;表示命令结束了

2.修改mysql密码

[root@localhost ~]# mysql
mysql>use mysql
mysql>update user set password=password(“123456″) where user=”root”;
mysql>flush privileges;
mysql>exit

3.执行mysql的sql脚本

mysql> create database ppdb;
Query OK, 1 row affected (0.00 sec)
mysql> use ppdb
Database changed
mysql> source e:\p2p\ppdb.sql;
mysql> show tables ;
+—————-+
| Tables_in_ppdb |
+—————-+
| ppdb_admin |
| ppdb_channels |
| ppdb_resources |
| ppdb_servers |
+—————-+
4 rows in set (0.00 sec)

4.快速查找文件夹

[root@localhost ~]# updatedb
[root@localhost ~]# locate my.cnf
/etc/my.cnf.d
/usr/my.cnf

5.查看进程

ps -ef |grep java

下面对命令选项进行说明:

-e 显示所有进程。

-f 全格式。

grep命令是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹 配的行打印出来


5.启动服务流程

1.进入linux服务器,编译sever

[root@localhost bin]# cd /mnt/hgfs/P2P/src/p2p_server_1.0/
[root@localhost p2p_server_1.0]# pwd
/mnt/hgfs/P2P/src/p2p_server_1.0
[root@localhost p2p_server_1.0]# make test

2.启动server

cd /mnt/hgfs/P2P/src/p2p_server_1.0/server/bin
[root@localhost bin]# ./run.sh start

重启就先停止server再开启

[root@localhost bin]# ./run.sh stop

重新编译server要先stop再编译 

3.编译client的ppsend 

[root@localhost bin]# cd /mnt/hgfs/P2P/src/p2p_client_1.0/
[root@localhost p2p_client_1.0]# ls -l
total 4203
drwxrwxrwx. 1 root root    4096 Jun 18 02:42 base
drwxrwxrwx. 1 root root    8192 Jun 18 03:03 bin
drwxrwxrwx. 1 root root    4096 Jun 18 02:51 core
-rwxrwxrwx. 1 root root    2245 Jun 18 02:30 Makefile
-rwxrwxrwx. 1 root root 4254720 Jun 18 02:50 p2p_client.ncb
-rwxrwxrwx. 1 root root    4411 Jun 18 02:01 p2p_client.sln
drwxrwxrwx. 1 root root    4096 Jun 18 02:01 stress
drwxrwxrwx. 1 root root    4096 Jun 18 03:03 test
drwxrwxrwx. 1 root root    4096 Jun 18 02:50 vsget
drwxrwxrwx. 1 root root    4096 Jun 18 02:50 vsgetd
drwxrwxrwx. 1 root root    4096 Jun 18 02:01 vsinstaller
drwxrwxrwx. 1 root root       0 Jun 18 02:01 vstest
drwxrwxrwx. 1 root root    4096 Jun 18 02:51 vsupdater
-rwxrwxrwx. 1 root root     681 Jun 18 02:01 工程说明.txt
[root@localhost p2p_client_1.0]# make test

4. 发布ppsend到linux服务器上

改动run.sh为指定的ip和 种子hash,因为是种子服务器,所以本机ip和服务器ip相同

./ppseed -i 5cfbf62206cc988c406c5178dded8f7ccd7dc606 -s 192.168.52.129:7201 -h 192.168.52.129 -r data -c data -l log -u 1600 -m 128 -n 16 -q 1  &
[root@localhost bin]# ./run.sh start
ppseed
ppserver started!
[root@localhost bin]# pid[5094]-> 20150618[03:54:44][ 1340][main___][I][....]ppseed start ...

文章作者:hgy413
本文地址:https://hgy413.com/2107.html
版权所有 © 转载时必须以链接形式注明作者和原始出处!

17 Responses to “p2p-编译发布流程、mysql常用命令”

  1. #1 minecraft 回复 | 引用 Post:2018-10-06 21:21

    Great article! We will be linking to this great
    post on our site. Keep up the great writing.

  2. Hi there friends, its impressive post about teachingand completely
    defined, keep it up all the time.

  3. Descargar facebook
    Hello there! This is kind of off topic but I need
    some help from an established blog. Is it very difficult to set up your own blog?
    I’m not very techincal but I can figure things out pretty quick.
    I’m thinking about making my own but I’m not sure where
    to start. Do you have any ideas or suggestions?
    Cheers descargar facebook

  4. #4 quest bars cheap 回复 | 引用 Post:2018-11-04 15:14

    Quest bars cheap fitnesstipsnew1 quest bars cheap 516999410492780544
    quest bars cheap
    It’s remarkable to go to see this web site and reading the views of all
    friends regarding this paragraph, while I am also zealous of getting experience.
    Quest bars cheap fitnesstipsnew1 quest bars cheap 516999410492780544 quest bars cheap

  5. #5 Quest Bars Cheap 回复 | 引用 Post:2018-11-06 22:34

    Hi it’s me, I am also visiting this site daily, this web page
    is genuinely pleasant and the visitors are in fact sharing nice thoughts.

  6. #6 Sling TV 回复 | 引用 Post:2018-11-10 10:06

    Just desire to say your article is as surprising. The clearness on your post is simply nice and that i can assume you’re a
    professional in this subject. Fine with your permission allow me to
    grab your RSS feed to stay updated with forthcoming post.

    Thanks a million and please carry on the rewarding work.

  7. #7 Sling TV 回复 | 引用 Post:2018-11-11 12:16

    Everything is very open with a precise clarification of the challenges.
    It was truly informative. Your website is very
    useful. Thank you for sharing!

  8. I’m really enjoying the theme/design of your
    blog. Do you ever run into any browser compatibility issues?
    A few of my blog readers have complained about my blog not operating correctly in Explorer but looks great in Safari.

    Do you have any ideas to help fix this issue?

  9. There’s definately a lot to learn about this subject.
    I really like all of the points you’ve made.

  10. #10 Sling TV 回复 | 引用 Post:2018-11-14 14:00

    Hiya! I know this is kinda off topic however , I’d figured I’d ask.
    Would you be interested in trading links or maybe guest writing a blog post
    or vice-versa? My website addresses a lot of the same topics as yours and I believe we could greatly benefit
    from each other. If you happen to be interested feel free to send me an e-mail.

    I look forward to hearing from you! Excellent blog by the way!

  11. Good day! This is kind of off topic but I need some advice from an established blog.
    Is it difficult to set up your own blog? I’m not very techincal but I can figure things out pretty quick.

    I’m thinking about making my own but I’m not sure
    where to start. Do you have any tips or suggestions?

    Appreciate it

  12. Howdy! I know this is kinda off topic but I was wondering if you knew where I
    could get a captcha plugin for my comment form?

    I’m using the same blog platform as yours and I’m having problems finding one?
    Thanks a lot!

  13. Do you have a spam issue on this blog; I also am a blogger,
    and I was wondering your situation; we have developed some nice practices
    and we are looking to exchange strategies with other folks, please shoot
    me an email if interested.

  14. #14 descargar facebook 回复 | 引用 Post:2018-12-04 15:20

    I love what you guys are up too. This kind of clever work and exposure!

    Keep up the wonderful works guys I’ve added you guys to our blogroll.

  15. #15 keluaran hk 回复 | 引用 Post:2020-06-05 20:52

    For latest information you have to visit internet and on internet I found
    this website as a best site for newest updates.

  16. #16 agen bandarQ 回复 | 引用 Post:2020-06-13 03:07

    Helpful information. Lucky me I discovered your web site by accident, and
    I am stunned why this coincidence didn’t happened earlier!
    I bookmarked it.

  17. #17 g 回复 | 引用 Post:2020-06-15 22:52

    I really love your site.. Excellent colors & theme.
    Did you develop this amazing site yourself? Please reply back as I’m planning to
    create my very own website and would like to know where you got this from or what the theme is called.

    Thank you!

发表评论