473,516 Members | 2,910 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

php script to create mySQL database programmatically

Need php script to create mySQL database programmatically; since
hosting configuration may not allow create database from script, script
also need eliminate/rewrite all restrictions in appropriate places in
that hosting.

Oct 31 '06 #1
14 6070
mistral wrote:
Need php script to create mySQL database programmatically; since
hosting configuration may not allow create database from script, script
also need eliminate/rewrite all restrictions in appropriate places in
that hosting.
So you want a script that bypasses the securitysettings of your
hostingcompany?

Erwin
Oct 31 '06 #2

"Erwin Moller писал(а):
"
mistral wrote:
Need php script to create mySQL database programmatically; since
hosting configuration may not allow create database from script, script
also need eliminate/rewrite all restrictions in appropriate places in
that hosting.

So you want a script that bypasses the securitysettings of your
hostingcompany?

Erwin
------------

script must reconfigure/rewrite only settings that's responsible for
blocking of creating mySQL database programmatically, i.e. normal way.
Elementary. Is this clear enough?

Oct 31 '06 #3
mistral wrote:
Need php script to create mySQL database programmatically; since
hosting configuration may not allow create database from script, script
also need eliminate/rewrite all restrictions in appropriate places in
that hosting.
You can make a script to create a database. But you can't make a script
which will hack the host's security settings.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 31 '06 #4

"Jerry Stuckle wrote:
"
mistral wrote:
Need php script to create mySQL database programmatically; since
hosting configuration may not allow create database from script, script
also need eliminate/rewrite all restrictions in appropriate places in
that hosting.
You can make a script to create a database. But you can't make a script
which will hack the host's security settings.
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Any workaround how to solve this programmatically? There is such
scripts, and yes, it possible, just can no find url i saw it.

Oct 31 '06 #5
mistral wrote:
"Erwin Moller писал(а):
"
>>mistral wrote:

>>>Need php script to create mySQL database programmatically; since
hosting configuration may not allow create database from script, script
also need eliminate/rewrite all restrictions in appropriate places in
that hosting.

So you want a script that bypasses the securitysettings of your
hostingcompany?

Erwin

------------

script must reconfigure/rewrite only settings that's responsible for
blocking of creating mySQL database programmatically, i.e. normal way.
Elementary. Is this clear enough?
Yes. You want to hack your free host's security settings.

And if it could do that, there wouldn't be much sense to even having
security settings, would there?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 31 '06 #6
mistral wrote:
"Jerry Stuckle wrote:
"
>>mistral wrote:
>>>Need php script to create mySQL database programmatically; since
hosting configuration may not allow create database from script, script
also need eliminate/rewrite all restrictions in appropriate places in
that hosting.

>>You can make a script to create a database. But you can't make a script
which will hack the host's security settings.

>>==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Any workaround how to solve this programmatically? There is such
scripts, and yes, it possible, just can no find url i saw it.
You probably can't find it because it doesn't exist. Security is there
for a reason.

Locking your door doesn't do any good if you hand keys to everyone.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 31 '06 #7

"Jerry Stuckle писал(а):
"
mistral wrote:
Need php script to create mySQL database programmatically; since
hosting configuration may not allow create database from script, script
also need eliminate/rewrite all restrictions in appropriate places in
that hosting.

You can make a script to create a database. But you can't make a script
which will hack the host's security settings.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
======================================

Need working code to create database programmatically via PHP.

M.

Oct 31 '06 #8
mistral wrote:
"Jerry Stuckle писал(а):
"
>>mistral wrote:
>>>Need php script to create mySQL database programmatically; since
hosting configuration may not allow create database from script, script
also need eliminate/rewrite all restrictions in appropriate places in
that hosting.

You can make a script to create a database. But you can't make a script
which will hack the host's security settings.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

======================================

Need working code to create database programmatically via PHP.

M.
Not a problem. Here are some links to get you started:

For the SQL you need:

http://dev.mysql.com/doc/refman/5.1/...-database.html
http://dev.mysql.com/doc/refman/5.1/...ate-table.html

And optionally:

http://dev.mysql.com/doc/refman/5.1/...ate-index.html
From the PHP end, check out:

http://www.php.net/manual/en/function.mysql-connect.php
http://www.php.net/manual/en/functio...-create-db.php
http://www.php.net/manual/en/functio...-select-db.php
http://www.php.net/manual/en/function.mysql-query.php
http://www.php.net/manual/en/function.mysql-close.php

And for error processing, you'll want:

http://www.php.net/manual/en/function.mysql-error.php

This should get you started.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 31 '06 #9
mistral wrote:
Need php script to create mySQL database programmatically; since
hosting configuration may not allow create database from script, script
also need eliminate/rewrite all restrictions in appropriate places in
that hosting.
LOL
Thank you.

--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.
Oct 31 '06 #10

"Jerry Stuckle wrote:
"
mistral wrote:
"Jerry Stuckle wrote:
"
>mistral wrote:

Need php script to create mySQL database programmatically; since
hosting configuration may not allow create database from script, script
also need eliminate/rewrite all restrictions in appropriate places in
that hosting.
You can make a script to create a database. But you can't make a script
which will hack the host's security settings.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
======================================

Need working code to create database programmatically via PHP.

M.

Not a problem. Here are some links to get you started:

For the SQL you need:

http://dev.mysql.com/doc/refman/5.1/...-database.html
http://dev.mysql.com/doc/refman/5.1/...ate-table.html

And optionally:

http://dev.mysql.com/doc/refman/5.1/...ate-index.html
From the PHP end, check out:

http://www.php.net/manual/en/function.mysql-connect.php
http://www.php.net/manual/en/functio...-create-db.php
http://www.php.net/manual/en/functio...-select-db.php
http://www.php.net/manual/en/function.mysql-query.php
http://www.php.net/manual/en/function.mysql-close.php

And for error processing, you'll want:

http://www.php.net/manual/en/function.mysql-error.php

This should get you started.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


Code from php.net does not work..

<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}

$sql = 'CREATE DATABASE my_db';
if (mysql_query($sql, $link)) {
echo "Database my_db created successfully\n";
} else {
echo 'Error creating database: ' . mysql_error() . "\n";
}
?>
Warning: mysql_connect() [function.mysql-connect]: Can't connect to
local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in
/web/www/domain/users/u/username/createdb.php on line 2
Could not connect: Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2)

Ugly, very ugly..

m.

Oct 31 '06 #11
mistral wrote:
"Jerry Stuckle wrote:
"
>>mistral wrote:
>>>"Jerry Stuckle wrote:
"

>>>>mistral wrote:
>Need php script to create mySQL database programmatically; since
>hosting configuration may not allow create database from script, script
>also need eliminate/rewrite all restrictions in appropriate places in
>that hosting.
>

You can make a script to create a database. But you can't make a script
which will hack the host's security settings.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

======================================

Need working code to create database programmatically via PHP.

M.

Not a problem. Here are some links to get you started:

For the SQL you need:

http://dev.mysql.com/doc/refman/5.1/...-database.html
http://dev.mysql.com/doc/refman/5.1/...ate-table.html

And optionally:

http://dev.mysql.com/doc/refman/5.1/...ate-index.html
From the PHP end, check out:

http://www.php.net/manual/en/function.mysql-connect.php
http://www.php.net/manual/en/functio...-create-db.php
http://www.php.net/manual/en/functio...-select-db.php
http://www.php.net/manual/en/function.mysql-query.php
http://www.php.net/manual/en/function.mysql-close.php

And for error processing, you'll want:

http://www.php.net/manual/en/function.mysql-error.php

This should get you started.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


Code from php.net does not work..

<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}

$sql = 'CREATE DATABASE my_db';
if (mysql_query($sql, $link)) {
echo "Database my_db created successfully\n";
} else {
echo 'Error creating database: ' . mysql_error() . "\n";
}
?>
Warning: mysql_connect() [function.mysql-connect]: Can't connect to
local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in
/web/www/domain/users/u/username/createdb.php on line 2
Could not connect: Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2)

Ugly, very ugly..

m.
Are you running this on the server with MySQL installed? If so, it
looks like MySQL isn't running or the admin has it set up different from
the defaults.

Either way the only one who can tell you more is your hosting company.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 31 '06 #12
Warning: mysql_connect() [function.mysql-connect]: Can't connect to
local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in
/web/www/domain/users/u/username/createdb.php on line 2
Could not connect: Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2)

Ugly, very ugly..

m.- Hide quoted text
That's actually a very helpful and friendly error message. It first
tells you why it failed. Then it tells you which machine is responsible
for the failure. Even further, it tells you what it expects that
machine to be responsible for. It tells you the full path to the
script. It also tells you the script's name and the line number of the
problem statemetns.

ppmd

Oct 31 '06 #13
"Jerry Stuckle wrote:
"
mistral wrote:
"Jerry Stuckle wrote:
"
>mistral wrote:

"Jerry Stuckle wrote:
"
>>>mistral wrote:
Need php script to create mySQL database programmatically; since
hosting configuration may not allow create database from script, script
also need eliminate/rewrite all restrictions in appropriate places in
that hosting.
You can make a script to create a database. But you can't make a script
which will hack the host's security settings.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

======================================

Need working code to create database programmatically via PHP.

M.
Not a problem. Here are some links to get you started:

For the SQL you need:

http://dev.mysql.com/doc/refman/5.1/...-database.html
http://dev.mysql.com/doc/refman/5.1/...ate-table.html

And optionally:

http://dev.mysql.com/doc/refman/5.1/...ate-index.html
From the PHP end, check out:

http://www.php.net/manual/en/function.mysql-connect.php
http://www.php.net/manual/en/functio...-create-db.php
http://www.php.net/manual/en/functio...-select-db.php
http://www.php.net/manual/en/function.mysql-query.php
http://www.php.net/manual/en/function.mysql-close.php

And for error processing, you'll want:

http://www.php.net/manual/en/function.mysql-error.php

This should get you started.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Code from php.net does not work..

<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$sql = 'CREATE DATABASE my_db';
if (mysql_query($sql, $link)) {
echo "Database my_db created successfully\n";
} else {
echo 'Error creating database: ' . mysql_error() . "\n";
}
?>
Warning: mysql_connect() [function.mysql-connect]: Can't connect to
local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in
/web/www/domain/users/u/username/createdb.php on line 2
Could not connect: Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2)
Ugly, very ugly..
m.
Are you running this on the server with MySQL installed? If so, it
looks like MySQL isn't running or the admin has it set up different from
the defaults.
Either way the only one who can tell you more is your hosting company.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
yes, installed. Just run phpinfo.php, it show the following MySQL
related info :
mysql

MySQL Support: enabled
Active Persistent Links: 0
Active Links: 0
Client API version: 5.0.24a
MYSQL_MODULE_TYPE: external
MYSQL_SOCKET: /var/run/mysqld/mysqld.sock
MYSQL_INCLUDE: -I/usr/include/mysql
MYSQL_LIBS: -L/usr/lib -lmysqlclient

Directive Local Value Master Value
mysql.allow_persistent: On On
mysql.connect_timeout: 60 60
mysql.default_host: no value no value
mysql.default_password: no value no value
mysql.default_port: no value no value
mysql.default_socket: no value no value
mysql.default_user: no value no value
mysql.max_links: Unlimited Unlimited
mysql.max_persistent: Unlimited Unlimited
mysql.trace_mode: Off Off
m.

Oct 31 '06 #14
mistral wrote:
"Jerry Stuckle wrote:
"
>>mistral wrote:
>>>"Jerry Stuckle wrote:
"

>>>>mistral wrote:
>"Jerry Stuckle wrote:
>"


>>>>>>mistral wrote:
>>
>>
>>
>>>Need php script to create mySQL database programmatically; since
>>>hosting configuration may not allow create database from script, script
>>>also need eliminate/rewrite all restrictions in appropriate places in
>>>that hosting.
>>>
>>
>>You can make a script to create a database. But you can't make a script
>>which will hack the host's security settings.
>>
>>--
>>==================
>>Remove the "x" from my email address
>>Jerry Stuckle
>>JDS Computer Training Corp.
>>js*******@attglobal.net
>>==================
>
>======================================
>
>Need working code to create database programmatically via PHP.
>
>M.
>

Not a problem. Here are some links to get you started:

For the SQL you need:

http://dev.mysql.com/doc/refman/5.1/...-database.html
http://dev.mysql.com/doc/refman/5.1/...ate-table.html

And optionally:

http://dev.mysql.com/doc/refman/5.1/...ate-index.html
From the PHP end, check out:

http://www.php.net/manual/en/function.mysql-connect.php
http://www.php.net/manual/en/functio...-create-db.php
http://www.php.net/manual/en/functio...-select-db.php
http://www.php.net/manual/en/function.mysql-query.php
http://www.php.net/manual/en/function.mysql-close.php

And for error processing, you'll want:

http://www.php.net/manual/en/function.mysql-error.php

This should get you started.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


Code from php.net does not work..

<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
>>>$sql = 'CREATE DATABASE my_db';
if (mysql_query($sql, $link)) {
echo "Database my_db created successfully\n";
} else {
echo 'Error creating database: ' . mysql_error() . "\n";
}
?>


>>>Warning: mysql_connect() [function.mysql-connect]: Can't connect to
local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in
/web/www/domain/users/u/username/createdb.php on line 2
Could not connect: Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2)

>>>Ugly, very ugly..

>>>m.


>>Are you running this on the server with MySQL installed? If so, it
looks like MySQL isn't running or the admin has it set up different from
the defaults.

>>Either way the only one who can tell you more is your hosting company.

>>--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


yes, installed. Just run phpinfo.php, it show the following MySQL
related info :
mysql

MySQL Support: enabled
Active Persistent Links: 0
Active Links: 0
Client API version: 5.0.24a
MYSQL_MODULE_TYPE: external
MYSQL_SOCKET: /var/run/mysqld/mysqld.sock
MYSQL_INCLUDE: -I/usr/include/mysql
MYSQL_LIBS: -L/usr/lib -lmysqlclient

Directive Local Value Master Value
mysql.allow_persistent: On On
mysql.connect_timeout: 60 60
mysql.default_host: no value no value
mysql.default_password: no value no value
mysql.default_port: no value no value
mysql.default_socket: no value no value
mysql.default_user: no value no value
mysql.max_links: Unlimited Unlimited
mysql.max_persistent: Unlimited Unlimited
mysql.trace_mode: Off Off
m.
This shows you what PHP thinks is installed. It may or may not match
the real installation, and even if it does match it doesn't mean MySQL
is currently running.

If MySQL support were not enabled, you would have gotten an "unknown
function" error message. But just because it's enabled doesn't mean it
works.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 31 '06 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3414
by: sunlight_sg | last post by:
Hello, i am using ADOX + VB .NET to create a Access Database programmatically. I plan to set some properties of the column such primary key. The code is as follows: Dim cat As ADOX.Catalog Dim tbl As ADOX.Table Dim idx As ADOX.Index Dim prp As ADOX.Property
2
2375
by: drah | last post by:
Hello not exactly sure if it is a php script problem or a database/table issue i apologize if i'mposting in wrong category. I was asked to put a login script on a site for someone and i made the database,tables needed but when you enter a username and password to register the database,table records dont write the information so when attempting to...
15
2659
by: harvey | last post by:
How do I make PHP create a database for mysql please? I can see how to make tables and I have read all the documents I can find but I don't understand how to make the database itself. All the tutorials I can find seem to bypass the issue by ignoring it? Am I missunderstanding something?
10
2565
by: AAaron123 | last post by:
I want to create a database with one table on the host. I can't user SQL Server Management Studio to do it so I guess I have to do it programmatically. I have in mind that in the session start (or maybe application start would be better) I'd check to see it the database exists and if not create it. The problem is that I have no idea how...
1
3303
by: Tatyasaheb Patil | last post by:
Dim file As FileInfo = New FileInfo(Path.GetFullPath("TextFile1.txt")) Dim backupScript As String = file.OpenText.ReadToEnd() Dim strCommand As String = backupScript Dim strConnection As String = "Provider=IBMDADB2;DSN=evaidya;UID=db2admin;PWD=tatya;" Dim DBConnection As OleDbConnection = New...
0
7276
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main...
0
7408
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7142
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7548
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5714
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3267
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1624
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.