Jump to content

Shell Sessions ?


jayc

Recommended Posts

After being away from it since the late 80's I am starting to get back into software development. Of course my focus is on PHP/MySQL.

 

I have PHP/MySQL/Apache installed on a local server for conducting some tests, also put MySQL on my workstation so I can play around in the Command prompt for directly testing some SQL commands.

 

I am running some PHP scripts on TCH for testing, and am about to start playing around with MySQL on TCH. At present the only way I can see to run MySQL commands is under a PHP script.

 

This introduces a level of complexity that I am not totally happy with for learning purposes, am wondering if there is a way to initiate a shell session on TCH so I can issue test MySQL commands from a command prompt for testing purposes.

 

Might not be possible, but thought I would ask

 

jayr

Link to comment
Share on other sites

Shell access is not available.

 

But you can enter MySQL command directly in phpMyAdmin accessible from cPanel.

 

Thanks for the quick reply, actually I mucked about with phpMyAdmin a bit and found that out, however I did notice something strange.

 

When I open up phpMyAdmin I see that my user account is flagged as "No Privileges" for creating a database. However I can go to the MySQL gui and create a database there, assume that I can also do it from the MySQL Wizard gui.

 

Once I create a database in the MySQL gui, I can then do stuff at the command line level on that database in phpMyAdmin.

 

I guess my question at this point is why don't I have database creation privileges in phpMyAdmin ? FWIW I seem to be able to create databases from within a PHP script.

 

jayr

Link to comment
Share on other sites

I guess my question at this point is why don't I have database creation privileges in phpMyAdmin ? FWIW I seem to be able to create databases from within a PHP script.

 

jayr

 

This is done for security reasons.

Due to the nature of a shared server environment, tools such as phpMyAdmin are a centralized install shared by all users. If cPanel were to enable priveleges such as Create via phpMyAdmin, then a user would be able to create databases outside of thier own account.

Link to comment
Share on other sites

This is done for security reasons.

Due to the nature of a shared server environment, tools such as phpMyAdmin are a centralized install shared by all users. If cPanel were to enable priveleges such as Create via phpMyAdmin, then a user would be able to create databases outside of thier own account.

 

Dick,

 

I spoke too soon about being able to create a database from a php script, when I went back and attempted to do so again I got an error message.

 

Next step will be to attempt creating a database in cpanel, then using a php script to create a table, and then operate on the table.

 

Am kinda wondering if there are any TCH tutorials about the baby steps in working with PHP and MySQL ?

 

I have installed a number of packages in the past that utilize both PHP and MySQL so am pretty sure that I will eventually be able to write my own stuff, but can use all the help I can get for the baby step parts.

 

jayr

Link to comment
Share on other sites

The way I work with PHP/MySQL is usually the following:

 

 

1) Create a db via CPanel and a user with appropriate privileges - As Dick said, you need to do this to create a db for security reasons.

2) Log in via PHPMyAdmin - providing you have given your user account the right privileges you can create your tables under your db as you wish from the PHPMyAdmin interface.

 

As an addition you can provide external access to your MySQL databases via CPanel using the Remote MySQL option. I tend to do this for my particular IP, then download the MySQL Query Browser and MySQL Administrator tools from the MySQL site, then log in remotely from home and/or work and operate on the db that way. I much prefer the interface of MySQL Query Browser than that of PHPMyAdmin.

 

Not having shell access does limit your scope somewhat to what you can do, but for the most part, especially if you are really just getting into the swing of things with MySQL/PHP, it won't really affect you at all.

Link to comment
Share on other sites

Am kinda wondering if there are any TCH tutorials about the baby steps in working with PHP and MySQL ?

 

W3C Schools has a decent tutorial with some examples that you can copy and modify to get you started.

 

From the home page, you can access an SQL tutorial, but for specifically writing PHP/MySQL scripts go to the PHP Tutorial, and look in the left side menu for MySQL.

 

Here is a link to the PHP/MySQL tutorial: http://www.w3schools.com/php/php_mysql_intro.asp

 

One word of caution, though. I haven't looked at that tutorial for a while, but I don't remember any advice in there about security, especially if you are going to insert user input into a database. So, when you get comfortable with connecting, selecting, updating, inserting, joining, etc, I would advise you to do some research on escaping and sanitizing data that is to be written into a database if you are going to write an app that will be live.

 

Good luck, and have fun.

 

--BC

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...