are several reasons why I write this little
How To
, the second of this blog. One is the growing interest from some friends in the raid on the "Linux world, particularly in the use of Ubuntu.
This little guide is limited to explain the installation of pgadmin , a simple graphical tool, but widely used for the design and maintenance of databases in postgres. Also, explain the basics of installation and operation of one of the most popular DBMSs: PostgreSQL It also rescue this guide can be used in versions 6.10 (Edgy Eft), 7.04 (Feisty Fawn), 7.10 (Gutsy Gibbon) and in fact be with the version 8.04 (Hardy Heron) of Ubuntu Linux .
NOTE: For example, user name, I'm using the account that I have in my machine and called Luix, which also has administrator permissions. In your case, it is more likely to be another ;-) Let's go to the above, do so in an elegant and interesting, using a terminal ;-)
1) Installing PostgreSQL
relatively important as detail- - be installed PostgreSQL version 8.2
Luix @ machine: $ sudo apt-get install postgresql-8.2
This command will install from the repositories that have -en nuestro caso, Ubuntu - los paquetes: libpq5 postgresql-8.2 postgresql-client-8.2 postgresql-client-common postgresql-common, si es que no lo tenemos instalados.
Una vez instalado postgreSQL, necesitamos acceder a la cuenta postgres.
luix@maquina:$ sudo bash
root@maquina:# su postgres
Hecho esto, nos aparecerá un nuevo prompt:
postgres@maquina:$
Ahora crearemos un usuario para las Bases de Datos, usando el comando createuser seguido del nombre de usuario que necesitemos, en mi caso crearé el usuario luix:
postgres@maquina:$ createuser luix
¿Será el nuevo rol un superusuario? (S / n) s
CREATE ROLE
proceed to create a database to experiment, in my case I will create the database mydb: postgres @ machine: $ createdb mydb CREATE DATABASE
Once done
we return to the console of our user account by doing: postgres @ machine: $ exit
root @ machine: # exit
Luix @ machine: $
Then, we start postgres: Luix @ machine: $ psql mydb
This command will show output like this:
Welcome to psql 8.2.3, the PostgreSQL interactive terminal.
Type: \\ copyright for distribution terms
\\ h for help with SQL commands
\\? Help psql commands \\ g or end with semicolon to execute a query \\ q to quit mydb = #
Which tells us that we have entered into the database. At this point, we can execute all SQL commands we need.
As a last step, for security reasons, we can change the password of our user database.
mydb = # alter user Luix with password 'password';
ALTER ROLE To exit the database do:
mydb = # \\ q
Finally, to connect from the console to the database you just created, whenever they need it, simply run the command:
Luix @ machine: $ psql-h localhost
mydb Password: password
That's all in the management of postgres from the console, now see the installation and operation of pgadmin. 2) Installing pgadmin
Luix @ machine: $ sudo apt-get install pgadmin3 The above command will allow us to install the packages: libpq4 pgadmin3-data pgadmin3
Well, now run the program just install:
Luix @ machine: $ pgadmin3 &
Once this is done, proceed to add a server for our program, following the menu: File -> Add Server ...
Enter the requested information in the dialog presented:
Address: localhost Description: Connecting to localhost maintenance BD: mydb
Username: Luix
Password: password
In 'Address' we enter the location of our database, in our case will be 'localhost' since we are working with a local database. In
'Description' preferably describe the connection to the server you are creating.
'BD-keeping' in this field enter the name of the database that we will manage.
'Username', for that, enter the user name and account created in the DBMS. 'Luix' in our example.
'Password', enter the password you assign the user name you have created. We to 'accept'.
Then, we Double-click 'on the new connection is created and then observe something like this:
rescue the interface should be provided by pgadmin is very friendly, You can do everything from create a table to create more databases, based simply right click on the desired item in the left pane. For example, if we create a table we must right-click on the item 'Tables (n)' and then 'new table' (where n is the number of tables we have today), to fill the name and owner.
In short, it's just "exploring" some options and menus of the program, according to our needs, of course.
PD. Any errors or comments can do it THROUGH a comment or sending me an e-mail.
0 comments:
Post a Comment