{"id":444938,"date":"2025-01-13T21:01:17","date_gmt":"2025-01-13T21:01:17","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=444938"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=444938","title":{"rendered":"<span>Marzban: \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u0441 sqlite3 \u043d\u0430 MySQL<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/574\/c07\/79a\/574c0779ac6e9c603b9cd1b8d1c47683.png\" width=\"2560\" height=\"1440\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/574\/c07\/79a\/574c0779ac6e9c603b9cd1b8d1c47683.png\"\/><\/figure>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u0441 SQLite \u043d\u0430 MySQL \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e\u0435 \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 .db, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043d\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b, \u043d\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u2014 \u043d\u0438 \u0432 \u044d\u0442\u043e\u0442, \u043d\u0438 \u0432 \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \u0431\u0430\u0437\u044b.<br \/>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043e\u043f\u0438\u0441\u0430\u043d \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f docker.<\/p>\n<pre><code class=\"bash\">sqlite&gt; .tables Error: file is not a database<\/code><\/pre>\n<pre><code class=\"bash\">database disk image is malformed<\/code><\/pre>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0443\u0442:\u00a0<a href=\"https:\/\/www.sqlite.org\/faq.html#q21\" rel=\"noopener noreferrer nofollow\">https:\/\/www.sqlite.org\/faq.html#q21<\/a><\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 MySQL \u043d\u0430 Ubuntu \u0432\u0435\u0440\u0441\u0438\u0438 20+<\/h3>\n<pre><code class=\"bash\">sudo apt install mysql-server -y ;\\ mysql --version ;\\ sudo mysql_secure_installation ;\\ systemctl status mysql<\/code><\/pre>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 MySQL \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h3>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0447\u0435\u0440\u0435\u0437 uuid.uuid4() \u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0431\u0430\u0437\u0435 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443<\/p>\n<pre><code class=\"bash\">sudo mysql<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u00a0<code>&lt;user&gt;<\/code>\u00a0\u0438\u00a0<code>&lt;password&gt;<\/code>\u00a0\u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0441\u0432\u043e\u0438<\/p>\n<pre><code class=\"sql\">CREATE USER '&lt;user&gt;'@'localhost' IDENTIFIED WITH mysql_native_password BY '&lt;password&gt;'; GRANT ALL PRIVILEGES ON *.* TO '&lt;user&gt;'@'localhost' WITH GRANT OPTION;  CREATE USER '&lt;user&gt;'@'%' IDENTIFIED WITH mysql_native_password BY '&lt;password&gt;'; GRANT ALL PRIVILEGES ON *.* TO '&lt;user&gt;'@'%' WITH GRANT OPTION;  FLUSH PRIVILEGES;  create database marzban;<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0431\u0430\u0437\u0430 \u0431\u044b\u043b\u0430 \u0432\u0438\u0434\u043d\u0430 \u0438\u0437\u0432\u043d\u0435 &#8212; \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0432\u00a0<code>\/etc\/mysql\/mysql.conf.d\/mysqld.cnf<\/code><\/p>\n<pre><code class=\"bash\">#bind-address           = 127.0.0.1  # \u0421\u0442\u0430\u0440\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 bind-address            = 0.0.0.0    # \u041d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/code><\/pre>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 sqlite3 \u0438 \u0441\u043d\u044f\u0442\u0438\u0435 \u0434\u0430\u043c\u043f\u0430<\/h3>\n<pre><code class=\"bash\">cd ~ ;\\ wget https:\/\/github.com\/nalgeon\/sqlite\/releases\/download\/3.47.0\/sqlite3-ubuntu ;\\ mv sqlite3-ubuntu sqlite3 ;\\ chmod +x sqlite3<\/code><\/pre>\n<p>\u0421\u043d\u0438\u043c\u0430\u0435\u043c \u0434\u0430\u043c\u043f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0431\u0430\u0437\u044b (sqlite):<br \/><code>db_file<\/code>\u00a0&#8212; \u0444\u0430\u0439\u043b \u0431\u0430\u0437\u044b Marzban \u043f\u0430\u043d\u0435\u043b\u0438<br \/><code>dump_file<\/code>\u00a0&#8212; \u0444\u0430\u0439\u043b \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e \u0434\u0430\u043c\u043f\u0430<\/p>\n<pre><code class=\"bash\">mkdir -p $HOME\/dump ;\\ db_file=$HOME\/sqlite3_backups\/db_backup_2024-12-24_10-30-01.sqlite3 dump_file=$HOME\/dump\/marzban_dump.sql $HOME\/sqlite3 $db_file '.dump --data-only' | sed \"s\/INSERT INTO \\([^ ]*\\)\/REPLACE INTO \\`\\\\1\\`\/g\" &gt; $dump_file ls -la $dump_file<\/code><\/pre>\n<h3>\u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 MySQL<\/h3>\n<p>\u041d\u0443\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432\u00a0<code>.env<\/code>\u00a0\u0444\u0430\u0439\u043b\u0435 marzban.<br \/>\u0423 \u043c\u0435\u043d\u044f \u043e\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u00a0<code>$HOME\/code\/Marzban\/.env<\/code>, \u043d\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430:<\/p>\n<pre><code class=\"python\">SQLALCHEMY_DATABASE_URL = \"mysql+pymysql:\/\/&lt;user&gt;:&lt;password&gt;@127.0.0.1:3306\/marzban\"<\/code><\/pre>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u00a0<code>&lt;user&gt;<\/code>\u00a0\u0438\u00a0<code>&lt;password&gt;<\/code>\u00a0\u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 (\u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0431\u0430\u0437\u0435 MySQL).<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043a \u043d\u043e\u0432\u043e\u0439, \u043f\u0443\u0441\u0442\u043e\u0439 \u0431\u0430\u0437\u0435, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435, \u043b\u0438\u0431\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 (\u0435\u0441\u043b\u0438 \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441 \u043f\u0430\u043d\u0435\u043b\u044c\u044e \u0447\u0435\u0440\u0435\u0437 docker)<\/p>\n<pre><code class=\"bash\">alembic upgrade head<\/code><\/pre>\n<p>\u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043c\u043f\u0430 \u0432 MySQL<\/p>\n<p><strong>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/strong><\/p>\n<p>\u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e SQLite \u0444\u0430\u0439\u043b \u0431\u044d\u043a\u0430\u043f\u0430 \u043d\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u043f\u043e\u0434 \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435: \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 INSERT \u0442\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f REPLACE. \u041f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u044e, \u0447\u0442\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0441 \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u043c\u0435\u0434\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441. <br \/>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430: \u043c\u043e\u0439 \u0444\u0430\u0439\u043b <code>db.sqlite3<\/code> \u0437\u0430\u043d\u0438\u043c\u0430\u043b 230 \u041c\u0411, \u0430 \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0432 MySQL \u0444\u043e\u0440\u043c\u0430\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u0441\u044f \u0434\u043e 167 \u041c\u0411. \u041d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0442\u0430\u043a\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0443 MySQL \u0443\u0448\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0430\u0441\u0430.<\/p>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 <code>node_user_usages<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u00ab\u0443\u0442\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0440\u0430\u0444\u0438\u043a\u0430\u00bb \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438. \u0423 \u043c\u0435\u043d\u044f \u0432 \u043d\u0435\u0439 \u0431\u044b\u043b\u043e ~1,5 \u043c\u043b\u043d \u0441\u0442\u0440\u043e\u043a.<\/p>\n<p>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f: \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438, \u0438 \u0438\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u043e\u043b\u044c\u0448\u0435 1000, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u043c\u0435\u0436\u0434\u0443 \u043f\u0443\u0441\u0442\u044b\u043c\u0438 \u0431\u0430\u0437\u0430\u043c\u0438, \u2014 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043a \u0431\u0435\u0441\u0448\u043e\u0432\u043d\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0443, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043a\u043d\u043e \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0440\u0430\u0431\u043e\u0442 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u043e\u043c\u0443 \u043e\u043f\u044b\u0442\u0443 \u0443 \u0432\u0430\u0448\u0438\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>\u041e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e \u0432\u0430\u0448 \u043f\u043b\u0430\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c:<\/p>\n<ul>\n<li>\n<p>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0431\u043e\u0442\u0430<\/p>\n<\/li>\n<li>\n<p>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 marzban &#8212; \u043f\u0430\u043d\u0435\u043b\u0438<\/p>\n<\/li>\n<li>\n<p>\u0421\u043d\u044f\u0442\u0438\u0435 \u0431\u044d\u043a\u0430\u043f\u0430<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u043d\u0435\u043b\u0438 marzban<\/strong>\u00a0(\u043e\u0442\u043a\u0430\u0442 \u0432\u00a0<code>.env<\/code>\u00a0\u0444\u0430\u0439\u043b\u0435 \u043d\u0430 sqlite)<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u044d\u043a\u0430\u043f\u0430 \u0432 MySQL \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u00a0<code>.env<\/code>\u00a0\u043d\u0430 pymysql<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0430\u043d\u0435\u043b\u0438 marzban<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043f\u0430\u043d\u0435\u043b\u0438<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"bash\">mysql -u &lt;user&gt; -p&lt;password&gt; -h 127.0.0.1 marzban -e \"SET FOREIGN_KEY_CHECKS = 0; SET NAMES utf8mb4; SOURCE \/root\/dump\/marzban_dump.sql;\"<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 -p \u0432\u0432\u043e\u0434\u0438\u0442\u0441\u044f\u00a0<strong>\u0441\u043b\u0438\u0442\u043d\u043e<\/strong>\u00a0\u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044f. \u0414\u0430\u043b\u0435\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 marzban \u043f\u0430\u043d\u0435\u043b\u0438 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/p>\n<pre><code class=\"bash\">systemctl restart marzban<\/code><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 MySQL \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d! \ud83c\udf89\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0441\u0440\u0430\u0437\u0443 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u0431\u044d\u043a\u0430\u043f \u0431\u0430\u0437\u044b \u0438 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0443 \u0434\u0430\u043c\u043f \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<hr\/>\n<p>\u0411\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0432\u0441\u0435\u043c \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435! \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f &#8212; \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u043c\u043e\u0439 \u043a\u0430\u043d\u0430\u043b <a href=\"https:\/\/t.me\/+mfY_q3ZYoEZlNzli\" rel=\"noopener noreferrer nofollow\">artydev &amp; Co<\/a>.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/873278\/\"> https:\/\/habr.com\/ru\/articles\/873278\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u0441 SQLite \u043d\u0430 MySQL \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e\u0435 \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 .db, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043d\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b, \u043d\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u2014 \u043d\u0438 \u0432 \u044d\u0442\u043e\u0442, \u043d\u0438 \u0432 \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \u0431\u0430\u0437\u044b.<br \/>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043e\u043f\u0438\u0441\u0430\u043d \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f docker.<\/p>\n<pre><code class=\"bash\">sqlite&gt; .tables Error: file is not a database<\/code><\/pre>\n<pre><code class=\"bash\">database disk image is malformed<\/code><\/pre>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0443\u0442:\u00a0<a href=\"https:\/\/www.sqlite.org\/faq.html#q21\" rel=\"noopener noreferrer nofollow\">https:\/\/www.sqlite.org\/faq.html#q21<\/a><\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 MySQL \u043d\u0430 Ubuntu \u0432\u0435\u0440\u0441\u0438\u0438 20+<\/h3>\n<pre><code class=\"bash\">sudo apt install mysql-server -y ;\\ mysql --version ;\\ sudo mysql_secure_installation ;\\ systemctl status mysql<\/code><\/pre>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 MySQL \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h3>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0447\u0435\u0440\u0435\u0437 uuid.uuid4() \u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0431\u0430\u0437\u0435 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443<\/p>\n<pre><code class=\"bash\">sudo mysql<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u00a0<code>&lt;user&gt;<\/code>\u00a0\u0438\u00a0<code>&lt;password&gt;<\/code>\u00a0\u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0441\u0432\u043e\u0438<\/p>\n<pre><code class=\"sql\">CREATE USER '&lt;user&gt;'@'localhost' IDENTIFIED WITH mysql_native_password BY '&lt;password&gt;'; GRANT ALL PRIVILEGES ON *.* TO '&lt;user&gt;'@'localhost' WITH GRANT OPTION;  CREATE USER '&lt;user&gt;'@'%' IDENTIFIED WITH mysql_native_password BY '&lt;password&gt;'; GRANT ALL PRIVILEGES ON *.* TO '&lt;user&gt;'@'%' WITH GRANT OPTION;  FLUSH PRIVILEGES;  create database marzban;<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0431\u0430\u0437\u0430 \u0431\u044b\u043b\u0430 \u0432\u0438\u0434\u043d\u0430 \u0438\u0437\u0432\u043d\u0435 &#8212; \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0432\u00a0<code>\/etc\/mysql\/mysql.conf.d\/mysqld.cnf<\/code><\/p>\n<pre><code class=\"bash\">#bind-address           = 127.0.0.1  # \u0421\u0442\u0430\u0440\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 bind-address            = 0.0.0.0    # \u041d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/code><\/pre>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 sqlite3 \u0438 \u0441\u043d\u044f\u0442\u0438\u0435 \u0434\u0430\u043c\u043f\u0430<\/h3>\n<pre><code class=\"bash\">cd ~ ;\\ wget https:\/\/github.com\/nalgeon\/sqlite\/releases\/download\/3.47.0\/sqlite3-ubuntu ;\\ mv sqlite3-ubuntu sqlite3 ;\\ chmod +x sqlite3<\/code><\/pre>\n<p>\u0421\u043d\u0438\u043c\u0430\u0435\u043c \u0434\u0430\u043c\u043f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0431\u0430\u0437\u044b (sqlite):<br \/><code>db_file<\/code>\u00a0&#8212; \u0444\u0430\u0439\u043b \u0431\u0430\u0437\u044b Marzban \u043f\u0430\u043d\u0435\u043b\u0438<br \/><code>dump_file<\/code>\u00a0&#8212; \u0444\u0430\u0439\u043b \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e \u0434\u0430\u043c\u043f\u0430<\/p>\n<pre><code class=\"bash\">mkdir -p $HOME\/dump ;\\ db_file=$HOME\/sqlite3_backups\/db_backup_2024-12-24_10-30-01.sqlite3 dump_file=$HOME\/dump\/marzban_dump.sql $HOME\/sqlite3 $db_file '.dump --data-only' | sed \"s\/INSERT INTO \\([^ ]*\\)\/REPLACE INTO \\`\\\\1\\`\/g\" &gt; $dump_file ls -la $dump_file<\/code><\/pre>\n<h3>\u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 MySQL<\/h3>\n<p>\u041d\u0443\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432\u00a0<code>.env<\/code>\u00a0\u0444\u0430\u0439\u043b\u0435 marzban.<br \/>\u0423 \u043c\u0435\u043d\u044f \u043e\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u00a0<code>$HOME\/code\/Marzban\/.env<\/code>, \u043d\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430:<\/p>\n<pre><code class=\"python\">SQLALCHEMY_DATABASE_URL = \"mysql+pymysql:\/\/&lt;user&gt;:&lt;password&gt;@127.0.0.1:3306\/marzban\"<\/code><\/pre>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u00a0<code>&lt;user&gt;<\/code>\u00a0\u0438\u00a0<code>&lt;password&gt;<\/code>\u00a0\u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 (\u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0431\u0430\u0437\u0435 MySQL).<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043a \u043d\u043e\u0432\u043e\u0439, \u043f\u0443\u0441\u0442\u043e\u0439 \u0431\u0430\u0437\u0435, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435, \u043b\u0438\u0431\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 (\u0435\u0441\u043b\u0438 \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441 \u043f\u0430\u043d\u0435\u043b\u044c\u044e \u0447\u0435\u0440\u0435\u0437 docker)<\/p>\n<pre><code class=\"bash\">alembic upgrade head<\/code><\/pre>\n<p>\u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043c\u043f\u0430 \u0432 MySQL<\/p>\n<p><strong>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/strong><\/p>\n<p>\u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e SQLite \u0444\u0430\u0439\u043b \u0431\u044d\u043a\u0430\u043f\u0430 \u043d\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u043f\u043e\u0434 \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435: \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 INSERT \u0442\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f REPLACE. \u041f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u044e, \u0447\u0442\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0441 \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u043c\u0435\u0434\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441. <br \/>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430: \u043c\u043e\u0439 \u0444\u0430\u0439\u043b <code>db.sqlite3<\/code> \u0437\u0430\u043d\u0438\u043c\u0430\u043b 230 \u041c\u0411, \u0430 \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0432 MySQL \u0444\u043e\u0440\u043c\u0430\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u0441\u044f \u0434\u043e 167 \u041c\u0411. \u041d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0442\u0430\u043a\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0443 MySQL \u0443\u0448\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0430\u0441\u0430.<\/p>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 <code>node_user_usages<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u00ab\u0443\u0442\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0440\u0430\u0444\u0438\u043a\u0430\u00bb \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438. \u0423 \u043c\u0435\u043d\u044f \u0432 \u043d\u0435\u0439 \u0431\u044b\u043b\u043e ~1,5 \u043c\u043b\u043d \u0441\u0442\u0440\u043e\u043a.<\/p>\n<p>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f: \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438, \u0438 \u0438\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u043e\u043b\u044c\u0448\u0435 1000, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u043c\u0435\u0436\u0434\u0443 \u043f\u0443\u0441\u0442\u044b\u043c\u0438 \u0431\u0430\u0437\u0430\u043c\u0438, \u2014 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043a \u0431\u0435\u0441\u0448\u043e\u0432\u043d\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0443, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043a\u043d\u043e \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0440\u0430\u0431\u043e\u0442 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u043e\u043c\u0443 \u043e\u043f\u044b\u0442\u0443 \u0443 \u0432\u0430\u0448\u0438\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>\u041e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e \u0432\u0430\u0448 \u043f\u043b\u0430\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c:<\/p>\n<ul>\n<li>\n<p>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0431\u043e\u0442\u0430<\/p>\n<\/li>\n<li>\n<p>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 marzban &#8212; \u043f\u0430\u043d\u0435\u043b\u0438<\/p>\n<\/li>\n<li>\n<p>\u0421\u043d\u044f\u0442\u0438\u0435 \u0431\u044d\u043a\u0430\u043f\u0430<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u043d\u0435\u043b\u0438 marzban<\/strong>\u00a0(\u043e\u0442\u043a\u0430\u0442 \u0432\u00a0<code>.env<\/code>\u00a0\u0444\u0430\u0439\u043b\u0435 \u043d\u0430 sqlite)<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u044d\u043a\u0430\u043f\u0430 \u0432 MySQL \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u00a0<code>.env<\/code>\u00a0\u043d\u0430 pymysql<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0430\u043d\u0435\u043b\u0438 marzban<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043f\u0430\u043d\u0435\u043b\u0438<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"bash\">mysql -u &lt;user&gt; -p&lt;password&gt; -h 127.0.0.1 marzban -e \"SET FOREIGN_KEY_CHECKS = 0; SET NAMES utf8mb4; SOURCE \/root\/dump\/marzban_dump.sql;\"<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 -p \u0432\u0432\u043e\u0434\u0438\u0442\u0441\u044f\u00a0<strong>\u0441\u043b\u0438\u0442\u043d\u043e<\/strong>\u00a0\u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044f. \u0414\u0430\u043b\u0435\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 marzban \u043f\u0430\u043d\u0435\u043b\u0438 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/p>\n<pre><code class=\"bash\">systemctl restart marzban<\/code><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 MySQL \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d! \ud83c\udf89\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0441\u0440\u0430\u0437\u0443 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u0431\u044d\u043a\u0430\u043f \u0431\u0430\u0437\u044b \u0438 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0443 \u0434\u0430\u043c\u043f \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<hr\/>\n<p>\u0411\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0432\u0441\u0435\u043c \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435! \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f &#8212; \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u043c\u043e\u0439 \u043a\u0430\u043d\u0430\u043b <a href=\"https:\/\/t.me\/+mfY_q3ZYoEZlNzli\" rel=\"noopener noreferrer nofollow\">artydev &amp; Co<\/a>.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/873278\/\"> https:\/\/habr.com\/ru\/articles\/873278\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-444938","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/444938","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=444938"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/444938\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=444938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=444938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=444938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}