Data Analysis System DIY2/3: Local 64-bit Win7+dev C + + compiler operation VMware CENTOS7+MARIADB

Source: Internet
Author: User
Tags centos server heidisql



Data Analysis system DIY three tasks to complete.






First, use VMware to install 64-bit CentOS. The database service side with CentOS comes with the good.






Third, using the local Win7 64 matlab r2012b Connection database for mining analysis.






This article is the process of completing the second task.






1.Terminal Enter the command line "Ifconfig" to confirm the CentOS virtual machine ip:192.168.124.128



2. Enter the command line " Netstat-anp|grep mysqld "Confirm mariadb service Monitor port:3306



3.win7 Local installation using HEIDISQL test whether can connect (Hedisql is the Windows version of the MARIADB with the GUI management software, install MARIADB can choose to install)



Session Settings after opening Heidisql






Click "Open" to report a connection failure



4. Guess the reason may be mariadb remote access permission is not open



Terminal login mariadb "Mysql-u root-p", enter password login



MARIADB prompt after entering the empowered statement "GRANT all privileges on * * to ' root ' @ '% ' identified by ' login password ' with GRANT OPTION;"



Then refresh "flush privileges;"



Go back to the heidisql on the Win7 and try again. Still fail.



5. Guess the reason may be Centos7 's own firewall



Command line "StartX" enters GUI after setting Applications-sundry-firewall






On the Configure page default Zone-public Select Ports page, click AddButton. Confirm after entering mariadbport3306. Effect.






6. go back to the Heidisql in Win7 and test. The connection was successful.



7. However, after restarting CentOS, I found that Heidesql was not connected to the server .



Enter the applications-sundry-firewall-ports check settings and find out that the 3306port open rule in the previous 5th step disappears.






The one that was just set up is a temporary rule, and the rule expires after overloading the firewall.






To set a permanent rule, the configuration must be set to permanent first. For example, with:






Open the Ports page again, and click AddButton. Confirm after entering port number 3306.



This time, no matter how many times a reboot, CentOS will be able to log in successfully.






/* Next dev C + +, did not expect this step is so difficult, took nearly 8 hours to fix. */



8. First need to download MySQL devpak,devpaks.org somehow by the wall. Dev C + + cannot be updated.



Just use Goagent to access the browser. Finally found it.






9. Install "Mysql-6.1.5-1aved.devpak" via the "Tools-package manager-install" in Dev C + + after download






10. After successful installation, go to Dev C + + "tools-compile Options"



A. Adding a command "-lmysql" to a connector in a compiler page






B. Folder page-C includes file page/c++ include file page join MySQL package path "Dev-cpp installation folder \include\mysql"






11. Copy the " Libmysql.dll" in "Dev-cpp installation folder \lib" into "C:\Windows\SysWOW64". Otherwise, the system will error when compiling.









Assuming also reported is wrong, then cuff it to "C:\Windows\system32."



12. Compile Routines




#include <mysql.h> #include <stdlib.h> #include <stdio.h>int main (int narguments, char *pszarguments[ ]) {MYSQL *conn; Mysql_res *res; Mysql_row Row;char *server = "192.168.124.128";//the CentOS server Ipchar *user = "root" confirmed in the first step; char *password = "123456"; /* Change this to your password */char *database = "MySQL"; conn = Mysql_init (NULL);/* Connect to Database */if (!mysql_real_connect (conn, serv Er,user, password, database, 0, NULL, 0)) {fprintf (stderr, "%s\n", MYSQL_ERROR (conn));} /* Send SQL query */if (mysql_query (conn, "Show Tables")) {fprintf (stderr, "%s\n", MYSQL_ERROR (conn));} res = MYSQL_USE_RESULT (conn);/* Output table name */printf ("MySQL Tables in%s database:\n", database); while (row = Mysql_ Fetch_row (res)) = NULL) printf ("%s \ n", row[0]);/* Close Connection */mysql_free_result (res); Mysql_close (conn);// System ("PAUSE"); return 0;}

Execution results











Task Two, Mission accomplished!



Data Analysis System DIY2/3: Local 64-bit Win7+dev C + + compiler operation VMware CENTOS7+MARIADB


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.