手撕包菜SSBC DHT磁力源码修改MariaDB密码
-
数据库相关
脚本安装的mariadb默认是不容许其余机器登陆的,因此若是你要使用本地的数据库链接工具链接这个mariadb的话就要开启mariadb的root远程链接了,还有就是默认是没有密码的,因此最好你设置一个root密码,首先设置root密码,输入
mysql_secure_installation
以后按照提示操做就好
[root@bboysoul-centos ssbc]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, andyou haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] n ... skipping. By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
以后就是开启mariadb的远程访问 首先登录mariadb
mysql -u root -p
以后输入下面命令
MariaDB [mysql]> use mysql Database changed MariaDB [mysql]> update user set Host='%' where Host='localhost'; Query OK, 1 row affected (0.00 sec)Rows matched: 1 Changed: 1 Warnings: 0 MariaDB [mysql]> flush privileges; Query OK, 0 rows affected (0.00 sec)MariaDB [mysql]>
接着就能够远程登录数据库了 以后要修改手撕包菜程序里面的链接密码 首先关闭相关的进程
ps -ef |grep python
通常就是下面几个进程
root 958 1 0 20:51 ? 00:00:00 /usr/bin/python -Es /usr/sbin/tuned -l -P root 3604 1 0 21:13 pts/0 00:00:00 /usr/bin/python2 /usr/bin/gunicorn ssbc.wsgi:application -b 127.0.0.1:8000 --reload root 3616 3604 1 21:13 pts/0 00:00:09 /usr/bin/python2 /usr/bin/gunicorn ssbc.wsgi:application -b 127.0.0.1:8000 --reload root 3693 1 12 21:15 ? 00:01:30 python simdht_worker.py root 3694 1 0 21:15 ? 00:00:00 python index_worker.py
kill以后再kill下面几个进程
ps -ef |grep search
root 3467 1 0 21:03 ? 00:00:00 searchd --config ./sphinx.conf
root 3468 3467 0 21:03 ? 00:00:02 searchd --config ./sphinx.conf
接着修改配置文件
vim /root/ssbc/sphinx.conf
增加数据库的密码
sql_host = 127.0.0.1 sql_user = root sql_pass = sql_db = ssbc sql_port = 3306 # optional, default is 3306
vi /root/ssbc/workers/index_worker.py
SRC_HOST = '127.0.0.1'
SRC_USER = 'root'
SRC_PASS = ''
DST_HOST = '127.0.0.1'
DST_USER = 'root'
DST_PASS = ''
上面两个密码都要修改
vi /root/ssbc/workers/simdht_worker.py
DB_HOST = '127.0.0.1'
DB_USER = 'root'
DB_PORT = 3306
DB_PASS = ''
DB_NAME = 'ssbc'
BLACK_FILE = 'black_list.txt'
vim /root/ssbc/ssbc/settings.py
修改下面,root后面加上数据库密码
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'ssbc',
'HOST': '127.0.0.1',
'PORT': 3306,
'USER': 'root',
'PASSWORD': 'woyaoxuehuilinux',
'OPTIONS': {
"init_command": "SET storage_engine=MYISAM",
}
}
}
关于数据迁移
这个其实好办,先在新的机器上执行脚本,执行完成以后删除数据库创建新的ssbc数据库记住编码要utf-8的,以后把老的数据库导入新的就能够了
推荐阅读
文章标签:
版权声明: 本文除特别说明外均由 麒麟在线 原创
本文链接: https://www.70ol.com/jishu/54.html,尊重共享,欢迎转载,请自觉添加本文链接,谢谢!
分享本文: 请填写您的分享代码。
呃 本文暂时没人评论 来添加一个吧
发表评论