i can't reach mysql data when i'm rendering

Here are my codes:

app.get('/index/:name',function(req, res){
    connection.query('SELECT * FROM deneme',function(err, rows, fields){
        if (err) throw err;
        var paragraf = rows;
    });

    res.render('index', {
        title: req.params.name,
        para: paragraf
    });
});

But node can't reach 'paragraf' variable from inside of 'res.render'. Node returns

ReferenceError: paragraf is not defined

How can i reach paragraf variable from outside of asynchronous functio?

This is not how an asynchronous method result is supposed to be used, because the rows will not be available until the query callback is called.

Try instead:

app.get('/index/:name', function(req, res){
    connection.query('SELECT * FROM deneme', function(err, rows, fields){
        ...

        res.render('index', {
            title: req.params.name,
            para: rows
        });
    });
});

This way you access and render the results (rows) once they are available.