Here I include some usefull command if you decide to use the MYSQL database

##_____ MySQL some working commands

! Connect with the database (you can open the DOS console with the command
cmd)
C:\Archivos de programa\MySQL\MySQL Server 5.0\bin>mysql --port=3307
--host=152.78.179.118 --user=usuario --password=usuario

!Display all the databases in the MySQL
show databases;

! Use the Usuario database
use Usuario

!Display all the tables stored on Usuario
show tables;

!shows all "usuario" properties!
SHOW GRANTS FOR 'usuario'@'localhost';

!To change the "usuario" password
SET PASSWORD = PASSWORD('retneciyf');

!Made a new usuer of the usuario database

CREATE USER 'novato'@'152.78.179.118' identified by 'andrew';

! Set privileges to usuario
GRANT ALL PRIVILEGES ON *.* TO 'usuario'@'localhost' WITH GRANT OPTION;

! Shows all users of the "usuario" database
SELECT User, Password, Shutdown_priv FROM user;

!Bring all privileges to the usuario
GRANT ALL PRIVILEGES ON usuario.* TO usuario@'152.78.179.118';

!Select something from the table 125146_72_00002_168e01ve "a meteorologic
data serie" stored on the usuario database!
select * from 125146_72_00002_168e01ve

!From previous table select the date column field!
select * from tabla where Fecha between '2005 04:06:00' and '2006 05:06:00';

!To made a table on the usuario database!

CREATE TABLE p2 (Fecha Date, Valor Double),



##__________________________Connect the MySQL with R programm


##Load the MySQL R package
require(RMySQL)

## Made a connection called "con" to the previous MySQL database

con <- dbConnect(dbDriver("MySQL"), dbname = "Usuario", user = "usuario",
password = "usuario", host= "152.78.179.118", port="3307")


##List all tables disponibles in the Usuario MySQL database
dbListTables(con)

##Read and store the table "l25163_72_00003_165p01pp"
## the l25163_72_00003_165p01pp table data series is an example of a
precipitation hydrometeorological data stored
## in my computer (dont try to connect with this database because you will
not enough rights)
DatosMEDDMAN <- dbReadTable(con, "l25163_72_00003_165p01pp")

##Display all the field (columns) of the previous table
str(DatosMEDDMAN)

##To select the column (Value)
DatosMEDDMAN$Value  ## can also work with the command DatosMEDDMAN[,2]


##Display all the field (columns) of the previous table before is stored in
the R programm
dbListFields(con, "l25163_72_00003_165p01pp")

## Write a table in the Usuario MySQL database with the information stored
in the R object DatosMEDDMAN
dbWriteTable(con, "WL2", DatosMEDDMAN)




2013/12/6 <pnajnin@gmail.com>

> If I have only dbf format of those data base can I use them in R with the
> same codes of hydrometeorological example? Plz provide some example I'm new
> in R.
>
> Sent from Brishti's iPhone
>
> On 06.12.2013, at 10:35, Andres Diaz <madiazl@gmail.com> wrote:
>
> I had used MySQL instead of MSSQL and its very similar. i recomend you to
> use this database programm because you can download and install a R package
> that allows you to connect your database and R program.
>
> The name of the R package is RMySQL, if you want I Can provide you with
> some hydrometeorological examples focused on rainfall and dicharge flow
> data series. (How to connect etc..)
>
> Once you can acquire your information from the database you can start to
> play with severals statistical/spatial packages builded in R.
>
> Best regards,
>
>
>
> M. Andrés Díaz L.
> Phd. Candidate
> Sediment Transport Research Group
> Barcelona Tech
> Tel.:+34 934054196
> www.gits.ws
>
>
> El viernes, 6 de diciembre de 2013, Domagoj Culinovic escribió:
>
> I have a lot of spatial and statistical data stored in MS SQL Spatial. Now
>
> i am using web-gis server to produce thematic maps, but for better analyses
>
> i need R.
>
> Can someone help me to find solution for MS SQL Spatial. Some examples code
>
> will be welcome too, because i am new in R.
>
>
>        [[alternative HTML version deleted]]
>
>
> _______________________________________________
>
> R-sig-Geo mailing list
>
> R-sig-Geo@r-project.org <javascript:;>
>
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
>
>    [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>

	[[alternative HTML version deleted]]

