{"id":88,"date":"2025-11-18T04:26:49","date_gmt":"2025-11-18T04:26:49","guid":{"rendered":"https:\/\/blogs.giamkichsan.com\/?p=88"},"modified":"2025-12-13T08:30:50","modified_gmt":"2025-12-13T08:30:50","slug":"mysql-ket-noi-tu-may-khac-client","status":"publish","type":"post","link":"https:\/\/blogs.giamkichsan.com\/index.php\/2025\/11\/18\/mysql-ket-noi-tu-may-khac-client\/","title":{"rendered":"Mysql &#8211; K\u1ebft n\u1ed1i t\u1eeb m\u00e1y kh\u00e1c (client)"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">\u2705 <strong>1<\/strong> <strong>D\u00f9ng MySQL CLI:<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -h 192.168.1.50 -P 3306 -u lanuser -p<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u2705 <strong>2. Connection String trong .NET<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>string connectionString = \"Server=192.168.1.50;Port=3306;Database=testdb;User ID=lanuser;Password=password123;SslMode=none;\";\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udd25 <strong>L\u01b0u \u00fd: Ki\u1ec3m tra MySQL c\u00f3 l\u1eafng nghe \u0111\u00fang port<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo netstat -tulnp | grep mysqld\n<\/code><\/pre>\n\n\n\n<p>Ho\u1eb7c:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ss -tulnp | grep 3306\n<\/code><\/pre>\n\n\n\n<p>B\u1ea1n ph\u1ea3i th\u1ea5y:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>LISTEN ... 0.0.0.0:3306<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udd25 <strong>L\u01b0u \u00fd:T\u1ea1o user MySQL cho LAN<\/strong><\/h3>\n\n\n\n<p>Truy c\u1eadp MySQL:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -u root -p\n<\/code><\/pre>\n\n\n\n<p>T\u1ea1o user \u0111\u01b0\u1ee3c ph\u00e9p truy c\u1eadp t\u1eeb m\u1ea1ng LAN:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE USER 'lanuser'@'%' IDENTIFIED BY 'password123';\n<\/code><\/pre>\n\n\n\n<p>C\u1ea5p quy\u1ec1n:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GRANT ALL PRIVILEGES ON *.* TO 'lanuser'@'%' WITH GRANT OPTION;\nFLUSH PRIVILEGES;\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udd25 <strong>L\u01b0u \u00fd: M\u1edf port 3306 tr\u00ean CentOS Firewall<\/strong><\/h3>\n\n\n\n<p>CentOS d\u00f9ng <strong>firewalld<\/strong>, m\u1edf port nh\u01b0 sau:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo firewall-cmd --permanent --add-port=3306\/tcp\nsudo firewall-cmd --reload\n<\/code><\/pre>\n\n\n\n<p>\u2192 Ki\u1ec3m tra:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo firewall-cmd --list-all<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>\u2705 1 D\u00f9ng MySQL CLI: \u2705 2. Connection String trong .NET \ud83d\udd25 L\u01b0u \u00fd: Ki\u1ec3m tra MySQL c\u00f3 l\u1eafng nghe \u0111\u00fang port Ho\u1eb7c: B\u1ea1n ph\u1ea3i <a class=\"mh-excerpt-more\" href=\"https:\/\/blogs.giamkichsan.com\/index.php\/2025\/11\/18\/mysql-ket-noi-tu-may-khac-client\/\" title=\"Mysql &#8211; K\u1ebft n\u1ed1i t\u1eeb m\u00e1y kh\u00e1c (client)\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,1],"tags":[],"class_list":["post-88","post","type-post","status-publish","format-standard","hentry","category-mysql-he-quan-tri-co-so-du-lieu","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.giamkichsan.com\/index.php\/wp-json\/wp\/v2\/posts\/88","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.giamkichsan.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.giamkichsan.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.giamkichsan.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.giamkichsan.com\/index.php\/wp-json\/wp\/v2\/comments?post=88"}],"version-history":[{"count":1,"href":"https:\/\/blogs.giamkichsan.com\/index.php\/wp-json\/wp\/v2\/posts\/88\/revisions"}],"predecessor-version":[{"id":89,"href":"https:\/\/blogs.giamkichsan.com\/index.php\/wp-json\/wp\/v2\/posts\/88\/revisions\/89"}],"wp:attachment":[{"href":"https:\/\/blogs.giamkichsan.com\/index.php\/wp-json\/wp\/v2\/media?parent=88"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.giamkichsan.com\/index.php\/wp-json\/wp\/v2\/categories?post=88"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.giamkichsan.com\/index.php\/wp-json\/wp\/v2\/tags?post=88"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}