Page 1 of 2 12 LastLast
Results 1 to 15 of 27
  1. #1
    Join Date
    Jan 2012
    Posts
    91

    Unanswered: The computer in the network

    Apologize in advance for the lack of information in question, which might prove necessary to answer. I begin the adventure with sql only and do not yet understand many of the issues. But back to topic I have two computers on a home network. On one I installed the MySQL server. Is the other computer I connect to the database server and how? Thanks.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    you don't need two separate computers to use a database server, if say you are using it for development or small scale projects. you can quiote happily install 'server' software (such as a web server, database server, or similar on the same physical PC as you develop on. heck quite a few ISP's run the database server onthe same physical server as their customer websites.

    locate the software you need.
    if you 'just' want a database server then download the latest version of MySQL from their website

    if you are planning on doing web development then there's a lot to be said to install the XAMPP installation which comes with a webserver and god knows what else.

    if you have something like a NAS you may be able to run the servers on the NAS or RAID server.

    After you have installed the server software you then have to make certain that its running, and any GRANT any permissions to the required required user(s) on the required computer(s) to the required database(s). you can do this the old way. go on the computer with the server installed, open a command line client, switch tot eh MySQL doirectory and type MYSQL and read up on the GRANT command or you can use a tool such as MySQL Workbench which incorporates modelling, admin and query browser tools in one piece of software.

    there are varioius steps to take
    first make certain the server is active (check the system process and look for mysqld)
    ideally run the admin tool on the same computer as the server is on.
    create wahtever db's you ned
    create whaterver user accounts you need (there doesn't need to be a one to one mapping for physical users to MySQL users, especially if its a small home development server but in a production / live environment you may want to give some consideration to your users and respective permissions to whatever databases from whatever computer(s), often the computer is speified as either an IP address or IP mask eg 192.168.1.*
    make certain the firewall for the relevant ports on the server are open
    run workbench on your development / other computer, see if it connects with a specified user and password. if so then change the password on the super user account 'admin', BUT take note of what you have changed to in case you need super user access. grant admin priveleges to another user account. follow good practice on securing the server
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    I think what you are asking is you have a MySQL server installed and configured on one host and on a separate host you want to connect to the MySQL server. In order to do a connection to any service on a separate host you need two pieces of information: a host and a port number. The host and port uniquely identify the service that needs to handle the incoming request. In MySQL the default port is 3306.

    To check if you have connectivity to the MySQL server try the following command:

    telnet hostname_or_ip_address_of_server 3306

    This is a nice feature of telnet as it allows you to connect to a host and port. If a connection is established (no timeout's and no errors) then connectivity from the client to the server is possible.

    So to connect from the client host to the server you need to issue a command as follows:

    mysql -h hostname_or_ip_address_of_server -P 3306 -u username [-p]

    MySQL handles users and connectivity in a highly configurable way but this can lead to confusions. Basically when a user is created in the database it can be configured based on both the username and the host from which it is connecting. In most cases when you connect from the same machine as the MySQL server it will be using localhost as the host. In order to connect from a separate host you will need to setup a different user username@client_host or use a wildcard for all remote hosts username@%.

    Hope this helps!!
    Ronan Cashell
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

  4. #4
    Join Date
    Jan 2012
    Posts
    91
    I will clarify this question further. On the computer where I installed MySQL I open a command line client and enter the query. And how to do it from another computer? On the server I have not set any user accounts and passwords: USER_NAME is root and the HostName localhost.
    How to do this based on my program? I connect to the database using DBExpress.
    So I connect to the database on the local computer:

    SQLConnection1->Params->Strings[1] = "HostName=localhost";
    SQLConnection1->Params->Strings[2] = "Database=skladcelny";
    SQLConnection1->Params->Strings[3] = "User_Name=root";
    SqlConnection1-> Connected = true;
    SQLQuery1->CommandText = "SELECT * FROM SKLAD";
    SQLQuery1->ExecSQL(true);
    ClientDataSet1->Active = true;
    DBAdvGrid1->DataSource = DataSource1;

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    before you try to connect using Delphi I@d strongly recommend that you prove your installation is working

    do you know your server is active (checked for Mysqld)
    have you creatged a database
    created users
    assigned permissions
    checked you can telnet/ping the server
    proved you can connect to the server in say workbench

    ..if all that is doen then do you want to move this question to the Delphi forum?

    I guess what Im asking is is this a MySQL problem or a Delphi problem?

    incodentall saying
    So I connect to the database on the local computer:

    SQLConnection1->Params->Strings[1] = "HostName=localhost";
    SQLConnection1->Params->Strings[2] = "Database=skladcelny";
    SQLConnection1->Params->Strings[3] = "User_Name=root";
    SqlConnection1-> Connected = true;
    SQLQuery1->CommandText = "SELECT * FROM SKLAD";
    SQLQuery1->ExecSQL(true);
    ClientDataSet1->Active = true;
    DBAdvGrid1->DataSource = DataSource1;
    without enay explanation of what is going wrong / not working / error messages is not helpful and may discourage people from providing assistance.
    if you have lifted the code from the language's help file, then follow the instructions in the helpfile

    its not smart to run any software witht he root / super user account, just in case.....
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Jan 2012
    Posts
    91
    Quote Originally Posted by healdem View Post
    before you try to connect using Delphi I@d strongly recommend that you prove your installation is working

    do you know your server is active (checked for Mysqld)
    have you creatged a database
    created users
    assigned permissions
    checked you can telnet/ping the server
    proved you can connect to the server in say workbench

    ..if all that is doen then do you want to move this question to the Delphi forum?

    I guess what Im asking is is this a MySQL problem or a Delphi problem?

    incodentall saying

    without enay explanation of what is going wrong / not working / error messages is not helpful and may discourage people from providing assistance.
    if you have lifted the code from the language's help file, then follow the instructions in the helpfile

    its not smart to run any software witht he root / super user account, just in case.....
    On the local computer I have installed MySQL database. I have a simple program written by myself in C + + that works on this basis. The program is written using DBExpress. I connect to the database as I wrote earlier.
    Now I would like to use my program on another computer. PC Configuration is: Computers can see each other on the network and can see through the master server that can share files. The MySQL server is installed on only one computer.
    Is this code within the first three params to be exact parameters I am able to connect to the database from another computer?

    SQLConnection1->Params->Strings[1] = "HostName=localhost";
    SQLConnection1->Params->Strings[2] = "Database=skladcelny";
    SQLConnection1->Params->Strings[3] = "User_Name=root";

    Is it enough to change the "HostName" to an address?. How do I make a program on another computer? Does the regular shortcut? As the program is to recognize which computer comes with a request for a connection? I tried to put the program on the main server and add a shortcut on the second compiling.
    Last edited by duf; 01-24-12 at 07:24.

  7. #7
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    Did you read my post above, it clearly explains the differences between connecting locally and remotely. There are subtle differences in MySQL for setting up user accounts. Also did you check from the client machine the telnet command to see if you can actually connect. For instance if you have a firewall setup on your server it might be that this is blocking access to the MySQL server port in which case locally accessing will work but not remotely.
    Ronan Cashell
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

  8. #8
    Join Date
    Jan 2012
    Posts
    91
    Quote Originally Posted by it-iss.com View Post
    Did you read my post above, it clearly explains the differences between connecting locally and remotely. There are subtle differences in MySQL for setting up user accounts. Also did you check from the client machine the telnet command to see if you can actually connect. For instance if you have a firewall setup on your server it might be that this is blocking access to the MySQL server port in which case locally accessing will work but not remotely.
    Yes I did. Sorry not really understand the technical issues. How can I check from the telnet? In command line? How to check whether the server "listens"? How to connect to the telnet? How do I check the ip address?

  9. #9
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    assuming that you have tested the server is accessble from the other computer, we have no way of knowing as you haven't tried or reported back that its working....

    localhost is the name of a special network interface for the local computer. 'localhost' means the computer you are currently using, which is fine if MySQL is running on the same machine as the the application software. but it won't workj if the server is running on a different machine

    theres two ways of referrign to computers
    by IP Address eg 192.168.1.103
    by name eg mycomputer

    usually the best alternative for small networks is the IP address, unless your local network uses DHCP and may reallocate the number. in which case you'd probably be better off using a specific computername.
    as to what your Ip address is look in the network settings for your computer(s)
    likewise for the computer name
    each computer on the same logical network segment must have a unique IP address, computer name

    say your server is on 192.169.2.134 then you would need to replace the 'localhost' with '192.168.2.134'
    OR
    if its name was 'mycomputer' then you would need to replace the 'localhost' with 'mycomputer'
    you will need to find what those settigns are in any event
    you will need the settings of the local computer to configure the MySQL database annd user permissions.
    you will need the settings of the server to tell the application software where to search for the server.

    as said before be very very wary of using the root / admin user account to run application software if the userid and password is compromised then you could loose control of your data. its not that important if your MySQL server is a small local machine used for development which cannot be accessed by others on the netwrok, but if its for a live system it really should no be used. nor shoudl you leave the root / admin account with a null or default password for the same reasons.
    Last edited by healdem; 01-24-12 at 11:17.
    I'd rather be riding on the Tiger 800 or the Norton

  10. #10
    Join Date
    Jan 2012
    Posts
    91
    Quote Originally Posted by healdem View Post
    assuming that you have tested the server is accessble from the other computer, we have no way of knowing as you haven't tried or reported back that its working....

    localhost is the name of a special network interface for the local computer. 'localhost' means the computer you are currently using, which is fine if MySQL is running on the same machine as the the application software. but it won't workj if the server is running on a different machine

    theres two ways of referrign to computers
    by IP Address eg 192.168.1.103
    by name eg mycomputer

    usually the best alternative for small networks is the IP address, unless your local network uses DHCP and may reallocate the number. in which case you'd probably be better off using a specific computername.
    as to what your Ip address is look in the network settings for your computer(s)
    likewise for the computer name
    each computer on the same logical network segment must have a unique IP address, computer name

    say your server is on 192.169.2.134 then you would need to replace the 'localhost' with '192.168.2.134'
    OR
    if its name was 'mycomputer' then you would need to replace the 'localhost' with 'mycomputer'
    you will need to find what those settigns are in any event
    you will need the settings of the local computer to configure the MySQL database annd user permissions.
    you will need the settings of the server to tell the application software where to search for the server.

    as said before be very very wary of using the root / admin user account to run application software if the userid and password is compromised then you could loose control of your data. its not that important if your MySQL server is a small local machine used for development which cannot be accessed by others on the netwrok, but if its for a live system it really should no be used. nor shoudl you leave the root / admin account with a null or default password for the same reasons.
    Thanks for reply healdem.
    I got IP the second computer. I created a user "name@ip" in mysql. I copied a program where I connect to the database to another computer. I created an entry in the firewall system unblocking port 3306 on the second computer. To connect to the database uses the HostName parameters, USER_NAME and DataBase.

    SQLConnection1->Params->Strings[1] = "HostName=10.120.120.184";
    SQLConnection1->Params->Strings[2] = "Database=test";
    SQLConnection1->Params->Strings[3] = "User_Name=name";
    SQLConnection1->Connected = true;

    I can not connect to the database on the computer where I installed the server. I get information like: Can not connect to MySQL server on '10 .120.120.184'.
    What else can I check?

  11. #11
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    as said above
    check the firewall on both computers to make certain thew servert is visible
    check the user permissions (ie which user, form which computer(s)/IP Address/ IP Range has access to which databases).

    if you have got the server running then I'd suggest you use workbench to do the initial administration on the server. I'd also use workbench on the remote/other computer, if for nothing else to prove the remote/other computer can see the server. havign proved the MysQL software is talking to the server in my books you can then move on and check your own program. In essence its a confidence builder. once you know soemthign is working you can move on to the next stage

    as Ronan has suggested you can check basic network connectivity by using telnet or ping from a command line

    to reprise
    run workbench on the server, whilst you are there create your database create a userid and password (or more if required), assign permnissions for that user + computer + database
    run workbench on the remote / client / other computer to prove its working. if you cannot get a response from the server then its almost certainly a network issue and that probably means its a firewall problem (unlock port 3306 on the server)
    if workbench on the client computer can connect to the server then its almost certainly your application software. if its an application software then its not really a MySQL problem but a Delphi problem
    I'd rather be riding on the Tiger 800 or the Norton

  12. #12
    Join Date
    Jan 2012
    Posts
    91
    Quote Originally Posted by it-iss.com View Post

    To check if you have connectivity to the MySQL server try the following command:

    telnet hostname_or_ip_address_of_server 3306
    Ok, I tried to do this an I got some like this:
    WRZUTA - Cmd

    connection to host lost

  13. #13
    Join Date
    Jan 2012
    Posts
    91
    Quote Originally Posted by healdem View Post
    as said above
    check the firewall on both computers to make certain thew servert is visible
    check the user permissions (ie which user, form which computer(s)/IP Address/ IP Range has access to which databases).

    if you have got the server running then I'd suggest you use workbench to do the initial administration on the server. I'd also use workbench on the remote/other computer, if for nothing else to prove the remote/other computer can see the server. havign proved the MysQL software is talking to the server in my books you can then move on and check your own program. In essence its a confidence builder. once you know soemthign is working you can move on to the next stage

    as Ronan has suggested you can check basic network connectivity by using telnet or ping from a command line

    to reprise
    run workbench on the server, whilst you are there create your database create a userid and password (or more if required), assign permnissions for that user + computer + database
    run workbench on the remote / client / other computer to prove its working. if you cannot get a response from the server then its almost certainly a network issue and that probably means its a firewall problem (unlock port 3306 on the server)
    if workbench on the client computer can connect to the server then its almost certainly your application software. if its an application software then its not really a MySQL problem but a Delphi problem
    Ok. I download mysql workbench. I`ll try to do it myself.
    Last edited by duf; 01-28-12 at 08:46.

  14. #14
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    what operating system are you using?
    if its windows then download the MSI installer
    MySQL :: Download MySQL Workbench
    that will install the software
    I'd rather be riding on the Tiger 800 or the Norton

  15. #15
    Join Date
    Jan 2012
    Posts
    91
    Quote Originally Posted by healdem View Post
    what operating system are you using?
    if its windows then download the MSI installer
    MySQL :: Download MySQL Workbench
    that will install the software
    Ok, I did it. MySQL Workbench 5.2.37

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •