Avatar billede master_nemo Nybegynder
12. august 2001 - 02:42 Der er 13 kommentarer og
1 løsning

nybegynder!!

jeg sidder her og har ingen anelse om hvordan man laver MySql databaser.. og kan ikke bruge acces2000 da serveren det skal op på er linux.
og det jeg skal er en ting der gør at jeg bare kan sætte de ting man skal kune downlo0ade skrive dem ind i en MySql database og det så på en måde komer op på siden... så hvis nogen vil hjælpe med det... sætte mig igang vanker der 400 point.. men bare sig hvis det er meget besværlig og så får i selvfølgelig flere point :o)


/MN
Avatar billede jelzin101 Praktikant
12. august 2001 - 02:46 #1
ok. jeg kan hjælpe dig med at sætte mysql databasen op.

først går du ind på www.mysql.com og henter den database ned du har brug for.

-meld lige tilb. når du har gjort det.
Avatar billede master_nemo Nybegynder
12. august 2001 - 02:48 #2
jelzin>>vilken database har je brug for?.. har minus forstnd på det.. ehh jeg har windows installeret her og linus på serveren... hvad skal jeg så hente.. det er win ME :o)


/MN
Avatar billede jelzin101 Praktikant
12. august 2001 - 02:50 #3
ok - du skal sikkert bruge databasen til linux -ved du hvilken linux du har ?
Avatar billede master_nemo Nybegynder
12. august 2001 - 02:51 #4
det er en redhat 7.1


/MN
Avatar billede jelzin101 Praktikant
12. august 2001 - 02:54 #5
ok.
Avatar billede jelzin101 Praktikant
12. august 2001 - 02:55 #6
Avatar billede jelzin101 Praktikant
12. august 2001 - 02:58 #7
Now that MySQL is installed, you may want to know how to configure it. For this guide, I assume that you have the programs: mysqladmin and mysql, which should have been installed when you got the MySQL packages.

First, if you haven\'t done this already, set the root password for MySQL. You can do this by typing:

mysqladmin -u root password \'passwordyouwant\'

Now that the root password is set, connect to your MySQL server:

mysql -u root -p

It will prompt you for a password. Make sure to enter the one you just/previously set. You should now be left at a prompt which looks like this:


mysql>

At this point, you will create basic permissions for a user and database. For my setup, I want to allow access to localhost to all databases, and a computer which is also on the network, which is referred to as \"windowsbox\" will have access to all databases.

To access the user, host databases, etc... type this;


mysql> use mysql;
Database changed
mysql>

To give localhost permission to access all databases, enter this:



mysql> insert into
        -> host(host,db,Select_priv, Insert_priv, Update_priv,
        -> Delete_priv, Create_priv, Drop_priv)
        -> values(\'localhost\',\'%\',\'Y\',\'Y\',\'Y\',\'Y\',\'Y\',\'Y\');


Note, the \'%\' can be replaced with a database name. The \'%\' is a wildcard.

Following the previous format, to allow access from another hostname (in this case \"windowsbox\") add this:


mysql> insert into
        -> host(host,db,Select_priv, Insert_priv, Update_priv,
        -> Delete_priv, Create_priv, Drop_priv)
        -> values(\'windowsbox\',\'%\',\'Y\',\'Y\',\'Y\',\'Y\',\'Y\',\'Y\');

Again, \'%\' is used as a Wild-Card.

To create a user \'djg\' who can access the MySQL server from localhost, type this:


mysql> insert into
        -> user (host, user, password)
        -> values(\'localhost\',\'djg\',password(\'mypassword\'));


To give the user access from another hostname, domain, etc... add other entries accordingly. For example, to give user djg access from windowsbox:


mysql> insert into
        -> user (host, user, password)
        -> values(\'windowsbox\',\'djg\',password(\'mypassword\'));

Now... to give the user permissions to access a database from localhost, add this entry and change with your appropriate information:

mysql> insert into
      -> db (host,db,user,Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv)
      -> values (\'localhost\',\'mydatabase\',\'djg\',\'Y\',\'Y\',\'Y\',\'Y\',\'Y\',\'Y\');

To give the user permissions from windowsbox, add this:

mysql> insert into
      -> db (host,db,user,Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv)
      -> values (\'windowsbox\',\'mydatabase\',\'djg\',\'Y\',\'Y\',\'Y\',\'Y\',\'Y\',\'Y\');

Now, type: quit and you will exit mysql.

Finally, create the actual database (in this case, \'mydatabase\') type this:

mysqladmin -u -p create mydatabase

After prompting you for a password, it should create the database.

At this point, you must reload MySQL. Type:

mysqladmin -u root -p reload

After prompting you for a password it should reload MySQL.

Congratulations. If all goes well you have set up a user and database with MySQL. You may now create/edit/delete/etc... tables as much as you\'d like.

Also, please note that by default, MySQL will open up network port 3306 to allow remote requests. If you do not want this port open, append \"--skip-networking\" when running safe_mysqld to start the daemon. Debian users can edit /etc/init.d/mysqld and change this line:


/usr/bin/safe_mysqld > /www.null 2>&1 &

to this:


/usr/bin/safe_mysqld --skip-networking > /www.null 2>&1 &

Now whenever running /etc/init.d/mysql start, it will not open up port 3306
Avatar billede jelzin101 Praktikant
12. august 2001 - 03:00 #8
hvis du stadig er i tvivl om hvordan man installere er her en guide :
With the program downloaded, you should make sure you\'re logged in as \"root\" before proceeding with the installation, unless you only want to install MySQL in your own home directory. Begin by unpacking the downloaded file and moving into the directory that is created:

% tar xfz mysql-version.tar.gz
% cd mysql-version
Next you need to configure the MySQL install. Unless you really know what you\'re doing, all you should have to do is tell it where to install. I recommend /usr/local/mysql:

% ./configure --prefix=/usr/local/mysql
After sitting through the screens and screens of configuration tests, you\'ll eventually get back to a command prompt. You\'re ready to compile MySQL:

% make
After even more screens of compilation, you\'ll again be returned to the command prompt. You\'re now ready to install your newly compiled program:

% make install
MySQL is now installed, but before it can do anything useful its database files need to be installed too. Still in the directory you installed from, type the following command:

% scripts/mysql_install_db
With that done, you can delete the directory you\'ve been working in, which just contains all the source files and temporary installation files. If you ever need to reinstall, you can just re-extract the mysql-version.tar.gz file.

With MySQL installed and ready to store information, all that\'s left is to get the server running on your computer. While you can run the server as the root user, or even as yourself (if, for example, you installed the server in your own home directory), the best idea is to set up a special user on the system that can do nothing but run the MySQL server. This will remove any possibility of someone using the MySQL server as a way to break into the rest of your system. To create a special MySQL user, you\'ll need to log in as root and type the following commands:

% /usr/sbin/groupadd mysqlgrp
% /usr/sbin/useradd -g mysqlgrp mysqlusr
By default, MySQL stores all database information in the var subdirectory of the directory to which it was installed. We want to make it so that nobody can access that directory except our new MySQL user. The following commands will do this (I\'m assuming you installed MySQL to the /usr/local/mysql directory):

% cd /usr/local/mysql
% chown -R mysqlusr.mysqlgrp var
% chmod -R go-rwx var
Everything\'s set for you to try launching the MySQL server for the first time. From the MySQL directory, type the following command:

% bin/safe_mysqld --user=mysqlusr &
The MySQL server has now been launched by the MySQL user and will stay running (just like your Web or FTP server) until your computer is shut down. To test that the server is running properly, type the following command:

% bin/mysqladmin -u root status
A little blurb with some statistics about the MySQL server should be displayed. If you get an error message, something has gone wrong. If retracing your steps to make sure you did everything described above doesn\'t solve the problem, a post to the SitePoint.com Forums will probably help you pin it down in no time.

If you want to set up your MySQL server to run automatically whenever the system is running (just like your Web server probably does), you\'ll have to set it up to do so. In the share/mysql subdirectory of the MySQL directory, you\'ll find a script called mysql.server that can be added to your system startup routines to do this.

Assuming you\'ve set up a special MySQL user to run the MySQL server, you\'ll need to edit the mysql.server script before you use it. Open it in your favorite text editor and change the mysql_daemon_user setting to refer to the user you created above:

mysql_daemon_user=mysqlusr
Setting up the script to be run by your system at startup is a highly operating system-dependant task. If you\'re not using RedHat Linux and you\'re not sure of how to do this, you\'d be best to ask someone who knows. In RedHat Linux, the following commands (starting in the MySQL directory) will do the trick:

% cp share/mysql/mysql.server /etc/rc.d/init.d/
% cd /etc/rc.d/init.d
% chmod 500 mysql.server
% cd /etc/rc.d/rc3.d
% ln -s ../init.d/mysql.server S99mysql
% cd /etc/rc.d/rc5.d
% ln -s ../init.d/mysql.server S99mysql
That\'s it! To test that this works, you can reboot your system and request the status of the server as before to make sure it runs properly at startup.

Avatar billede master_nemo Nybegynder
12. august 2001 - 03:05 #9
ok.. jelzin.. tror ikke du har fostået.. jeg skal ikke ha installeret det på serveren.. men såmænd lave en database på min egen maskine.. som er win... selve installationen af mqsql på serveren er ikke problemet da det er installeret i forvejen.. det jeg skal ha hjælp til er at lave selve databasen...


/MN
Avatar billede jelzin101 Praktikant
12. august 2001 - 03:21 #10
oki :) - det kan jeg da godt hjælpe dig med.

hvis det er på din win skal du gå ind i det bib. du har installeret sql servern under. (typisk c:\\mysql) her går du ind i \\bin biblioteket.

saa taster du ;
mysql

så er du inde i mysql\'s commandosys.

for at oprette en database skriver du for eks.

CREATE database JELZINERSEJ;

(med enter efter ;)
så har du lavet en db.
Avatar billede jelzin101 Praktikant
12. august 2001 - 03:29 #11
det næste du så ska lave er nogle tables.

f.eks. har jeg er tables der hedder newsmail

her har jeg flg. felter :

1. ID = giver bare et fortløbende nummer
2. Name = brugenavnet på siden
3. email = email adressen.


-det du så skal finde ud af er hvile felter du har brug for og dernæst hvilke data disse skal kunne indeholde.
Avatar billede jelzin101 Praktikant
12. august 2001 - 03:35 #12
-jeg går i seng nu... men svarer igen i morgen(hvor jeg sikkert også er i stand til at give et mere kvalificeret svar :)
Avatar billede lauer Nybegynder
12. august 2001 - 09:46 #13
Hey
Jeg ville hente http://phpmyadmin.sourceforge.net
og sætte den op. Med den har du styr over alt i din mysqldb, så du kan lave alle de tabeller og databaser som du vil.
Avatar billede master_nemo Nybegynder
14. august 2001 - 18:20 #14
sorry.. laver det i acces og konvertere det til mysql istedet. sorry for besvær

/MN
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Computerworld tilbyder specialiserede kurser i database-management

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester